def qcstep(self): """Propagates the centroid position and momentum and the volume.""" v = self.p / self.m[0] expq, expp = (matrix_exp(v * self.dt), matrix_exp(-v * self.dt)) m = dstrip(self.beads.m) saveq = self.nm.qnm[0].copy() savep = self.nm.pnm[0].copy() for i in range(self.beads.natoms): self.nm.qnm[0, 3 * i:3 * (i + 1)] = np.dot( expq, self.nm.qnm[0, 3 * i:3 * (i + 1)]) self.nm.qnm[0, 3 * i:3 * (i + 1)] += np.dot( np.dot(invert_ut3x3(v), (expq - expp) / (2.0)), dstrip(self.nm.pnm)[0, 3 * i:3 * (i + 1)] / m[i]) self.nm.pnm[0, 3 * i:3 * (i + 1)] = np.dot( expp, self.nm.pnm[0, 3 * i:3 * (i + 1)]) #self.cell.h[:2, :2] = np.dot(expq[:2, :2], self.cell.h[:2, :2]) #self.cell.h[2, :2] = 0. #self.cell.h[:2, 2] = 0. # Only expand and contract cell parallel to x-y axes; do not shear or change z self.cell.h = np.array([[expq[0, 0] * self.cell.h[0, 0], 0., 0.], [0., expq[1, 1] * self.cell.h[1, 1], 0.], [0., 0., self.cell.h[2, 2]]])
def qcstep(self): """Propagates the centroid position and momentum and the volume.""" v = self.p/self.m[0] expq, expp = (matrix_exp(v*self.dt), matrix_exp(-v*self.dt)) m = depstrip(self.beads.m) saveq=self.nm.qnm[0].copy() savep=self.nm.pnm[0].copy() for i in range(self.beads.natoms): self.nm.qnm[0,3*i:3*(i+1)] = np.dot(expq, self.nm.qnm[0,3*i:3*(i+1)]) self.nm.qnm[0,3*i:3*(i+1)] += np.dot(np.dot(invert_ut3x3(v),(expq-expp)/(2.0)),depstrip(self.nm.pnm)[0,3*i:3*(i+1)]/m[i]) self.nm.pnm[0,3*i:3*(i+1)] = np.dot(expp, self.nm.pnm[0,3*i:3*(i+1)]) self.cell.h = np.dot(expq,self.cell.h)
def qcstep(self): """Propagates the centroid position and momentum and the volume.""" v = self.p / self.m[0] halfdt = self.qdt expq, expp = (matrix_exp(v * halfdt), matrix_exp(-v * halfdt)) m = dstrip(self.beads.m) sinh = np.dot(invert_ut3x3(v), (expq - expp) / (2.0)) for i in range(self.beads.natoms): self.nm.qnm[0, 3 * i:3 * (i + 1)] = np.dot(expq, self.nm.qnm[0, 3 * i:3 * (i + 1)]) self.nm.qnm[0, 3 * i:3 * (i + 1)] += np.dot(sinh, dstrip(self.nm.pnm)[0, 3 * i:3 * (i + 1)] / m[i]) self.nm.pnm[0, 3 * i:3 * (i + 1)] = np.dot(expp, self.nm.pnm[0, 3 * i:3 * (i + 1)]) self.cell.h = np.dot(expq, self.cell.h)
def qcstep(self): """Propagates the centroid position and momentum and the volume.""" v = self.p / self.m[0] halfdt = self.qdt expq, expp = (matrix_exp(v * halfdt), matrix_exp(-v * halfdt)) m = dstrip(self.beads.m) sinh = np.dot(invert_ut3x3(v), (expq - expp) / (2.0)) for i in range(self.beads.natoms): self.nm.qnm[0, 3 * i:3 * (i + 1)] = np.dot( expq, self.nm.qnm[0, 3 * i:3 * (i + 1)]) self.nm.qnm[0, 3 * i:3 * (i + 1)] += np.dot( sinh, dstrip(self.nm.pnm)[0, 3 * i:3 * (i + 1)] / m[i]) self.nm.pnm[0, 3 * i:3 * (i + 1)] = np.dot( expp, self.nm.pnm[0, 3 * i:3 * (i + 1)]) self.cell.h = np.dot(expq, self.cell.h)
def qcstep(self): """Propagates the centroid position and momentum and the volume.""" v = self.p / self.m[0] halfdt = self.qdt expq, expp = (matrix_exp(v * halfdt), matrix_exp(-v * halfdt)) sinh = np.dot(invert_ut3x3(v), (expq - expp) / (2.0)) q = dstrip(self.nm.qnm)[0].copy().reshape((self.beads.natoms, 3)) p = dstrip(self.nm.pnm)[0].copy() q = np.dot(q, expq.T) q += np.dot((p / self.beads.m3[0]).reshape((self.beads.natoms, 3)), sinh.T) p = np.dot(p.reshape((self.beads.natoms, 3)), expp.T) self.nm.qnm[0] = q.reshape((self.beads.natoms * 3)) self.nm.pnm[0] = p.reshape((self.beads.natoms * 3)) self.cell.h = np.dot(expq, self.cell.h)