def propagate(self): # Allow specialized hooks to modify the state before the regular verlet # step. self.call_verlet_hooks('pre') # Regular verlet step self.acc = -self.gpos / self.masses.reshape(-1, 1) self.vel += 0.5 * self.acc * self.timestep self.pos += self.timestep * self.vel self.ff.update_pos(self.pos) self.gpos[:] = 0.0 self.vtens[:] = 0.0 self.epot = self.ff.compute(self.gpos, self.vtens) self.acc = -self.gpos / self.masses.reshape(-1, 1) self.vel += 0.5 * self.acc * self.timestep self.ekin = self._compute_ekin() # Allow specialized verlet hooks to modify the state after the step self.call_verlet_hooks('post') # Calculate the total position change self.posnieuw = self.pos.copy() self.delta[:] = self.posnieuw - self.posoud self.posoud[:] = self.posnieuw # Common post-processing of a single step self.time += self.timestep self.compute_properties() Iterative.propagate(self) # Includes call to conventional hooks
def propagate(self): # Allow specialized hooks to modify the state before the regular verlet # step. self.call_verlet_hooks('pre') # Regular verlet step self.acc = -self.gpos/self.masses.reshape(-1,1) self.vel += 0.5*self.acc*self.timestep self.pos += self.timestep*self.vel self.ff.update_pos(self.pos) self.gpos[:] = 0.0 self.vtens[:] = 0.0 self.epot = self.ff.compute(self.gpos, self.vtens) self.acc = -self.gpos/self.masses.reshape(-1,1) self.vel += 0.5*self.acc*self.timestep self.ekin = self._compute_ekin() # Allow specialized verlet hooks to modify the state after the step self.call_verlet_hooks('post') # Calculate the total position change self.posnieuw = self.pos.copy() self.delta[:] = self.posnieuw-self.posoud self.posoud[:] = self.posnieuw # Common post-processing of a single step self.time += self.timestep self.compute_properties() Iterative.propagate(self) # Includes call to conventional hooks
def propagate(self): # Allow specialized hooks to modify the state before the regular verlet # step. self.call_verlet_hooks('pre') # Regular verlet step self.delta[:] = self.timestep*self.vel + (0.5*self.timestep**2)*self.acc self.pos += self.delta self.ff.update_pos(self.pos) self.gpos[:] = 0.0 self.vtens[:] = 0.0 self.epot = self.ff.compute(self.gpos, self.vtens) acc = -self.gpos/self.masses.reshape(-1,1) self.vel += 0.5*(acc+self.acc)*self.timestep self.acc = acc # Allow specialized verlet hooks to modify the state after the step self.call_verlet_hooks('post') # Common post-processing of a single step self.time += self.timestep self.compute_properties() Iterative.propagate(self) # Includes call to conventional hooks
def propagate(self): self.dof.check_convergence() Iterative.propagate(self) return self.dof.converged