示例#1
0
def calc_q(r_o, r_op, r_h, box):
    """
    Calculates the 3-body term, keeping the pbc in mind
    @param r_o: x,y,z position of one oxygen donor/acceptor
    @param r_op: x,y,z position of the other oxygen donor/acceptor
    @param r_h: x,y,z position of the reactive H
    @param box: the dimensions of the periodic box (assumed 90 degree angles)
    @return: the dot-product of the vector q
    """
    # pbc_vector_avg
    q_vec = np.subtract(pbc_vector_avg(r_o, r_op, box), r_h)
    # would an average be faster?
    # q_vec = np.average(r_o, r_op) - r_h
    return np.dot(q_vec, q_vec)
示例#2
0
def calc_q(r_o, r_op, r_h, box):
    """
    Calculates the 3-body term, keeping the pbc in mind
    Per Wu et al. 2008 (http://pubs.acs.org/doi/abs/10.1021/jp076658h), eq. in text just below eq. 12
    @param r_o: x,y,z position of one oxygen donor/acceptor (water or hydronium)
    @param r_op: x,y,z position of the other oxygen donor/acceptor (glu)
    @param r_h: x,y,z position of the reactive H
    @param box: the dimensions of the periodic box (assumed 90 degree angles)
    @return: the dot-product of the vector q (note: it really is the dot, not norm; it is written as q^2)
    """
    # pbc_vector_avg
    q_vec = np.subtract(pbc_vector_avg(r_o, r_op, box), r_h)
    # would an average be faster?
    # q_vec = np.average(r_o, r_op) - r_h
    return np.dot(q_vec, q_vec)
示例#3
0
 def testAvgInDiffImages(self):
     self.assertTrue(
         np.allclose(pbc_vector_avg(A_VEC, C_VEC, PBC_BOX), GOOD_A_C_AVG))
示例#4
0
 def testAvgInSameImage(self):
     self.assertTrue(
         np.allclose(pbc_vector_avg(A_VEC, B_VEC, PBC_BOX), GOOD_A_B_AVG))
示例#5
0
 def testAvgInDiffImages(self):
     self.assertTrue(np.allclose(pbc_vector_avg(A_VEC, C_VEC, PBC_BOX), GOOD_A_C_AVG))
示例#6
0
 def testAvgInSameImage(self):
     self.assertTrue(np.allclose(pbc_vector_avg(A_VEC, B_VEC, PBC_BOX), GOOD_A_B_AVG))