Example #1
0
def voronoi(ia,aSys):


#=======================================================================
if __name__ == '__main__':

    usage= '$ python %prog [options] POSCAR'

    parser= optparse.OptionParser(usage=usage)
    parser.add_option("-r",dest="rcut",type="float", \
                      default=5.0, \
                      help="Cutoff radius in Angstrom. Default is 5.0.")
    (options,args)= parser.parse_args()

    rcut= options.rcut
    infname= args[0]
    
    aSys= AtomSystem()
    if not os.path.exists(infname):
        print('[Error] File does not exist !!!')
        print(infname)
        exit()
    aSys.read_POSCAR(infname)

    #.....make neighbor list
    aSys.make_pair_list(rcut)

    #.....make Voronoi polygons from Delauney tetrahedra
    vrns= []
    for ia in range(aSys.num_atoms):
        vrn.append(voronoi(ia,aSys))
Example #2
0
Expand atomic system from a POSCAR file by copying the system
along a1,a2,a3 direction (n1,n2,n3).


USAGE:
    $ python ./expand-POSCAR.py [options] POSCAR n1 n2 n3

INPUT: (these files must be in the working directory)
    - POSCAR (for the cell information)
"""

import os
import optparse
from atom_system import AtomSystem

aSys= AtomSystem()

#================================================== main routine
if __name__ == '__main__':
    usage= '$ python %prog [options] ./POSCAR n1 n2 n3'

    parser= optparse.OptionParser(usage=usage)
    parser.add_option("-o",dest="outfname",type="string", \
                      default="POSCAR.expand", \
                      help="output file name. Default is POSCAR.expand.")
    (options,args)= parser.parse_args()

    outfname= options.outfname

    #...read POSCAR as 0th step
    if not len(args)==4:
Example #3
0
sequential files specified by the user.
This script can be only applicable to VASP 5.3, but not to 4.6,
because of the XDATCAR file-format.

USAGE:
    $ python ./POSCAR2.py [options] POSCAR

INPUT: (these files must be in the working directory)
    - POSCAR (for the cell information)
"""

import os
import optparse
from atom_system import AtomSystem

aSys= AtomSystem()

def change_species(sid1,sid2,sid3):
    global aSys
    for ia in range(aSys.num_atoms()):
        if aSys.atoms[ia].sid == 1:
            aSys.atoms[ia].set_sid(sid1)
        elif aSys.atoms[ia].sid == 2:
            aSys.atoms[ia].set_sid(sid2)
        elif aSys.atoms[ia].sid == 3:
            aSys.atoms[ia].set_sid(sid3)

#================================================== main routine
if __name__ == '__main__':
    usage= 'python %prog [options] ./POSCAR'
Example #4
0
    if 'NBLOCK' in incar:
        nblock=int(incar['NBLOCK'])
    else:
        nblock= 1
    nstep= nstep/nblock
    dt= float(incar['POTIM'])*nblock # dt in ft
    
    print "out_format =",out_format
    print "nstep      =",nstep
    print "dt         =",dt

    #...read POSCAR as 0th step
    if not os.path.exists('./POSCAR'):
        print ' ERROR: POSCAR does not exist here.'
        exit()
    aSys= AtomSystem()
    aSys.read_POSCAR('./POSCAR')

    #...output 0th step
    output_AtomSystem(aSys,out_format,0)

    #...read XDATCAR after 0th step
    if not os.path.exists('./XDATCAR'):
        print ' ERROR: XDATCAR does not exist here.'
        exit()
    f= open('XDATCAR','r')
    line1= f.readline()
    alc= float(f.readline().split()[0])
    a1= [ float(x) for x in f.readline().split()]
    a2= [ float(x) for x in f.readline().split()]
    a3= [ float(x) for x in f.readline().split()]