zadorlab / sella

A Python software package for saddle point optimization and minimization of atomic systems.
https://www.ecc-project.org/
Other
72 stars 20 forks source link

FrechetCellFilter not compatible with Sella #51

Open corinwagen opened 3 weeks ago

corinwagen commented 3 weeks ago

The wiki says:

Sella provides an interface that is compatible with the ASE Optimizer class interface.

Trying to input ase.filters.FrechetCellFilter with Sella, though, gives an error:

  File "/app/src/peregrine/optimization/periodic_optimization.py", line 94, in optimize_periodic_geometry
    optimizer = Sella(FrechetCellFilter(atoms), **sella_kwargs) if opt_settings.optimize_cell else Sella(atoms, **sella_kwargs)  # type: ignore [arg-type]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.pixi/envs/default/lib/python3.12/site-packages/sella/optimize/optimize.py", line 83, in __init__
    self.initialize_pes(
  File "/app/.pixi/envs/default/lib/python3.12/site-packages/sella/optimize/optimize.py", line 199, in initialize_pes
    self.pes = PES(
               ^^^^
  File "/app/.pixi/envs/default/lib/python3.12/site-packages/sella/peswrapper.py", line 43, in __init__
    constraints.fix_translation()
  File "/app/.pixi/envs/default/lib/python3.12/site-packages/sella/internal.py", line 957, in fix_translation
    index = np.arange(len(self.all_atoms), dtype=np.int32)
                          ^^^^^^^^^^^^^^
  File "/app/.pixi/envs/default/lib/python3.12/site-packages/sella/internal.py", line 639, in all_atoms
    return self.atoms + self.dummies
           ~~~~~~~~~~~^~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'FrechetCellFilter' and 'Atoms'

Is there any way to optimize the lattice vectors with Sella?

ehermes commented 3 weeks ago

Sella does not currently support optimization of lattice vectors. This was something I thought about at one point, but it's highly nontrivial due to how Sella internally represents the Cartesian atomic positions. It would also be quite complex to ensure that internal coordinates behave correctly in optimizations with variable unit cell size.

corinwagen commented 3 weeks ago

makes sense, thanks for explaining!