materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.52k stars 868 forks source link

CIF to POSCAR #693

Closed Huta2018 closed 7 years ago

Huta2018 commented 7 years ago

Hi,

I am able to download CIF files from material project and convert them to POSCAR. When I drag them to VESTA, original CIF file shows the structure but I cannot see the structure by using transformed POSCAR. I have attached both files. NO2.zip The following is the script I used.

import json import re from fnmatch import fnmatch from pymatgen.io.cif import CifParser, CifWriter output = open("POSCAR", "w")

def read_structure(filename, primitive = True, sort = False): fname = os.path.basename(filename) if fnmatch(fname.lower(), ".cif"): parser = CifParser(filename) s = parser.get_structures(primitive=primitive)[0] print s output.write(str(s))

st = read_structure('N2O3.cif')

Thank you in advance.

<When reporting bugs/issues, please supply the following information. If this is a feature request, please simply state the requested feature.>

System

Summary

Example code

<Example code generating error>

Error message

<Error message>

Suggested solution (if any)

Files (if any)

<If input files are needed to reproduce the error, please provide either links (e.g., Dropbox or GDrive) for large files or simply paste the file below for small files.>

<contents of file 1>
shyuep commented 7 years ago

Both the POSCAR and CIF open just fine on my VESTA.

Huta2018 commented 7 years ago

Thank you so much. I will check it again. On Sun, Jun 11, 2017 at 3:24 PM Shyue Ping Ong notifications@github.com wrote:

Closed #693 https://github.com/materialsproject/pymatgen/issues/693.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/materialsproject/pymatgen/issues/693#event-1118620133, or mute the thread https://github.com/notifications/unsubscribe-auth/ATsfHJ4LC4JfhgviSycnLVwL9jhu3wvtks5sDD7rgaJpZM4N2dsm .