Skip to content

Commit

Permalink
Create different instances of ASE calculator before running NEB
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Feb 2, 2024
1 parent 3c6fed8 commit 5b10ecc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions abipy/ml/aseml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,8 @@ def get_calculator(self, with_delta: bool = True, reset: bool = False) -> Calcul
with_delta: False if the calculator should not include delta corrections.
reset: True if the internal cache for the model should be reset.
"""
if reset: self.reset()
#if reset: self.reset()
self.reset()

if self.nn_type == "m3gnet":
# m3gnet legacy version.
Expand Down Expand Up @@ -2282,10 +2283,9 @@ def run(self) -> None:
workdir = self.workdir

results = []
calc = CalcBuilder(self.nn_name).get_calculator()
for ind, atoms in enumerate(self.atoms_list):
write_vasp(self.workdir / f"IND_{ind}_POSCAR", atoms, label=None)
atoms.calc = calc
atoms.calc = CalcBuilder(self.nn_name).get_calculator()
results.append(AseResults.from_atoms(atoms))

write_vasp_xdatcar(self.workdir / "XDATCAR", self.atoms_list,
Expand Down
8 changes: 4 additions & 4 deletions abipy/ml/relax_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ def main():
ediff_tol, dist_tol = (0, 1e-3), (0.5, 3.5) # For ranges.
# Find pairs and save them to file
rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method=None)
rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method=None, nprocs=-1)
# Find pairs and compute static transition path.
# NO NEB HERE, just linear interpolation between final and end points
# followed by total energy calculations.
#rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method="static")
#rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method="static", nprocs=-1)
# Find pairs and compute transition path with NEB.
#rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method="aseneb")
#rsa.pairs_enediff_dist(ediff_tol, dist_tol, neb_method="aseneb", nprocs=-1)
""").add_main()

ntasks = self.nx * self.ny * self.nz
Expand Down Expand Up @@ -634,7 +634,7 @@ def run_pair(self, pair: Pair, neb_method="static", nimages=14, climb=False) ->
directory.mkdir()
atoms = initial_atoms if ip == 0 else final_atoms
write_vasp(directory / "POSCAR", atoms, label=None)
shutil.copyfile(self.jobsh_path, directory / "job.sh")
#shutil.copyfile(self.jobsh_path, directory / "job.sh")
(directory / "INCAR").symlink_to(self.incar_path)
(directory / "KPOINTS").symlink_to(self.kpoints_path)
(directory / "POTCAR").symlink_to(self.potcar_path)
Expand Down

0 comments on commit 5b10ecc

Please sign in to comment.