We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe.
The new Materials Project API (https://next-gen.materialsproject.org/api) seems to only report structures in the pymatgen format only.
For example a REST request of this type "https://api.materialsproject.org/materials/summary/?material_ids=mp-66&_fields=structure",headers={"X-API-KEY": MP_API_KEY}" returns
{"data":[{"structure":{"@module":"pymatgen.core.structure","@class":"Structure","charge":0,"lattice":{"matrix":[[2.18050236,0.0,1.25891346],[0.72683412,2.05579703,1.25891346],[-0.0,0.0,2.51782692]],"pbc":[true,true,true],"a":2.5178271667719256,"b":2.5178269134954783,"c":2.51782692,"alpha":59.99999991454224,"beta":60.00000324214051,"gamma":59.9999988338285,"volume":11.286587893379405},"properties":{},"sites":[{"species":[{"element":"C","occu":1}],"abc":[0.875,0.875,0.875],"xyz":[2.54391942,1.7988224012499998,4.40619711],"properties":{"magmom":0.0},"label":"C"},{"species":[{"element":"C","occu":1}],"abc":[0.125,0.125,0.125],"xyz":[0.36341706,0.25697462875,0.62945673],"properties":{"magmom":0.0},"label":"C"}]}}],"meta":{"api_version":"0.63.2","time_stamp":"2024-02-27T03:47:28.940648","total_doc":1,"max_limit":1000,"default_fields":["material_id"]}}
Describe the solution you'd like
The following should generate a "molecule" from the string above (or a substring, after "structure:").
#include <iostream> #include <openbabel/obconversion.h> #include <openbabel/mol.h> int main(int argc,char **argv) { OBConversion obconversion; obconversion.SetInFormat("pymatgen"); OBMol mol; bool notatend = obconversion.Read(&mol, ... string above ... ); }
Describe alternatives you've considered
The Python pymatgen library can read this format, and thanks to its own OpenBabel binding, it can covert to other file formats.
(see example here: https://matgenb.materialsvirtuallab.org/2013/01/01/Molecule.html)
However, this requires the use of Python and can't be done directly with C++.
Additional context
Here it is a full python request using the new Materials Project API to download the structure of the material labeled "mp-66":
>>> import os >>> import requests >>> MP_API_KEY="12qlK7tT5WoqaXXXJjKKuPBHZ1ByEG3" >>> print(requests.get("https://api.materialsproject.org/materials/summary/?material_ids=mp-66&_fields=structure",he aders={"X-API-KEY": MP_API_KEY}).text) {"data":[{"structure":{"@module":"pymatgen.core.structure","@class":"Structure","charge":0,"lattice":{"matrix":[[2.18050236,0.0,1.25891346],[0.72683412,2.05579703,1.25891346],[-0.0,0.0,2.51782692]],"pbc":[true,true,true],"a":2.5178271667719256,"b":2.5178269134954783,"c":2.51782692,"alpha":59.99999991454224,"beta":60.00000324214051,"gamma":59.9999988338285,"volume":11.286587893379405},"properties":{},"sites":[{"species":[{"element":"C","occu":1}],"abc":[0.875,0.875,0.875],"xyz":[2.54391942,1.7988224012499998,4.40619711],"properties":{"magmom":0.0},"label":"C"},{"species":[{"element":"C","occu":1}],"abc":[0.125,0.125,0.125],"xyz":[0.36341706,0.25697462875,0.62945673],"properties":{"magmom":0.0},"label":"C"}]}}],"meta":{"api_version":"0.63.2","time_stamp":"2024-02-27T03:47:28.940648","total_doc":1,"max_limit":1000,"default_fields":["material_id"]}}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
The new Materials Project API (https://next-gen.materialsproject.org/api) seems to only report structures in the pymatgen format only.
For example a REST request of this type "https://api.materialsproject.org/materials/summary/?material_ids=mp-66&_fields=structure",headers={"X-API-KEY": MP_API_KEY}" returns
Describe the solution you'd like
The following should generate a "molecule" from the string above (or a substring, after "structure:").
Describe alternatives you've considered
The Python pymatgen library can read this format, and thanks to its own OpenBabel binding, it can covert to other file formats.
(see example here: https://matgenb.materialsvirtuallab.org/2013/01/01/Molecule.html)
However, this requires the use of Python and can't be done directly with C++.
Additional context
Here it is a full python request using the new Materials Project API to download the structure of the material labeled "mp-66":
The text was updated successfully, but these errors were encountered: