New user, first question: Lower dimensional materials are interesting. How would one constrain searches Materials Project for 2D materials only? For example, the 2D honeycomb single element xenes llike silicene, or a monolayer TMD like MoS2?
Hi @david2D, this feature was a part of our legacy API, and it’s something we’re still working on adding.
Right now, the easiest way is to use our API to find which MPIDs correspond to 2D materials and only do subsequent searches using those MPIDs:
from mp_api.client import MPRester
with MPRester("API_KEY") as mpr:
rcd = mpr.materials.robocrys.search_docs(fields=['material_id','description'])
two_d_mpids = [doc.material_id.string for doc in rdc if 'two-dimensional' in doc.description]
2d_mpids.json (126.2 KB)
@Aaron_Kaplan Thank you for your speedy reply!
I was unable to fire up the legacy version, and had some errors with pip install mp_api
which might (or might not) related to either my four year old Anaconda installation or using pip install pymatgen
earlier.
I’m not a developer but I think I can find some help locally to sort this out. For completeness I’ll include the information here, just in case you are curious. (I hope the formatting works):
Install errors:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
napari 0.4.6 requires tifffile>=2020.2.16, but you have tifffile 2019.7.26.2 which is incompatible.
tensorflow 2.3.1 requires h5py<2.11.0,>=2.10.0, but you have h5py 3.8.0 which is incompatible.
tensorflow 2.3.1 requires numpy<1.19.0,>=1.16.0, but you have numpy 1.21.6 which is incompatible.
from mp_api.client import MPRester
yields:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/davido/anaconda3/lib/python3.7/site-packages/mp_api/__init__.py", line 6, in <module>
from mp_api.client import MPRester
File "/Users/davido/anaconda3/lib/python3.7/site-packages/mp_api/client.py", line 13, in <module>
from mpcontribs.client import Client
File "/Users/davido/anaconda3/lib/python3.7/site-packages/mpcontribs/client/__init__.py", line 5, in <module>
import fido
File "/Users/davido/anaconda3/lib/python3.7/site-packages/fido/__init__.py", line 3, in <module>
from .fido import fetch
File "/Users/davido/anaconda3/lib/python3.7/site-packages/fido/fido.py", line 12, in <module>
from twisted.internet.endpoints import TCP4ClientEndpoint
File "/Users/davido/anaconda3/lib/python3.7/site-packages/twisted/internet/endpoints.py", line 69, in <module>
from OpenSSL.SSL import Error as SSLError
File "/Users/davido/anaconda3/lib/python3.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/Users/davido/anaconda3/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1556, in <module>
class X509StoreFlags(object):
File "/Users/davido/anaconda3/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1575, in X509StoreFlags
NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'
Hey @david2D, it’s probably the conda environment, python 3.7 reached its end of life and isn’t officially supported by our packages. python >=3.10 should be OK