Ejemplo n.º 1
0
if len(arguments) != 2:
  parser.print_usage()

if options.num_steps is None:
  options.num_steps = 5
  
if options.begin is None:
  options.begin = 0
  
if options.end is None:
  options.end = options.num_steps
    
if options.output is None:
  options.output = 'POSCAR%02d'
  
poscar1=atomic_set()
poscar1.load_from_poscar(arguments[0])

poscar2=atomic_set()
poscar2.load_from_poscar(arguments[1])
  
poscar_int = copy.deepcopy(poscar1)

poscar2.align_to(poscar1)
for i in range(options.begin,options.end+1):
  t = float(i)/options.num_steps
  poscar_int.unit_cell = (1-t)*poscar1.unit_cell + t*poscar2.unit_cell
  poscar_int.atoms = (1-t)*poscar1.atoms + t*poscar2.atoms
  if options.arc:
    poscar_int.save_to_arc(options.output, header=True if i==options.begin else False, comment='Interpolation pos %i'%i)
  else:
Ejemplo n.º 2
0
# This utility reads POSCAR or CONTCAR and generates a .res file
# readable by Materials Studio
# Usage: python vasp2res.py <vasp structure file> <name of .res file> <element list>
# Jorge Iniguez, February 2007
#

import sys
import os
import re
from atomic_set import atomic_set


## Main program

# Read POSCAR
poscar = atomic_set()
poscar.load_from_poscar(sys.argv[1])

print poscar.cell_a, poscar.cell_b, poscar.cell_c, poscar.cell_alpha, poscar.cell_beta, poscar.cell_gamma

if poscar.species is None:
  # Read elements from command line...
  if len(sys.argv)>3:
    elements = sys.argv[3].split()
  # ...or read them from POTCAR in working directory
  elif os.access('POTCAR', os.R_OK):
    elements = []
    with open("POTCAR","r") as pc:
      for line in pc:
        if line.startswith("   VRHFIN"):
          elements.append(re.search('=(.+):',line).group(1))