From 0f33cc9c7f0db2394eeb6fa6a1b1661d361d0d12 Mon Sep 17 00:00:00 2001 From: Matteo Giantomassi Date: Mon, 13 Jan 2025 12:14:18 +0100 Subject: [PATCH] Use FrechetCellFilter --- abipy/dynamics/tests/test_analyzer.py | 34 +++++++++++++++++++++++++++ abipy/ml/aseml.py | 18 +++++++------- 2 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 abipy/dynamics/tests/test_analyzer.py diff --git a/abipy/dynamics/tests/test_analyzer.py b/abipy/dynamics/tests/test_analyzer.py new file mode 100644 index 000000000..78a047ba1 --- /dev/null +++ b/abipy/dynamics/tests/test_analyzer.py @@ -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) diff --git a/abipy/ml/aseml.py b/abipy/ml/aseml.py index 30f2e25ab..c372e6540 100644 --- a/abipy/ml/aseml.py +++ b/abipy/ml/aseml.py @@ -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 @@ -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 @@ -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() @@ -2509,7 +2510,8 @@ def postprocess_images(self, images): post-process ASE NEB calculation. See """ - 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. @@ -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,