Here is a little python code that loops through a molecular dynamics trajectory (performed with the ASE package) and outputs the forces on the atoms at each frame:
from ase.io import read
traj = read('output.traj', index=':')
counter = 0
for atoms in traj:
forces = atoms.get_forces()
print("forces: ",forces)
print("counter: ", counter)
counter = counter + 1
This is all well and good... but I'm not sure what the units are on the forces that are outputted.
According to the documentation, the units from get_forces()
depends on the calculator that is attached to the atoms
object: Docs_get_forces
But I didn't specify a calculator in my little code snippet and it outputted the forces anyway. I tried to check the calculator used by adding these lines:
calculator = atoms.get_calculator()
print(calculator)
According to this, the calculator attached to my atoms is SinglePointCalculator
. But when I looked up the source code for this calculator, I can't find where the get_forces()
calculation is being done, or any of the units associated with it.
TLDR; What are the default force units outputted by ASE? Thank you for your help.
SinglePointCalculator
: forces are stored, not calculated. Consequently, the forces you get viaget_forces()
are contingent on the units specified in the originating simulation. $\endgroup$