I have run some molecular dynamics calculations with a pretrained machine-learning potential (M3GNet) which uses the ASE MolecularDynamics calculator. My goal is to compare the results (energies and forces) for some randomly selected configurations in the trajectory with their DFT counterparts. Although the energies are easy to find (in the *.log file), I don't know where I can find the forces. Could anyone kindly suggest where to look for them, or what should I do to save the forces?
When a structure (i.e. an
ase.Atoms object) is assigned with an ASE calculator, you can use the following to get the corresponding energy and forces:
energy = atoms.get_potential_energy() forces = atoms.get_forces()
If you have a trajectory file, you can simply read a list of
ase.Atoms objects by
from ase.io import read images = read('xxx.traj', index=':')