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.51k stars 862 forks source link

Issue with Outputting Symmetrized CIFs #1078

Closed GerardMattei closed 6 years ago

GerardMattei commented 6 years ago

System

Summary

Hello, I'm currently searching through the Materials Project's auxetic materials and I'm having difficulty ensuring that pymatgen generates cif files with the correct structures/properties. I have an example below using lithium metal. mp-567337 is the lithium polymorph I'm interested in with a Poisson's ratio of 0.

I'm using the MPRester method to load mp-567337 as a pymatgen structure object from its material ID which appears to produce the correct space group, sites, etc. However when I output the structure object with CifWriter and symprec, the output is of the corresponding Li subcell, mp-135, which exhibits a positive Poisson's ratio of 0.36. Is there a way to ensure that pymatgen outputs a Cif file using the exact structure object I'm observing in my code?

Example code

import json from pymatgen.matproj.rest import MPRester from pymatgen.io.cif import CifWriter

with MPRester(matproj_key) as m: mat_id = 'mp-567337' material = m.get_structure_by_material_id(mat_id) print(mat_id, material.composition, material.get_space_group_info(), material.sites)

This outputs the correct material ID and spacegroup of mp-567337 lithium with a negative poisson's ratio.

CifWriter(struct=material, symprec=True).write_file('Li_Test.cif')

This instead appears to output the subcell of the desired structure, mp-135 lithium with a positive poisson's ratio.

Thank you, -Gerry

montoyjh commented 6 years ago

Hi Gerry, try

CifWriter(struct=material, symprec=1e-5).write_file('Li_Test.cif')

Also, just FYI, be a bit careful when interpreting the elastic constants of materials with non-empty "warnings" fields. The elastic analysis of this particularly material strongly suggests it is mechanically unstable, which may mean that its suggested predicted auxetic behavior is the consequence of a bad linear fit.

Best, Joey

On Fri, Mar 23, 2018 at 11:45 AM, GerardMattei notifications@github.com wrote:

System

  • Pymatgen version: 2017.8.21
  • Python version: 3.6

Summary

Hello, I'm currently searching through the Materials Project's auxetic materials and I'm having difficulty ensuring that pymatgen generates cif files with the correct structures/properties. I have an example below using lithium metal. mp-567337 is the lithium polymorph I'm interested in with a Poisson's ratio of 0.

I'm using the MPRester method to load mp-567337 as a pymatgen structure object from its material ID which appears to produce the correct space group, sites, etc. However when I output the structure object with CifWriter and symprec, the output is of the corresponding Li subcell, mp-135, which exhibits a positive Poisson's ratio of 0.36. Is there a way to ensure that pymatgen outputs a Cif file using the exact structure object I'm observing in my code? Example code

import json from pymatgen.matproj.rest import MPRester from pymatgen.io.cif import CifWriter

with MPRester(matproj_key) as m: mat_id = 'mp-567337' material = m.get_structure_by_material_id(mat_id) print(mat_id, material.composition, material.get_space_group_info(), material.sites)

This outputs the correct material ID and spacegroup of mp-567337 lithium

with a negative poisson's ratio.

CifWriter(struct=material, symprec=True).write_file('Li_Test.cif')

This instead appears to output the subcell of the desired structure,

mp-135 lithium with a positive poisson's ratio.

Thank you, -Gerry

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/materialsproject/pymatgen/issues/1078, or mute the thread https://github.com/notifications/unsubscribe-auth/AGMZNNEzVNv0rd4_BLnR6aTqGMH-BI7uks5thULQgaJpZM4S5NZS .

GerardMattei commented 6 years ago

Hi Joey, I just tested it out - it worked perfectly - thanks for the help! I'll definitely keep that in mind, we're probably going to focus on other predicted auxetic materials. The Li polymorph just happened to be where we first noticed the CIFs were outputting incorrectly. Cheers and thanks again! -Gerry