5
$\begingroup$

I have tried a bunch of apps such as Mercury, OpenLabel but they cannot convert CIF files to XYZ files in bulk. I am also thinking of doing it in Python but just want to know if there's an app for this. Thank you.

$\endgroup$
3
  • 3
    $\begingroup$ I have not worked with his program but may be Babel (openbabel.org) is fit for this porpouse. $\endgroup$
    – PAEP
    Apr 26, 2023 at 20:11
  • 1
    $\begingroup$ While I personally would use OpenBabel obabel *.cif -O .xyz -m you could also do this with pymatgen or ASE $\endgroup$ May 3, 2023 at 2:42
  • $\begingroup$ If my answer solved your question, could you please click on the tick mark next to it and mark it as the accepted answer. $\endgroup$ May 18, 2023 at 18:30

1 Answer 1

2
$\begingroup$

ASE

You can use the ase python library to achieve this.

I tested the following code with 3 CIF files obtained from the Crystallographic Open Data: 1569089, 1000017, 1000003 and it produces their respective XYZ files.

Code

from ase.io import read, write

# Define the list of CIF files to convert
cif_files = ['1569089.cif', '1000017.cif', '1000003.cif']

for cif_file in cif_files:
    # Read the CIF file using ASE
    atoms = read(cif_file)

    # Define the output XYZ file name
    xyz_file = cif_file.replace('.cif', '.xyz')

    # Write the atoms to the output XYZ file using ASE
    write(xyz_file, atoms, format='xyz')
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .