Generate figures: Difference between revisions

From Wiki
Jump to navigation Jump to search
Rgarcia (talk | contribs)
mNo edit summary
Rgarcia (talk | contribs)
mNo edit summary
Line 7: Line 7:
===1. Convert POSCAR/CONTCAR to *.xsf===
===1. Convert POSCAR/CONTCAR to *.xsf===


In order to use this tool, you will need the program v2kxsf. Find attached here [[Image:Xcrysden.tgz]] or here [[https://nano.tu-dresden.de/~jkunstmann/software.html]]
In order to use this tool, you will need the program v2kxsf. Find attached here [[Image:Xcrysden.tgz]] or here [[https://nano.tu-dresden.de/~jkunstmann/software.html]]. First, put all your CONTCAR/POSCAR in the same folder with the extension *.vasp. Then execute this command in a terminal:


for j in `ls *.vasp` ; do ./v2xsf $j ; done
===2. Script preparation===
XCrysDen can work with a *.tcl script as input file. This utility will build that script for you:
#!/bin/bash
  # # # # # # # # # # # # # # # # # # # # # # # # #
  # # # # # # # # # # # # # # # # # # # # # # # # #
  # Created by David Karhanek                    #
  # Created by Rodrigo García-Muelas            #
  # Updated by Rodrigo García-Muelas              #  
  # Adapted to work on VASP 5.x              #
  # First review:  July 10, 2012.                 #
  # First review:  July 10, 2012.         #
  # Second review: April 30, 2013.               #
  # Second review: April 30, 2013.           #
# Inspired by the work of David Karhanek      #
  # # # # # # # # # # # # # # # # # # # # # # # # #  
  # # # # # # # # # # # # # # # # # # # # # # # # #  
   
  #
  # Notes:
  # Notes:
  # 1. The input files should be *.vasp
  # 1. The input files should be *.vasp
  # 2. Adapted to work on VASP 5.x by Rodrigo García-Muelas
  # 2. Requires v2xsf conversor <--- Available on VASP webpage.
# 3. Requires v2xsf conversor <--- Available on VASP webpage.
   
   
  # Batch conversion .vasp (POSCAR/CONTCAR) to .xsf (XCRYSDEN)
  # remove old tcl scripts
if [ -e epsprinting.tcl ] ; then rm epsprinting.tcl ; fi
   
   
echo "Converting POSCARs to XSF files..."
for j in `ls *.vasp` ; do ./v2xsf $j ; done
===2. TCL script preparation===
XCrysDen can work with a script as input file. You need to build that file automatically with:
# Preparation of XCrysDen script and removing old.
  echo "Preparing TCL script for EPS export..."
  echo "Preparing TCL script for EPS export..."
  if [ -e epsprinting.tcl ] ; then rm epsprinting.tcl ; fi
   
  for i in `ls *.xsf.gz`
  for i in `ls *.xsf.gz`
  do                              # resize 640 480
  do                              # resize 640 480

Revision as of 16:56, 30 April 2013

go back to Main Page, Computational Resources, Scripts or VASP, Scripts for VASP

To map several molecules at once, put together the CONTCAR files (CONT*). Then use the attached scrip with xcrysden.

The script has three parts.

1. Convert POSCAR/CONTCAR to *.xsf

In order to use this tool, you will need the program v2kxsf. Find attached here File:Xcrysden.tgz or here [[1]]. First, put all your CONTCAR/POSCAR in the same folder with the extension *.vasp. Then execute this command in a terminal:

for j in `ls *.vasp` ; do ./v2xsf $j ; done

2. Script preparation

XCrysDen can work with a *.tcl script as input file. This utility will build that script for you:

#!/bin/bash

# # # # # # # # # # # # # # # # # # # # # # # # #
# Created by Rodrigo García-Muelas            #
# Adapted to work on VASP 5.x               #
# First review:  July 10, 2012.          #
# Second review: April 30, 2013.            #
# Inspired by the work of David Karhanek      #
# # # # # # # # # # # # # # # # # # # # # # # # # 
#
# Notes:
# 1. The input files should be *.vasp
# 2. Requires v2xsf conversor <--- Available on VASP webpage.

# remove old tcl scripts
if [ -e epsprinting.tcl ] ; then rm epsprinting.tcl ; fi

echo "Preparing TCL script for EPS export..."

for i in `ls *.xsf.gz`
do                              # resize 640 480
 cat >>epsprinting.tcl<<!
scripting::open --xsf $i
scripting::displayWindow resize 800 1000
xc_newvalue .mesa 8  0 1.000000 1.000000 1.000000
xc_newvalue .mesa 8  1 1.000000 1.000000 1.000000
xc_newvalue .mesa 8  6 0.250000 0.250000 0.250000
xc_newvalue .mesa 8  8 1.000000 0.000000 0.000000
xc_newvalue .mesa 8 78 0.800000 1.000000 0.800000
xc_newvalue .mesa 4  1 0.90000
xc_newvalue .mesa 4  6 2.05000
xc_newvalue .mesa 4  8 1.80000
xc_newvalue .mesa 4 78 3.55000
scripting::displayMode3D BallStick
set myParam(COV_SCALE)        1.25
set myParam(FRAMECOL)         {0.00 0.00 0.00} 
set myParam(BACKGROUND)       {1.00 1.00 1.00}
scripting::load_myParam
scripting::display on crystal-cells 
scripting::displayMode3D BallStick
scripting::display as cell-unit asymm
scripting::buildCrystal 1 1 1
xc_translparam set 0 0 1 
scripting::rotate x 90
scripting::zoom 2
scripting::printToFile ${i%\.vasp.xsf.gz}.png

!
done

echo "Now run XCrySDen in script mode: xcrysden -s epsprinting.tcl"

Explanation:

You can set the size of the window with the command below. Notice that a bigger window size imply a larger and heavier image.

scripting::displayWindow resize 800 1000

You can change the colors of your atoms. The example shows H, C, O and Pt (Z=1,6,8,78) and colors white (1.00 1.00 1.00 RGB), gray, red and light green:

xc_newvalue .mesa 8  1 1.000000 1.000000 1.000000
xc_newvalue .mesa 8  6 0.250000 0.250000 0.250000
xc_newvalue .mesa 8  8 1.000000 0.000000 0.000000
xc_newvalue .mesa 8 78 0.800000 1.000000 0.800000

To change the size of the ball for each element, you have this part:

xc_newvalue .mesa 4  1 0.90000
xc_newvalue .mesa 4  6 2.05000
xc_newvalue .mesa 4  8 1.80000
xc_newvalue .mesa 4 78 3.55000

To colour the borders of the supercell in black:

set myParam(FRAMECOL)         {0.00 0.00 0.00}

Set the background color as white to be printer-friendly.

set myParam(BACKGROUND)       {1.00 1.00 1.00}

Build a 1×1×1 supercell

scripting::buildCrystal 1 1 1 


Play with these parameters in order to focus your cell at your wish:

scripting::rotate x 90
scripting::zoom 2

Do NOT put comments in the epsprinting.tcl file.

3. Printing and post-processing

Run XCrysDen in scripting mode by typing:

./xcrysden -s epsprinting.tcl

Tip: If you want to convert the background of an image from white to transparent, write:

convert -transparent white <input_file> <output_file>

For aditional commands, see [[2]]

--Rgarcia 19:23, 12 December 2012 (CET)