QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: dmicje12 on December 31, 2024, 13:50

Title: Regarding the problem of converting the structure from atkpython to cif
Post by: dmicje12 on December 31, 2024, 13:50
Hello everyone
Because I need to make some changes to the structure and save it as a new structure, and the new structure must be in the form of a cif file.
So is there any way to convert the structure in atkpython form into cif file form using command line or python syntax?
Thanks!
Title: Re: Regarding the problem of converting the structure from atkpython to cif
Post by: dmicje12 on January 6, 2025, 10:29
I'd like to know the commands for converting 'atkpython' files to CIF or POSCAR. Thank you everyone.
Title: Re: Regarding the problem of converting the structure from atkpython to cif
Post by: Anders Blom on January 8, 2025, 20:42
What you need is either
Code: python
from NL.QuantumATK.ConfigurationConverters.CIFConverters import configurationToCIF
with open("myfile.cif", 'w') as f:
    f.write(configurationToCIF(configuration))
or
Code: python
from AddOns.VASPPlugins.IO import writePOSCAR
writePOSCAR(configuration, "POSCAR")

NOTE: In case someone wants to use this export function for more advanced crystallography purposes, bear in mind that the QuantumATK CIF exporter is rather primitive and can only save structure as P1, so it will not use the correct spacegroup symmetries to reduce the atom list to the irreducible basis.
Title: Re: Regarding the problem of converting the structure from atkpython to cif
Post by: dmicje12 on January 9, 2025, 06:43
Thanks for your reply!
This is exactly what i need!