<div dir="ltr"><div class="prettyprint" style="border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class="prettyprint"><div class="subprettyprint"><span class="styled-by-prettify" style="color: #606;"><font color="#004000" face="Arial" style="background-color: transparent;">#!/path/to/python<br><br></font></span></div><div class="subprettyprint"><span class="styled-by-prettify" style="color: #606;"><font color="#004000" face="Arial" style="background-color: transparent;">import ase, sys<br>from ase import Atom, Atoms<br>import ase.io<br></font></span></div><div class="subprettyprint"><span class="styled-by-prettify" style="color: #606;"><font color="#004000" face="Arial" style="background-color: transparent;"><br># read xyz<br>slab = ase.io.read(sys.argv[1], format='xyz');<br><br># 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<br>#_cell_length_a                         11.47850<br>#_cell_length_b                         11.65350<br>#_cell_length_c                         24.67610<br>slab.set_cell([11.47850, 11.65350, 24.67610])<br><br># output to the file type of choice; by default cif is in fractional coordinates, VASP/CONTCAR/POSCAR needs 'direct=True' to do the same<br>vasp = ase.io.write(sys.argv[2], slab, format='cif');<br></font></span><span class="styled-by-prettify" style="color: #660;"></span></div></code></div><div><br></div><div>To compliment James' post on ASE. You just run something like this.</div><div><br></div><div><div class="prettyprint" style="border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class="prettyprint"><div class="subprettyprint"><span class="styled-by-prettify" style="color: #606;"><font color="#222222">(in shell) python xyz2cif.py foo.xyz foo.cif</font></span></div></code></div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br><br></div><div><br><br>On Thursday, July 19, 2018 at 11:47:03 AM UTC-4, James Dean wrote:</div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><div>Hello Henrique,</div><div><br></div><div>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.<br></div><div><br></div><div>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.</div><div><br></div><div>Best,</div><div>James Dean<br></div><div><br></div>On Wednesday, July 18, 2018 at 7:21:11 AM UTC-4, Henrique Junior wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p class="MsoNormal">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.</p>

<p class="MsoNormal">What is the best way to get my optimized call and structure
so I can work on them?</p>

<p class="MsoNormal">Thanks in advance.</p></div></blockquote></div></blockquote></div>