Posutil d2c

From Wiki
Jump to navigation Jump to search

go back to Main Page, Group Pages, Núria López and Group, Scripts_for_VASP

Converts a POSCAR from direct to cartesian coordinates, format: VASP 5.x.

Instructions[edit]

  • Install the vasputil package [1]
  • Create ~/bin/posutil_d2c:
#!/bin/bash
# Rodrigo García Muelas
# July 6th, 2016
# 
# Convert a POSCAR 5.x from direct to cartesians
#
# INPUT: 
# $1   : Input  file
# $2   : Output file (optional, default $1.cart)

# Remove any .cart file, just in case
rm -f $1.cart

# Take the species from line 6 into line 1
specs=`head -n 6 $1 | tail -n 1`
sed -i "1s/.*/ $specs /" $1 

# Convert to cartesians uisg vasputil
~/bin/vasputil_direct2cartesian $1 

# Convert from VASP 4x to 5x by adding species into line 6 
sed -i  "6i\
    $specs \
" $1.cart  

# If an output file is specified, mv .cart to $2
if [ -n "$2" ] ; then 
   mv -f $1.cart $2
fi
  • Make it executable
chmod +x posutil_d2c 
  • You can use it in two different forms; the first one is specifying the output (in this case, output.vasp). Useful for doing scripts when you need to apply several transformations to a file:
./posutil_d2c POSCAR output.vasp
# the input is POSCAR 
# the output is output.vasp 
  • If you do not specify the output, the default is <<input>>.cart
./posutil_d2c POSCAR 
# the output will be POSCAR.cart
./posutil_d2c CONTCAR 
# the output will be CONTCAR.cart