コード例 #1
0
def read_trajectory( dir = './', xml_file ='vasprun.xml', npz_pbc_file = 'trajectory_pbc.npz', npz_file = 'trajectory_nopbc.npz', POSCAR_file = '' ):
    if os.path.isfile(dir + npz_file):
        traj = Trajectory(filename = dir +npz_file)
    else:
        p = IterativeVasprunParser(dir + xml_file)
        traj = p.get_all_trajectories()
        traj.save(dir + npz_pbc_file)
        if POSCAR_file != '':
            poscar = PoscarParser(dir + POSCAR_file)
            pos = poscar.get_positions( coordinates = 'direct' )
            print "Unwrapping using given initial pos"
            traj.unwrap_pbc( init_pos = pos)
        else:
            traj.unwrap_pbc()
        traj.save(dir + npz_file)
    return traj
コード例 #2
0
def read_trajectory( dir = './', xml_file ='vasprun.xml', npz_pbc_file = 'trajectory_pbc.npz', npz_file = 'trajectory_nopbc.npz', POSCAR_file = '' ):
    if os.path.isfile(dir + npz_file):
        traj = Trajectory(filename = dir +npz_file)
    else:
        p = IterativeVasprunParser(dir + xml_file)
        traj = p.get_all_trajectories()
        traj.save(dir + npz_pbc_file)
        if POSCAR_file != '':
            poscar = PoscarParser(dir + POSCAR_file)
            pos = poscar.get_positions( coordinates = 'direct' )
            print "Unwrapping using given initial pos"
            traj.unwrap_pbc( init_pos = pos)
        else:
            traj.unwrap_pbc()
        traj.save(dir + npz_file)
    return traj