[Cod-bugs] Searching in COD

Andrius Merkys andrius.merkys at gmail.com
Mon Jan 18 14:23:36 EET 2021


Dear Holger Friedrich,

Thank you for your interest in the COD. Please find my in-line comments
below.

On 2021-01-17 19:47, Friedrich, Holger wrote:
> I had hoped that by using 1 to 8 elements with the oxygen and the given
> cations would give me the result if
> 
> I specify the number of distinct elements min and max at 2 and 6
> respectively. But that did not work out.

The COD search requires all the elements entered in search boxes to be
present in the returned structures. Limiting the number of distinct
elements to less than 6 makes the query impossible, as no structure can
have all the 8 elements and at the same time have less than 6 elements.

> If you could give me a suggestion how to proceed and search I would be
> very grateful.

For now I would suggest running a set of queries and collating their
results automatically. The COD implements OPTIMADE-compatible [1] search
interface, which allows composing more elaborate queries ("OPTIMADE
filters").

As far as I understand, your structures of interest must contain oxygen
and 2-5 of elements from this list: Al, Ca, K, Si, Zn. Thus the COD
OPTIMADE interface has to be queried with such filters:

elements HAS "O" AND elements HAS ALL "Al", "Ca" AND elements LENGTH 3
elements HAS "O" AND elements HAS ALL "Al", "K"  AND elements LENGTH 3
...
elements HAS "O" AND elements HAS ALL "Al", "Ca", "K", "Si", "Zn" AND
elements LENGTH 6

Here, 'elements HAS "O"' requires structures to contain oxygen,
'elements HAS ALL "Al", "Ca"' requires presence of all enumerated
elements and 'elements LENGTH 3' requires the number of elements be
equal to 3.

To query the COD OPTIMADE interface one has to submit queries to
https://www.crystallography.net/cod/optimade/v1/structures with filter
string URL-encoded and appended with '?filter=' to the URL, for example:

https://www.crystallography.net/cod/optimade/v1/structures?filter=elements%20HAS%20%22O%22%20AND%20elements%20HAS%20ALL%20%22Al%22,%20%22Ca%22%20AND%20elements%20LENGTH%203

The output is in JSON:API-compatible [2] JSON output.

> If this cannot be done, I would like to provide it as a suggestion.

For now, however, there is no other way to query the COD for these
structures. OPTIMADE specification describes 'HAS ONLY' query operator
which would considerably reduce the work here, but it is not yet
implemented in the COD OPTIMADE interface.

[1] https://zenodo.org/record/4195051
[2] https://jsonapi.org

Hope this helps,
Andrius Merkys

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Cod-bugs mailing list