<< script to convert XYZ file to POSCARS (as used by USPEX) >>

1,450 views
Skip to first unread message

Camps

unread,
Nov 13, 2013, 1:05:36 PM11/13/13
to us...@googlegroups.com
Hello USPEXsers,

I have a lot (thousands) of structures in XYZ format.

I need to calculate the quase-entropy of all these structures. To do so, I need to convert all the XYZ files to the POSCARS format used by USPEX.

Does any one knows an script (aka xyz2vasp) that can accomplish that type of conversion?

Best regards,

Camps

huy pham

unread,
Nov 13, 2013, 1:11:50 PM11/13/13
to I. Camps, uspex
Dear Camps.

XYZ format doesn't has the information about the cell,
So I think you have to have this information, don't you?

If you have, you can write a small code to convert. I think it is not a big deal

Bests,
Huy


--
You received this message because you are subscribed to the Google Groups "USPEX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uspex+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Pham Cong Huy
PhD student, Condensed Matter Section
SISSA International School for Advanced Studies
Via Bonomea 265, I- 34136, Trieste, Italy
E-mail:
pchu...@gmail.com
cp...@sissa.it

I. Camps

unread,
Nov 13, 2013, 1:16:13 PM11/13/13
to huy pham, uspex
Dear Huy,

I have the cell info.

To be honest, my files correspond to single molecules that I artificially put in a cell/box (all the molecules will have the same "cell parameters"), and then, I need to calculate the quase-entropy to get an idea of the molecule order/disorder.


[]'s,

@mps

bkappes

unread,
Nov 13, 2013, 1:35:11 PM11/13/13
to us...@googlegroups.com, huy pham
Camps,

If you have python and the atomistic simulation environment (ASE, https://wiki.fysik.dtu.dk/ase/), then something like this should work (warning, it is untested)

Usage: xyz2vasp.py Lx Ly Lz file1.xyz [file2.xyz [...]]
=========
xyz2vasp.py
------------------
import sys
import numpy as np
from os.path import stripext
from ase.io import read, write

if len(sys.argv) < 5:
    print "Usage: xyz2vasp.py Lx Ly Lz file1.xyz [file2.xyz [...]]"

try:
    periodicLengths = [float(x) for x in sys.argv[1:4]]
    pv = np.diag(periodicLengths)
except ValueError:
    print "Usage: xyz2vasp.py Lx Ly Lz file1.xyz [file2.xyz [...]]"

for input in sys.argv[4:]:
    output = stripext(input)[0] + '.vasp'
    mol = read(input, format='xyz')
    mol.set_pbc(True)
    mol.set_cell(pv)
    write(output, mol, format='vasp')

------------------------

This will at least give you a place to start.

Cheers,

-Branden

Prof. Dr. I. Camps

unread,
Nov 13, 2013, 1:36:22 PM11/13/13
to Branden Kappes, uspex, huy pham
Thank you very much!


[]'s,

---
Prof. Dr. Ihosvany Camps
Instituto de Ciências Exatas. Sala Q203-J
Universidade Federal de Alfenas. Unifal-MG
Rua Gabriel Monteiro da Silva, 700 Centro.  37130-000. Alfenas. MG. Brasil
Tel.  +55 (35) 3299-1260            Agenda: http://goo.gl/B9GoS9
Fax. +55 (35) 3299-1063           Skype: icamps              Twitter: @_icamps

Reply all
Reply to author
Forward
0 new messages