@@ -18,15 +18,15 @@ This repository hosts general tutorials on the OPTIMADE specification
1818and particular database implementations of the API. These open-ended
1919exercises were initially provided to accompany the following workshops:
2020
21- - NOMAD CoE [ Tutorial 6:
22- OPTIMADE] ( https://th.fhi-berlin.mpg.de/meetings/nomad-tutorials/index.php?n=Meeting.Tutorial6 ) ,
23- 7-8 September 2021
24- - ICTP-EAIFR [ Training School: Working with Materials Databases and
25- OPTIMADE] ( https://eaifr.ictp.it/about/news/ml-for-es-and-md/ ) ,
26- November-December 2021.
27- - CECAM Flagship Workshop [ Open Databases Integration for Materials
28- Design] ( https://www.cecam.org/workshop-details/1120 ) , May 30, 2022 -
29- June 3, 2022.
21+ - NOMAD CoE [ Tutorial 6:
22+ OPTIMADE] ( https://th.fhi-berlin.mpg.de/meetings/nomad-tutorials/index.php?n=Meeting.Tutorial6 ) ,
23+ 7-8 September 2021
24+ - ICTP-EAIFR [ Training School: Working with Materials Databases and
25+ OPTIMADE] ( https://eaifr.ictp.it/about/news/ml-for-es-and-md/ ) ,
26+ November-December 2021.
27+ - CECAM Flagship Workshop [ Open Databases Integration for Materials
28+ Design] ( https://www.cecam.org/workshop-details/1120 ) , May 30, 2022 -
29+ June 3, 2022.
3030
3131This document is hosted on
3232[ GitHub] ( https://github.com/Materials-Consortia/optimade-tutorial-exercises ) ,
@@ -39,18 +39,18 @@ page](https://optimade.org/#get-involved).
3939
4040### Contributors
4141
42- - [ Matthew Evans] ( https://ml-evs.science ) , * UCLouvain* (repository and
43- general exercises)
44- - [ Matthew Horton] ( https://github.com/mkhorton ) , * LBNL* (` pymatgen `
45- exercise)
46- - [ Evgeny Blokhin] ( https://tilde.pro ) , * Tilde Materials Informatics*
47- (typos and bug fixes)
48- - [ Cormac Toher] ( https://github.com/ctoher ) , * Duke University* (AFLOW
49- exercise)
50- - [ Abhijith Gopakumar] ( https://github.com/tachyontraveler ) ,
51- * Northwestern U.* (OQMD exercise)
52- - [ Johan Bergsma] ( https://github.com/JPBergsma ) , * CECAM* (typos,
53- testing and feedback)
42+ - [ Matthew Evans] ( https://ml-evs.science ) , * UCLouvain* (repository and
43+ general exercises)
44+ - [ Matthew Horton] ( https://github.com/mkhorton ) , * LBNL* (` pymatgen `
45+ exercise)
46+ - [ Evgeny Blokhin] ( https://tilde.pro ) , * Tilde Materials Informatics*
47+ (typos and bug fixes)
48+ - [ Cormac Toher] ( https://github.com/ctoher ) , * Duke University* (AFLOW
49+ exercise)
50+ - [ Abhijith Gopakumar] ( https://github.com/tachyontraveler ) ,
51+ * Northwestern U.* (OQMD exercise)
52+ - [ Johan Bergsma] ( https://github.com/JPBergsma ) , * CECAM* (typos, testing
53+ and feedback)
5454
5555</div >
5656
@@ -75,37 +75,41 @@ community. You may have heard about three such tools in other tutorials
7575and talks:
7676
77771 . [ The Materials Cloud web-based OPTIMADE
78- client] ( https://www. materialscloud.org/optimadeclient ) .
78+ client] ( https://materialscloud.org/optimadeclient/ ) .
79792 . [ The optimade.science web-based
8080 aggregator] ( https://optimade.science ) .
81813 . [ ` pymatgen ` 's built-in OPTIMADE
8282 client] ( https://pymatgen.org/pymatgen.ext.optimade.html?highlight=optimade#module-pymatgen.ext.optimade ) .
83+ 4 . [ ` optimade-python-tools ` 's
84+ ` OptimadeClient ` ] ( https://www.optimade.org/optimade-python-tools/latest/getting_started/client/ )
8385
84- Each of these clients can send requests to multiple OPTIMADE providers
86+ Some of these clients can send requests to multiple OPTIMADE providers
8587* simultaneously* , based on programmatic [ providers
8688list] ( https://providers.optimade.org/ ) . You can explore this list at the
8789human-readable [ providers
8890dashboard] ( https://www.optimade.org/providers-dashboard/ ) , where you can
89- see the current OPTIMADE structure count exceeds 17 million!
91+ see the current OPTIMADE structure count exceeds 26 million!
9092
9193You may wish to familiarise yourselves with the OPTIMADE API by writing
9294your own queries, scripts or code. Some possible options:
9395
94- - Craft (or copy) your own URL queries to a particular OPTIMADE
95- implementation. Some web browsers (e.g., Firefox) will automatically
96- format the JSON response for you (see Exercise 1).
97- - Use command-line tools such as [ ` curl ` ] ( https://curl.se/ ) or
98- [ ` wget ` ] ( https://www.gnu.org/software/wget/ ) to receive data in your
99- terminal, or pipe it to a file. You could use the tool
100- [ ` jq ` ] ( https://stedolan.github.io/jq/ ) to format the JSON response.
101- - Make an appropriate HTTP request from your programming language of
102- choice. For Python, you could use the standard library
103- [ urllib.request] ( https://docs.python.org/3/library/urllib.request.html )
104- or the more ergonomic external library
105- [ requests] ( https://requests.readthedocs.io/en/master/ ) . Some example
106- code for Python is provided in Exercise 1 below. In Javascript, you
107- can just use ` fetch(...) ` or a more advanced [ optimade
108- client] ( https://github.com/tilde-lab/optimade-client ) .
96+ - Craft (or copy) your own URL queries to a particular OPTIMADE
97+ implementation. Some web browsers (e.g., Firefox) will automatically
98+ format the JSON response for you (see Exercise 1).
99+ - Use command-line tools such as [ ` curl ` ] ( https://curl.se/ ) or
100+ [ ` wget ` ] ( https://www.gnu.org/software/wget/ ) to receive data in your
101+ terminal, or pipe it to a file. You could use the tool
102+ [ ` jq ` ] ( https://stedolan.github.io/jq/ ) to format the JSON response.
103+ - Make an appropriate HTTP request from your programming language of
104+ choice. For Python, you could use the standard library
105+ [ urllib.request] ( https://docs.python.org/3/library/urllib.request.html )
106+ or the more ergonomic external libraries
107+ [ requests] ( https://docs.python-requests.org/en/latest/index.html ) and
108+ [ httpx] ( https://www.python-httpx.org ) . Some example code for Python is
109+ provided below the exercises. In Javascript, you can just use
110+ ` fetch(...) ` or a more advanced OPTIMADE client such as that provided
111+ by Tilde Informatics'
112+ [ optimade-client] ( https://github.com/tilde-lab/optimade-client ) .
109113
110114If you are following these tutorials as part of a school or workshop,
111115please do not hesitate to ask about how to get started with any of the
@@ -127,45 +131,45 @@ number of results to a set of queries across all OPTIMADE
127131implementations, obtained by applying the same filter to the structures
128132endpoint of each database. The filters are:
129133
130- - Query for structures containing a group IV element:
131- ` elements HAS ANY "C", "Si", "Ge", "Sn", "Pb" ` .
132-
133- - As above, but return only binary phases:
134- ` elements HAS ANY "C", "Si", "Ge", "Sn", "Pb" AND nelements=2 ` .
135-
136- - This time, exclude lead and return ternary phases:
137- ` elements HAS ANY "C", "Si", "Ge", "Sn" AND NOT elements HAS "Pb" AND elements LENGTH 3 ` .
138-
139- - In your browser, try visiting the links in Table 1 of the OPTIMADE
140- paper \[ [ 1] ( #ref1 ) \] (clickable links in arXiv version
141- \[ [ 2] ( #ref2 ) \] ), which is reproduced below.
142-
143- - Familiarise yourself with the standard JSON: API output fields
144- (` data ` , ` meta ` and ` links ` ).
145- - You will find the crystal structures returned for the query as a
146- list under the ` data ` key, with the OPTIMADE-defined fields
147- listed under the ` attributes ` of each list entry.
148- - The ` meta ` field provides useful information about your query,
149- e.g. ` data_returned ` shows how many results there are in total,
150- not just in the current page of the response (you can check if
151- the table still contains the correct number of entries, or if it
152- is now out of date).
153- - The ` links ` field provides links to the next or previous pages
154- of your response, in case you requested more structures than the
155- ` page_limit ` for that implementation.
156-
157- - Choose one particular entry to focus on: replace the ` filter ` URL
158- parameter with ` /<structure_id> ` for the ` id ` of one particular
159- structure (e.g.
160- ` https://example.org/optimade/v1/structures/<structure_id> ` ).
161-
162- - Explore other endpoints provided by each of these providers. If they
163- serve "extra" fields (i.e. those containing the provider prefix),
164- try to find out what these fields mean by querying the
165- ` /info/structures ` endpoint.
166-
167- - Try performing the same queries with some of the tools listed above,
168- or in scripts of your own design.
134+ - Query for structures containing a group IV element:
135+ ` elements HAS ANY "C", "Si", "Ge", "Sn", "Pb" ` .
136+
137+ - As above, but return only binary phases:
138+ ` elements HAS ANY "C", "Si", "Ge", "Sn", "Pb" AND nelements=2 ` .
139+
140+ - This time, exclude lead and return ternary phases:
141+ ` elements HAS ANY "C", "Si", "Ge", "Sn" AND NOT elements HAS "Pb" AND elements LENGTH 3 ` .
142+
143+ - In your browser, try visiting the links in Table 1 of the OPTIMADE
144+ paper \[ [ 1] ( #ref1 ) \] (clickable links in arXiv version
145+ \[ [ 2] ( #ref2 ) \] ), which is reproduced below.
146+
147+ - Familiarise yourself with the standard JSON: API output fields
148+ (` data ` , ` meta ` and ` links ` ).
149+ - You will find the crystal structures returned for the query as a
150+ list under the ` data ` key, with the OPTIMADE-defined fields listed
151+ under the ` attributes ` of each list entry.
152+ - The ` meta ` field provides useful information about your query, e.g.
153+ ` data_returned ` shows how many results there are in total, not just
154+ in the current page of the response (you can check if the table
155+ still contains the correct number of entries, or if it is now out of
156+ date).
157+ - The ` links ` field provides links to the next or previous pages of
158+ your response, in case you requested more structures than the
159+ ` page_limit ` for that implementation.
160+
161+ - Choose one particular entry to focus on: replace the ` filter ` URL
162+ parameter with ` /<structure_id> ` for the ` id ` of one particular
163+ structure (e.g.
164+ ` https://example.org/optimade/v1/structures/<structure_id> ` ).
165+
166+ - Explore other endpoints provided by each of these providers. If they
167+ serve "extra" fields (i.e. those containing the provider prefix), try
168+ to find out what these fields mean by querying the ` /info/structures `
169+ endpoint.
170+
171+ - Try performing the same queries with some of the tools listed above,
172+ or in scripts of your own design.
169173
170174<center >
171175<table >
@@ -254,30 +258,30 @@ The filters from Exercise 1 screened for group IV containing compounds,
254258further refining the query to exclude lead, and finally to include only
255259ternary phases.
256260
257- - Choose a suitable database and modfiy the filters from Exercise 1 to
258- search for binary \[ III\] -\[ V\] semiconductors.
259- - A "suitable" database here is one that you think will have good
260- coverage across this chemical space.
261- - Using the ` chemical_formula_anonymous ` field, investigate the most
262- common stoichiometric ratios between the constituent elements, e.g.
263- 1:1, 2:1, etc.
264- - You may need to follow pagination links (` links->next ` in the
265- response) to access all available data for your query, or you
266- can try adding the ` page_limit=100 ` URL parameter to request
267- more structures per response.
268- - Apply the same filter to another database and assess the similarity
269- between the results, thinking carefully about how the different
270- focuses of each database and different methods in their
271- construction/curation could lead to biases in this outcome.
272- - For example, an experimental database may have one crystal
273- structure entry per experimental sample studied, in which case
274- the most useful (or "fashionable") compositions will return many
275- more entries, especially when compared to a database that
276- curates crystal structures such that each ideal crystal has one
277- canonical entry (e.g., a database of minerals).
278- - Try to use the query you have constructed in the multi-provider
279- clients (linked above), to query all OPTIMADE providers
280- simultaneously.
261+ - Choose a suitable database and modfiy the filters from Exercise 1 to
262+ search for binary \[ III\] -\[ V\] semiconductors.
263+ - A "suitable" database here is one that you think will have good
264+ coverage across this chemical space.
265+ - Using the ` chemical_formula_anonymous ` field, investigate the most
266+ common stoichiometric ratios between the constituent elements, e.g.
267+ 1:1, 2:1, etc.
268+ - You may need to follow pagination links (` links->next ` in the
269+ response) to access all available data for your query, or you can
270+ try adding the ` page_limit=100 ` URL parameter to request more
271+ structures per response.
272+ - Apply the same filter to another database and assess the similarity
273+ between the results, thinking carefully about how the different
274+ focuses of each database and different methods in their
275+ construction/curation could lead to biases in this outcome.
276+ - For example, an experimental database may have one crystal structure
277+ entry per experimental sample studied, in which case the most useful
278+ (or "fashionable") compositions will return many more entries,
279+ especially when compared to a database that curates crystal
280+ structures such that each ideal crystal has one canonical entry
281+ (e.g., a database of minerals).
282+ - Try to use the query you have constructed in the multi-provider
283+ clients (linked above), to query all OPTIMADE providers
284+ simultaneously.
281285
282286</div >
283287
@@ -322,25 +326,25 @@ allows implementations to serve their own fields with an appropriate
322326` /info/structures ` endpoint.
323327
324328One computed property that is key to many high-throughput studies is the
325- * chemical stability* (* δ * ) of a crystal structure, i.e. whether the
329+ * chemical stability* ($\delta$ ) of a crystal structure, i.e. whether the
326330structure is predicted to spontaneously decompose into a different phase
327331(or phases). This is typically computed as the distance from the convex
328332hull in composition-energy space, with a value of 0 (or \< 0, if the
329333target structure was not used to compute the hull itself) indicating a
330334stable structure.
331335
332- - Interrogate the ` /info/structures ` endpoints of the OPTIMADE
333- implementations that serve DFT data (e.g., Materials Project, AFLOW,
334- OQMD, etc.) and identify those that serve a field that could
335- correspond to hull distance, or other stability metrics.
336- - Construct a filter that allows you to screen a database for
337- metastable materials (i.e., 0 \< * δ * \< 25 meV/atom) according to
338- this metric.
339- - Try to create a filter that can be applied to multiple databases
340- simultaneously (e.g., apply
341- ` ?filter=_databaseA_hull_distance < 25 OR _databaseB_stability < 25 ` ).
342- What happens when you run this filter against a database that does
343- not contain the field?
336+ - Interrogate the ` /info/structures ` endpoints of the OPTIMADE
337+ implementations that serve DFT data (e.g., Materials Project, AFLOW,
338+ OQMD, etc.) and identify those that serve a field that could
339+ correspond to hull distance, or other stability metrics.
340+ - Construct a filter that allows you to screen a database for metastable
341+ materials (i.e., $0 < \delta < 25\text{ meV/atom}$ ) according to this
342+ metric.
343+ - Try to create a filter that can be applied to multiple databases
344+ simultaneously (e.g., apply
345+ ` ?filter=_databaseA_hull_distance < 25 OR _databaseB_stability < 25 ` ).
346+ What happens when you run this filter against a database that does not
347+ contain the field?
344348
345349</div >
346350
@@ -361,12 +365,12 @@ GitHub](https://github.com/Materials-Consortia/) repository.
361365
362366Some potential prompts:
363367
364- - What additional fields or entry types should OPTIMADE standardize to
365- be most useful to you?
366- - How could the existing tools be improved, or what new tools could be
367- created to make OPTIMADE easier to use?
368- - What features from other APIs/databases that you use could be
369- adopted within OPTIMADE?
368+ - What additional fields or entry types should OPTIMADE standardize to
369+ be most useful to you?
370+ - How could the existing tools be improved, or what new tools could be
371+ created to make OPTIMADE easier to use?
372+ - What features from other APIs/databases that you use could be adopted
373+ within OPTIMADE?
370374
371375</div >
372376
@@ -390,11 +394,11 @@ found at AFLOW's `/info/structures` endpoint
390394performed for prototype labels using OPTIMADE by appending the ` _aflow_ `
391395prefix to the keyword: ` _aflow_aflow_prototype_label_relax ` .
392396
393- - Use OPTIMADE to search AFLOW for NaCl in the rock salt structure
394- (prototype label ` AB_cF8_225_a_b ` )
395- - Use OPTIMADE to search AFLOW for lead-free halide cubic perovskites
396- with a band gap greater than 3 eV: (cubic perovskite prototype label
397- is ` AB3C_cP5_221_a_c_b ` )
397+ - Use OPTIMADE to search AFLOW for NaCl in the rock salt structure
398+ (prototype label ` AB_cF8_225_a_b ` )
399+ - Use OPTIMADE to search AFLOW for lead-free halide cubic perovskites
400+ with a band gap greater than 3 eV: (cubic perovskite prototype label
401+ is ` AB3C_cP5_221_a_c_b ` )
398402
399403</div >
400404
0 commit comments