Questions on the details about the api used for compounds


I’m currently working on a self-project using compound api via python. I was wondering which api source this program used. also, after the element inputs, what algorithms does the program use to search for the compounds?

Thank you for your time

Hi @inkcode. If you are accessing the API via the pymatgen library, the source code for the client is available here. Unfortunately, the source code for the server end is not open at this time. However, the method of searching for compounds that the main MPRester.query uses is a simple dispatching to the strategy of the underlying MongoDB database. Compound information is compiled from various related calculations into JSON documents via open-source emmet builders, that are stored in MongoDB. You search using the JSON-based MongoDB pattern matching language, which the database uses to find the relevant material-compound documents, using a built-in query planner that uses awareness of indexes to determine the fastest strategy to page through records to find those that match your query. I hope this helps.

1 Like

I’ve took a look at the file and I have a question about it. So in my understanding there are two types of ID: the task id and the materials id. If the task id is required to obtain the materials id from def get_materials_id_from_task_id(self, task_id), how is the task id obtained? To add on to what I’m trying to do, I’m trying to reproduce the search tool with the periodic table in the materials project.