Example #1
0
 def sub():
     box = uni.dimensions[0:3]
     v1 = sel2.positions - sel1.positions
     v2 = sel1.positions - sel3.positions
     v1 = vft.pbc_corr(v1.T, box)
     v2 = vft.pbc_corr(v2.T, box)
     return v1, v2
Example #2
0
 def sub():
     box = uni.dimensions[0:3]
     vZ = sel1.positions - sel2.positions
     vXZ = sel3.positions - sel2.positions
     vZ = vft.pbc_corr(vZ.T, box)
     vXZ = vft.pbc_corr(vXZ.T, box)
     return vZ, vXZ
Example #3
0
 def vfun():
     v = list()
     for v1, v2, v3, v4, v5 in zip(sel1, sel2, sel3, sel4, sel5):
         v0 = np.array([
             v2.position - v1.position, v3.position - v1.position,
             v4.position - v1.position, v5.position - v1.position
         ])
         box = uni.dimensions[:3]
         v.append(vft.pbc_corr(v0.T, box))
     return v
Example #4
0
    def sub():
        R = list()
        box = uni.dimensions[:3]
        for s, vr, i in zip(sel, vref, i0):
            v = vft.pbc_corr(
                np.diff(s.positions[i], axis=0).T,
                box)  #Calculate vectors, periodic boundary correction
            R.append(vft.RMSalign(vr, v))  #Get alignment to reference vector

        return vft.R2vec(R)  #This converts R back into two vectors
Example #5
0
 def vfun():
     v = list()
     for CA, H, N, Cm1, Om1, CAm1 in zip(selCA, selH, selN, selCm1,
                                         selOm1, selCAm1):
         v0 = np.array([
             CA.position - N.position, H.position - N.position,
             N.position - Cm1.position, Cm1.position - Om1.position,
             Cm1.position - CAm1.position
         ])
         box = uni.dimensions[:3]
         v.append(vft.pbc_corr(v0.T, box))
     return v
Example #6
0
    def sub():
        "Calculate planes for each element in grid"
        X, Y = grid()
        v = list()
        box = uni.dimensions[:3]
        for x, y in zip(X, Y):
            v0 = vft.pbc_corr(np.transpose(sel.positions - [x, y, 0]), box)
            d2 = v0[0]**2 + v0[1]**2
            i = d2 > 3 * sigma
            weight = np.exp(-d2[i] / (2 * sigma**2))

            v.append(vft.RMSplane(v0[:, i], np.sqrt(weight)))
        v = np.transpose(v)
        return v / np.sign(v[2])
Example #7
0
    def sub():
        vnorm = list()
        box = uni.dimensions[:3]
        for s in sel:
            v0 = vft.pbc_pos(s.positions.T, box)
            vnorm.append(vft.principle_axis_MOI(v0)[:, 0])
        vnorm = np.array(vnorm)

        #Pre-allocate output vector, to point along z
        v1 = np.zeros([3, sel1.n_atoms])
        v1[2] = 1
        v2 = v1.copy()

        v0 = vft.pbc_corr((sel1.positions - sel2.positions).T, box)
        for k, vn in enumerate(vnorm):
            v1[:, k == index] = vft.projXY(v0[:, k == index], vn)
            v2[:, k == index] = np.array([vn]).T.repeat((k == index).sum(),
                                                        axis=1)

        return v1, v2
Example #8
0
    def sub():
        vnorm = MOIsub()
        #Pre-allocate output vector, to point along z
        vZ = np.zeros([3, sel1.n_atoms])
        vZ[2] = 1  #If a bond not in index, then vZ just on Z
        #        vXZ=np.zeros([3,sel1.n_atoms])
        #        vXZ[0]=1    #If a bond not in index, then vXZ just along x

        sc = np.array(vft.getFrame(vnorm)).T
        v00 = vft.norm(vft.pbc_corr((sel1.positions - sel2.positions).T, box))

        for k, (vn, sc0) in enumerate(zip(vnorm.T, sc)):
            v0 = v00[:, k == index]
            cb = v0[0] * vn[0] + v0[1] * vn[1] + v0[2] * vn[
                2]  #Angle between MOI and bond
            cb[cb > 1] = 1.0
            sb = np.sqrt(1 - cb**2)
            v0 = np.concatenate(([sb], [np.zeros(sb.shape)], [cb]), axis=0)
            "Here, we keep the vector fixed in the xz plane of the MOI frame"
            vZ[:, k == index] = vft.R(v0, *sc0)
#            vZ[:,k==index]=v0
#            vXZ[:,k==index]=np.atleast_2d(vn).T.repeat(v0.shape[1],1)

        return vZ
Example #9
0
 def sub():
     box = molecule.mda_object.dimensions[:3]
     v = selC1.positions - selC2.positions
     v = vft.pbc_corr(v.T, box)
     return v
Example #10
0
 def sub():
     box = uni.dimensions[0:3]
     v = sel2.positions - sel1.positions
     v = vft.pbc_corr(v.T, box)
     return v