Better ways to get back my optimized cell and structure

Travis polla... at gmail.com
Thu Jul 19 16:11:16 UTC 2018


#!/path/to/python

import ase, sys
from ase import Atom, Atoms
import ase.io

# read xyz
slab = ase.io.read(sys.argv[1], format='xyz');

# Read this info from a log file or restart, or define it manually as I 
have below; you can do cell shape as well, but here it is alpha=beta=gamma= 
90 deg
#_cell_length_a                         11.47850
#_cell_length_b                         11.65350
#_cell_length_c                         24.67610
slab.set_cell([11.47850, 11.65350, 24.67610])

# output to the file type of choice; by default cif is in fractional 
coordinates, VASP/CONTCAR/POSCAR needs 'direct=True' to do the same
vasp = ase.io.write(sys.argv[2], slab, format='cif');

To compliment James' post on ASE. You just run something like this.

(in shell) python xyz2cif.py foo.xyz foo.cif




On Thursday, July 19, 2018 at 11:47:03 AM UTC-4, James Dean wrote:

> Hello Henrique,
>
> The way I've usually done this is by using OpenBabel to convert from XYZ 
> to a VASP file, and then filling in the cell parameters in the VASP file 
> via a script that reads the cp2k output to find the current cell 
> parameters. Just make sure you save it as a ".vasp" file or VESTA won't 
> know what to do with it.
>
> As an alternative, if you're comfortable using Python, the Atomic 
> Simulation Environment (ASE) is another way you'd be able to accomplish 
> this, as it has tools for file I/O with both xyz and VASP formats.
>
> Best,
> James Dean
>
> On Wednesday, July 18, 2018 at 7:21:11 AM UTC-4, Henrique Junior wrote:
>>
>> This is probably a silly question. I’m running a CELL_OPT and at the end 
>> of my calculation I’m trying to open the resulting .xyz in VESTA and 
>> manually entering the cell parameters but doing this is generating a messy 
>> result.
>>
>> What is the best way to get my optimized call and structure so I can work 
>> on them?
>>
>> Thanks in advance.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20180719/0f1f638c/attachment.htm>


More information about the CP2K-user mailing list