예제 #1
0
def test_fdist():
    
    natoms = 5
    coords_frac = np.random.rand(natoms,3)
    cell = np.random.rand(3,3)*3
    struct = crys.Structure(coords_frac=coords_frac,
                            cell=cell)
    
    for pbc in [0,1]:
        print("pbc:", pbc)
        pyret = pydist(coords_frac, cell, pbc)
        # uses _flib.distsq_frac()
        pyret2 = crys.distances(struct, pbc=pbc, squared=True, fullout=True)
        for ii in [0,1,2]:
            print(ii)
            assert np.allclose(pyret[ii], pyret2[ii])
예제 #2
0
def test_fdist():
    
    natoms = 5
    coords_frac = np.random.rand(natoms,3)
    cell = np.random.rand(3,3)*3
    struct = crys.Structure(coords_frac=coords_frac,
                            cell=cell)
    
    for pbc in [0,1]:
        print "pbc:", pbc
        pyret = pydist(coords_frac, cell, pbc)
        # uses _flib.distsq_frac()
        pyret2 = crys.distances(struct, pbc=pbc, squared=True, fullout=True)
        for ii in [0,1,2]:
            print ii
            assert np.allclose(pyret[ii], pyret2[ii])
예제 #3
0
def pydist_loop(traj, pbc=True):
    dists = np.empty((nstep, natoms, natoms))
    for ii,struct in enumerate(traj):
        dists[ii,...] = crys.distances(struct, pbc=pbc)
    return dists
예제 #4
0
def pydist_loop(traj, pbc=True):
    dists = np.empty((nstep, natoms, natoms))
    for ii, struct in enumerate(traj):
        dists[ii, ...] = crys.distances(struct, pbc=pbc)
    return dists