The scripts in this repo will take coordinates in POSCAR format (repeating units of a crystal lattice) and convert them to XYZ format (cartesian coordinates), which is more commonly used in input to ab initio chemistry software. If you are looking for a straightforward and automated way to convert these coordinates, this repo will solve your problem.
- written in Julia and csh; uses no other libraries.
Clone this repo using the green 'Clone or download' button at the top.
Use the scripts in this order:
- listgen.csh
-
- julia DirectToXYZ.jl
Usage for listgen.csh:
Then, (from the command line) $ listgen.csh
When run with no arguments, this script will echo the folloing instruction to the terminal explaining how it should be used: $ a-listgen file Atom_1_Name Atom_2_Name Atom_3_Name Atom_4_Name' ...where file is a POSCAR formatted file from VASP' ...Two atom names are required. The 3rd and 4th are optional.' ...this script chops up a POSCAR file into a format' ...that is convenient for DirectToXYZ.jl.' ...DirectToXYZ.jl will convert the fractional or direct coordinates' ...into standard cartesian format and save them to an .xyz file.' ...the usual workflow is to run this script followed by DirectToXYZ.jl'
Example: $ listgen.csh POSCAR C H O
The output will be the following files: atomlist, direct-list, lattice-vectors
Next step: julia DirectToXYZ.jl
INPUT: files: lattice-vectors, direct-list, atomlist & it will ask you for the value of Factor Temporary files: lattice-vectors contains lattice vectors, a 3x3 list of their xyz components direct-list is a nx3 list of direct coordinates Factor = the scaling factor for the fractional coordinates OUTPUT: file coords.txt containing standard cartesian coordinates type info: All numbers are Float64.
This script will ask you for the scaling factor. It will warn you that it's expecting a Float64 as an answer. I've limited the types of the numbers used in this script to Float64. This avoids possible type instability and increases efficiency.
This script will then ask you for a comment, < 80 characters. This will become the comment line of the output file, which will be called coords.xyz
Output: coords.xyz, containing cartesian coordinates in XYZ format.
This script will also clean up all temporary files generated by itself and by listgen.csh before it exists.
@fitz1987
This project is licensed under the MIT License - see the LICENSE.md file for details.
Thank you to the folks at discourse.julialang.org for some helpful discussion