stfc / janus-core

Tools for machine learnt interatomic potentials
https://stfc.github.io/janus-core/
BSD 3-Clause "New" or "Revised" License
9 stars 7 forks source link

Multiple calculators not independent #217

Closed ElliottKasoar closed 1 month ago

ElliottKasoar commented 1 month ago

This is almost entirely hidden by the changes introduced by #176, but if invalidate_calc is set to False in single_point.py, then the results dictionary produced is incorrect:

from janus_core.calculations.single_point import SinglePoint
from ase.io import read

atoms_list = read("tests/data/benzene-traj.xyz", index=":")

sp = SinglePoint(atoms_list, struct_name="benzene")
sp.run()

print(sp.struct[0].calc.results["energy"])
print(sp.struct[1].calc.results["energy"])

Prints:

-74.80419118083256
-74.80419118083256

This appears to be because the same calculator object is shared between each structure.