How to get the 2D materials in Materials Project

Hello everyone!

I know that there are 130000+ inorganic materials in Materials Project database. But currently, I am only interested in the 2D materials. Is there a method to extract the 2D materials directly from Materials Project? Thanks in advance!

Best,
Pan

Hi @Pan_Xiang, welcome!

There’s not an easy way to do this search right now, however if you’re comfortable with Python, this is fairly straight forward to do with our pymatgen package.

The basic steps are to download all the structures from Materials Project using MPRester (this will take several minutes) and then use some of the analysis tools in pymatgen.analysis.dimensionality to estimate the dimensionality of the materials (this will take several hours).

Hope this helps – we do intend to add this kind of searching to the website in future, but it’s further out on our roadmap right now.

Best,

Matt

1 Like

Dear Matthew Horton,

Thank you so much for your reply and it is very useful!

Using pymatgen.ext.matproj.MPRester(“API_KEY”).get_data(“materials_id”) method, I can download the structure data one by one. But it’s too slow. It will take about a month to traverse from mp-1 to mp-2000000. So is there any other way to download all the structures from Materials Project?

Thanks again!

Best,
Pan

You can query based on a list of mpids:

2 Likes

Dear Peter Schindler,

Thank you for your help! It is a very effective method!

I want to download all materials in MP, so I have another question about the naming method of material_id. I found that the materials_id prefixed with “mp-” range from one to several million but are not continuous: some point to other materials, and most are empty. Besides, some material_id also prefix with “mvc-” and “NMGC-”. Do you know the naming rules of material_id in MP?

Best,
Pan

1 Like

Dear Pan,

I wouldn’t worry about the material_id naming conventions. If you want to query the whole database, don’t query it based on the ID but rather by a property that is true for any material, for example:

criteria = {"structure": {'$exists': True}}

or

criteria = {"nsites": {"$gt": 0}}

However, there are very few cases where you actually want the entire database and you should think about other constraints before querying (e.g. number of atoms in the unit cell, energy above hull, etc.). Also, think about which properties are relevant in your case and only query those.

Hope this helps.

-Peter

1 Like

Hi Matt,

Your answer helps me have a nice workflow on dimension analysis. However, I have some additional points which I feel confused. From what I know, pymatgen has three ways for dimension analysis: (1) get_dimensionality_larsen (2) get_dimensionality_cheon (3) get_dimensionality_gorai.

Q1. I am just wondering which one is implemented for values displayed on Materials Project website?
Q2. I found get_dimensionality_cheon is not always working for some structures. Three functions sometimes return different dimensions, this also leads to my Q1.
Q3: If some other method is used to calculate dimension, would you mind providing more info. Although MPR website has dimensions displayed for each material, it seems it is hidden from the API.

I appreciate any assistance:)

useful link: pymatgen.analysis.dimensionality module — pymatgen 2023.1.30 documentation

Cheers,
JD

Thread closed due to inactivity, please open a new thread to address related issues.