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?


1 Answer 1


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=':')
  • $\begingroup$ What are the units for the forces obtained here? $\endgroup$ Commented Sep 14, 2023 at 1:32
  • 1
    $\begingroup$ @breadcrumbs I believe it’s usually eV/Angstrom, or specified by the calculator. $\endgroup$ Commented Sep 14, 2023 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .