Replies: 11 comments 7 replies
-
maybe @matthewkuner knows more? |
Beta Was this translation helpful? Give feedback.
-
I do not know why the values are rounded on the website; honestly, it is probably just to make them more pretty. However, the data from the mp-api is not rounded. Try
I think that the ieee format symmetrizes the elastic tensor based on the symmetry of the structure. Coding this yourself will be a decent bit of work--I would not recommend that at all, as it has certainly been done countless times in open-source repos already (e.g. here in pymatgen ). If you want to understand this better, the root of the relationship between those tensors would be grounded in group/representation theory, crystal symmetry, tensor transformations, etc. Somebody please correct me if I'm wrong. I work with this stuff somewhat but am by no means an expert... |
Beta Was this translation helpful? Give feedback.
-
outputs
which is rounded. I would like the tensor in the IEEE format, but not rounded. I don't want to reimplement it, you're right, I'd just like to know how to retrieve it with pymatgen, or transform the raw tensor (not rounded) again into the IEEE format. |
Beta Was this translation helpful? Give feedback.
-
@fxcoudert I think it is part of the In atomate2, the workflow for getting at it is maybe a bit clearer: https://materialsproject.github.io/atomate2/_modules/atomate2/common/schemas/elastic.html#ElasticDocument.from_stresses I would assume a similar workflow has been used to generate the MP data. |
Beta Was this translation helpful? Give feedback.
-
OK, so I think I can do:
It seems to return the same thing as I still don't understand why the data is rounded in the MP database itself (rather than on display). |
Beta Was this translation helpful? Give feedback.
-
Tagging @tschaume as well as I don't find an immediate answer in emmet (https://github.com/materialsproject/emmet) which is the builder for the Materials Project data (I might have overlooked something or the data has been generated differently). |
Beta Was this translation helpful? Give feedback.
-
@fxcoudert oops, I was testing on a large set of mp-ids. It's weird that mp-149 (which I just picked randomly to give you a single example (without checking, which was foolish)) is rounded, I agree... |
Beta Was this translation helpful? Give feedback.
-
Thanks all! Hi @fxcoudert, please see below.
The is a bit ad-hoc. All previous ieee elastic tensors were rounded to 1GPa (Although I am not 100% sure, I believe it is because we want not to make it very clumsy when displaying the values on the MP website). So, when I recalculate them, I simply adopted the previous convention. In retrospect, I should have kept more significant numbers. @tschaume might be able to fix this -- rerun parts of the builder.
@matthewkuner pointed to the correct places, just wanted to add one more point. ieee defines the "standard" orientation of each crystal based on the space group. The major difference between the ieee format and raw format is that the tensors are rotated. Of course, we also performed other symmetrization based on the space group as @matthewkuner mentioned. The solutions you provided above can get the unrounded one. |
Beta Was this translation helpful? Give feedback.
-
We were able to get some additional historical context from @kristinpersson about why |
Beta Was this translation helpful? Give feedback.
-
Let me summarize the testing code for the issues discussed here: In [9]: from mp_api.client import MPRester
...: from pymatgen.core.tensors import Tensor
...:
...: # Fetch elastic tensor data from Materials Project
...: with MPRester() as mpr:
...: elastic_doc = mpr.materials.elasticity.search(material_ids=["mp-149"])
...:
...: if elastic_doc: # Check if data exists
...: # Get elastic tensor data in different formats
...: raw_tensor = elastic_doc[0].elastic_tensor.raw
...: ieee_tensor = elastic_doc[0].elastic_tensor.ieee_format
...:
...: # Convert to Pymatgen Tensor and transform to IEEE standard
...: tensor = Tensor.from_voigt(raw_tensor)
...: ieee_transformed = tensor.convert_to_ieee(elastic_doc[0].structure).voigt
...:
...: print("Raw elastic tensor:")
...: print(raw_tensor)
...: print("\nIEEE format (from API):")
...: print(ieee_tensor)
...: print("\nIEEE transformed tensor (using Pymatgen):")
...: print(ieee_transformed)
...: else:
...: print("No elastic data found for mp-149")
...:
Retrieving ElasticityDoc documents: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 12052.60it/s]
Raw elastic tensor:
((153.19279267761982, 56.777185976088205, 56.777185976088205, -7.979727989493311e-17, -6.661338147750937e-16, 9.436895709313829e-16), (56.777185976088205, 153.19279267761982, 56.77718597608822, -6.661338147750937e-16, -7.979727989493311e-17, 6.839865079851815e-15), (56.777185976088205, 56.77718597608822, 153.19279267761985, -6.661338147750941e-16, 9.436895709313833e-16, -7.979727989493315e-17), (-7.979727989493311e-17, -6.661338147750937e-16, -6.661338147750941e-16, 74.25053622362908, 0.0, 1.2528910738651292e-32), (-6.661338147750937e-16, -7.979727989493311e-17, 9.436895709313833e-16, 0.0, 74.2505362236291, -2.0608663726559307e-15), (9.436895709313829e-16, 6.839865079851815e-15, -7.979727989493315e-17, 1.2528910738651292e-32, -2.0608663726559307e-15, 74.25053622362913))
IEEE format (from API):
((153.0, 57.0, 57.0, -0.0, -0.0, 0.0), (57.0, 153.0, 57.0, -0.0, -0.0, 0.0), (57.0, 57.0, 153.0, -0.0, 0.0, 0.0), (-0.0, -0.0, -0.0, 74.0, 0.0, -0.0), (-0.0, -0.0, 0.0, 0.0, 74.0, -0.0), (0.0, 0.0, 0.0, -0.0, -0.0, 74.0))
IEEE transformed tensor (using Pymatgen):
[[ 1.53192793e+02 5.67771860e+01 5.67771860e+01 -1.71248977e-15
-7.85490033e-16 5.40602707e-15]
[ 5.67771860e+01 1.53192793e+02 5.67771860e+01 -5.40602707e-15
-1.00148357e-31 5.40602707e-15]
[ 5.67771860e+01 5.67771860e+01 1.53192793e+02 -5.40602707e-15
7.85490033e-16 1.71248977e-15]
[-1.71248977e-15 -5.40602707e-15 -5.40602707e-15 7.42505362e+01
2.23951367e-15 -3.54252944e-32]
[-7.85490033e-16 -5.75211077e-32 7.85490033e-16 2.23951367e-15
7.42505362e+01 -2.23951367e-15]
[ 5.40602707e-15 5.40602707e-15 1.71248977e-15 -5.10157680e-32
-2.23951367e-15 7.42505362e+01]] |
Beta Was this translation helpful? Give feedback.
-
I have two questions related to the elastic tensors representation in Materials Project/pymatgen.
mat.elastic_tensor.ieee_format
rounded to 1 GPa for all entries?mat.elastic_tensor.ieee_format
andmat.elastic_tensor.raw
? What function is transforming one into the other? I would like to do it on my own, without rounding.Beta Was this translation helpful? Give feedback.
All reactions