Verlet Algorithm 3. Relevant Methods in Java Code
//Performs one timestep increment in the Verlet algorithm
public void doStep(double tStep) {
while(atomIterator.hasNext()) { //zero forces on all atoms
((Agent)atomIterator.next().ia).force.E(0.0); //integratorVerlet.Agent keeps a force Vector
pairIterator.allPairs(forceSum); //sum forces on all pairs
while(atomIterator.hasNext()) { //loop over all atoms, moving according to Verlet
Atom a = atomIterator.next();
Agent agent = (Agent)a.ia;
Space.Vector r = a.position(); //current position of the atom
r.ME(agent.rLast); //2*r-rLast
agent.force.TE(a.rm()*t2); // f/m dt^2
r.PE(agent.force); //2*r - rLast + f/m dt^2
agent.rLast.E(temp); //rLast gets present r
public class IntegratorVerlet extends Integrator