Skip to content

Commit

Permalink
Use FrechetCellFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Jan 13, 2025
1 parent 6f564e0 commit 0f33cc9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
34 changes: 34 additions & 0 deletions abipy/dynamics/tests/test_analyzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
""""Tests for analyzer module."""
import abipy.data as abidata

from abipy.core.testing import AbipyTest
from abipy.dynamics.analyzer import MdAnalyzer, MultiMdAnalyzer, ArrheniusPlotter


class AnalyzerTest(AbipyTest):
pass

#def test_md_analyzer(self):
#def test_multi_md_analyzer(self):

#def test_arrhenius_plotter(self):
# key_path = {
# "matgl-MD": "diffusion_cLLZO-matgl.csv",
# "m3gnet-MD": "diffusion_cLLZO-m3gnet.csv",
# }

# mpl_style_key = {
# "matgl-MD" : dict(c='blue'),
# "m3gnet-MD": dict(c='purple'),
# }

# plotter = ArrheniusPlotter()
# for key, path in key_path.items():
# plotter.add_entry_from_file(path, key, mpl_style=mpl_style_key[key])

# # temperature grid refined
# thinvt_arange = (0.6, 2.5, 0.01)
# xlims, ylims = (0.5, 2.0), (-7, -4)

# plotter.plot(thinvt_arange=thinvt_arange,
# xlims=xlims, ylims=ylims, text='LLZO cubic', savefig=None)
18 changes: 10 additions & 8 deletions abipy/ml/aseml.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
from ase.io import read
from ase.optimize.optimize import Optimizer
from ase.calculators.calculator import Calculator
from ase.filters import ExpCellFilter
from ase.filters import FrechetCellFilter # ExpCellFilter,
from ase.io.vasp import write_vasp_xdatcar, write_vasp
from ase.neb import NEB
from ase.mep import NEB
#from ase.neb import NEB
from ase.md.npt import NPT
from ase.md.nptberendsen import NPTBerendsen, Inhomogeneous_NPTBerendsen
from ase.md.nvtberendsen import NVTBerendsen
from ase.md.velocitydistribution import (MaxwellBoltzmannDistribution, Stationary, ZeroRotation)
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, Stationary, ZeroRotation
from ase.stress import voigt_6_to_full_3x3_stress, full_3x3_to_voigt_6_stress
from ase.calculators.calculator import PropertyNotImplementedError
from abipy.core import Structure
Expand All @@ -49,9 +50,9 @@
from abipy.tools.printing import print_dataframe
from abipy.tools.serialization import HasPickleIO, mjson_write
from abipy.tools.context_managers import Timer
from abipy.tools.parallel import get_max_nprocs # , pool_nprocs_pmode
from abipy.tools.parallel import get_max_nprocs #, pool_nprocs_pmode
from abipy.abio.enums import StrEnum, EnumMixin
from abipy.core.mixins import TextFile # , NotebookWriter
from abipy.core.mixins import TextFile #, NotebookWriter
from abipy.tools.plotting import (set_axlims, add_fig_kwargs, get_ax_fig_plt, get_axarray_fig_plt, set_grid_legend,
set_ax_xylabels, linear_fit_ax)
from abipy.ml.tools import get_energy_step
Expand Down Expand Up @@ -1153,7 +1154,7 @@ def pf(*args, **kwargs):

r0 = AseResults.from_atoms(atoms)

dyn = opt_class(ExpCellFilter(atoms, scalar_pressure=pressure), **opt_kwargs) if relax_mode == RX_MODE.cell else \
dyn = opt_class(FrechetCellFilter(atoms, scalar_pressure=pressure), **opt_kwargs) if relax_mode == RX_MODE.cell else \
opt_class(atoms, **opt_kwargs)

t_start = time.time()
Expand Down Expand Up @@ -2509,7 +2510,8 @@ def postprocess_images(self, images):
post-process ASE NEB calculation.
See <https://wiki.fysik.dtu.dk/ase/tutorials/neb/diffusion.html>
"""
from ase.neb import NEBTools
#from ase.neb import NEBTools
from ase.mep import NEBTools
nebtools = NEBTools(images)

# get the actual maximum force at this point in the simulation.
Expand Down Expand Up @@ -3551,7 +3553,7 @@ def run(self):

relax_mode = RX_MODE.ions
print(f"Relaxing initial atoms at fixed volume with {relax_mode=}.")
new_ucf = ExpCellFilter(new_atoms, constant_volume=True)
new_ucf = FrechetCellFilter(new_atoms, constant_volume=True)
relax_kws = dict(optimizer=self.optimizer,
relax_mode=relax_mode,
fmax=self.fmax,
Expand Down

0 comments on commit 0f33cc9

Please sign in to comment.