Exemple #1
0
    def createNEB(self, coords1, coords2):
        from pygmin.utils import rotations as rot
        pot = gminpot.GMINPotential(GMIN)
        neb = NEB.NEB(coords1, coords2, pot, k = 100. ,nimages=20)
        # replace rotational interpolation by slerp
        c1 = CoordsAdapter(nrigid=2, nlattice=6, coords=neb.coords[0, :])
        c2 = CoordsAdapter(nrigid=2, nlattice=6, coords=neb.coords[-1, :])

        for i in xrange(1, neb.nimages):
            ci = CoordsAdapter(nrigid=2, nlattice=6, coords=neb.coords[i, :])
            t = float(i) / float(neb.nimages)
            for j in xrange(2):
                ci.rotRigid[j] =  rot.q2aa(rot.q_slerp(
                                       rot.aa2q(c1.rotRigid[j]),
                                       rot.aa2q(c2.rotRigid[j]), t))
        return neb
Exemple #2
0
def interpolate_angleaxis(initial, final, t):
    ''' interpolate between 2 arrays of angle axis coordinates
    
    Parameters
    ----------    
    initial: np.array
        configuration 1
    final: np.array
        configuration 2
    t: float
        interpolation parameter with t in [0,1]    
    
    '''    
    conf = initial.copy()
    for i in xrange(conf.shape[0]):
        conf[i] = rotations.q2aa(rotations.q_slerp(rotations.aa2q(initial[i]),
                                rotations.aa2q(final[i]), t))
    return conf
Exemple #3
0
def interpolate_angleaxis(initial, final, t):
    ''' interpolate between 2 arrays of angle axis coordinates
    
    Parameters
    ----------    
    initial: np.array
        configuration 1
    final: np.array
        configuration 2
    t: float
        interpolation parameter with t in [0,1]    
    
    '''    
    conf = initial.copy()
    for i in xrange(conf.shape[0]):
        conf[i] = rotations.q2aa(rotations.q_slerp(rotations.aa2q(initial[i]),
                                rotations.aa2q(final[i]), t))
    return conf