Exemplo n.º 1
0
 def read_trajectory(self, traj_dir = './', xml_file ='vasprun.xml', npz_pbc_file = 'trajectory_pbc.npz', npz_file = 'trajectory_nopbc.npz' ):
     if os.path.isfile(traj_dir + npz_pbc_file):
         traj = Trajectory(filename = traj_dir +npz_pbc_file)
     else:
         p = IterativeVasprunParser(traj_dir + xml_file)
         traj = p.get_all_trajectories()
         traj.save(traj_dir + npz_pbc_file)
         # we do NOT unwrap the PBCs
     return traj
Exemplo n.º 2
0
 def read_trajectory(self,
                     traj_dir='./',
                     xml_file='vasprun.xml',
                     npz_pbc_file='trajectory_pbc.npz',
                     npz_file='trajectory_nopbc.npz'):
     if os.path.isfile(traj_dir + npz_pbc_file):
         traj = Trajectory(filename=traj_dir + npz_pbc_file)
     else:
         p = IterativeVasprunParser(traj_dir + xml_file)
         traj = p.get_all_trajectories()
         traj.save(traj_dir + npz_pbc_file)
         # we do NOT unwrap the PBCs
     return traj
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
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
Exemplo n.º 5
0
def norm(v):
    return np.sqrt(np.dot(v, v))


#############################################################################
# (1) Extract data

wdir = './'

basename = os.path.splitext(os.path.basename(sys.argv[0]))[0]
fig_filename = wdir + basename + '.pdf'
xml = wdir + 'vasprun.xml'
npz = wdir + 'trajectory_pbc.npz'

if os.path.isfile(npz):
    traj = Trajectory(filename=npz)
else:
    p = IterativeVasprunParser(xml)
    traj = p.get_all_trajectories()
    traj.save(npz)

fac = 8 * 2 * np.pi
nsteps = traj.length
natoms = traj.num_atoms

lambda_x = np.zeros((nsteps))
lambda_y = np.zeros((nsteps))
lambda_z = np.zeros((nsteps))

### <!-- Test begin -->
from oppvasp.vasp.parsers import PoscarParser
Exemplo n.º 6
0
import numpy as np
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed, \
             RotatingMarker, ReverseBar, SimpleProgress

from oppvasp.vasp.parsers import IterativeVasprunParser, PoscarParser
from oppvasp.md import Trajectory

xml_filename = 'vasprun.xml'
npz_filename = 'trajectory.npz'
vtf_filename = 'trajectory.vtf'

if len(sys.argv) > 1:
    npz_filename = sys.argv[1]

if os.path.isfile(npz_filename):
    traj = Trajectory(filename = npz_filename)
else:
    p = IterativeVasprunParser(xml_filename)
    traj = p.get_all_trajectories()
    traj.save(npz_filename)

basis = traj.basis
atoms = traj.atoms
nsteps = traj.length # NSW
nions = traj.num_atoms
positions = traj.positions
forces = traj.forces
total_energy = traj.total_energy

f = open(vtf_filename,'w')
Exemplo n.º 7
0
def norm(v):
    return np.sqrt(np.dot(v,v))


#############################################################################
# (1) Extract data

wdir = './'

basename = os.path.splitext(os.path.basename(sys.argv[0]))[0]
fig_filename = wdir + basename + '.pdf'
xml = wdir + 'vasprun.xml'
npz = wdir + 'trajectory_pbc.npz'

if os.path.isfile(npz):
    traj = Trajectory(filename = npz)
else:
    p = IterativeVasprunParser(xml)
    traj = p.get_all_trajectories()
    traj.save(npz)

fac = 8 * 2 * np.pi
nsteps = traj.length
natoms = traj.num_atoms


lambda_x = np.zeros((nsteps))
lambda_y = np.zeros((nsteps))
lambda_z = np.zeros((nsteps))