/usr/share/pyshared/ase/md/verlet.py is in python-ase 3.6.0.2515-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import numpy as np
from ase.md.md import MolecularDynamics
class VelocityVerlet(MolecularDynamics):
def __init__(self, atoms, dt, trajectory=None, logfile=None,
loginterval=1):
MolecularDynamics.__init__(self, atoms, dt, trajectory, logfile,
loginterval)
def step(self, f):
p = self.atoms.get_momenta()
p += 0.5 * self.dt * f
self.atoms.set_positions(self.atoms.get_positions() +
self.dt * p / self.atoms.get_masses()[:,np.newaxis])
# We need to store the momenta on the atoms before calculating
# the forces, as in a parallel Asap calculation atoms may
# migrate during force calculations, and the momenta need to
# migrate along with the atoms. For the same reason, we
# cannot use self.masses in the line above.
self.atoms.set_momenta(p)
f = self.atoms.get_forces()
self.atoms.set_momenta(self.atoms.get_momenta() + 0.5 * self.dt * f)
return f
|