Skip to content
Merged
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f49193d
Added specification for the trajectories endpoint
JPBergsma Jul 20, 2021
95092cd
Made corrections to the indentation levels
JPBergsma Jul 20, 2021
a291b59
Multiple small corrections for the trajectories entry
JPBergsma Jul 20, 2021
66556cc
Changed layout JSON code blocks under Examples of a returned trajectory.
JPBergsma Jul 22, 2021
2b841b3
Changed indentation level relationships field and no longer discuss r…
JPBergsma Jul 22, 2021
f4c8e0f
Processed remarks Gian-Marco + minor changes
JPBergsma Jul 26, 2021
05ddb3d
Removed the next_part_trajectory field from the definition as it is a…
JPBergsma Jul 27, 2021
ee8f3dc
Replaced \_ with _ where pandoc did not interpreted \ correctly as es…
JPBergsma Jul 28, 2021
94d2e63
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Aug 3, 2021
b05bf39
Merge branch 'Materials-Consortia:develop' into JPBergsma_add_Traject…
JPBergsma Aug 23, 2021
fc869a8
added a few more internal links
JPBergsma Aug 30, 2021
5012aed
Merge branch 'Materials-Consortia:develop' into JPBergsma_add_Traject…
JPBergsma Sep 9, 2021
03a194c
Merge branch 'JPBergsma_add_Trajectories' of https://github.com/JPBer…
JPBergsma Sep 9, 2021
0ae7af8
Apply suggestions from code review Giovanni
JPBergsma Sep 9, 2021
7182828
Merge branch 'JPBergsma_add_Trajectories' of https://github.com/JPBer…
JPBergsma Sep 9, 2021
d523efb
added comments Giovani
JPBergsma Sep 13, 2021
84f007c
processed remarks Giovanni
JPBergsma Sep 15, 2021
4dd22d3
Updated examples; specified that the values field is a list; and e fe…
JPBergsma Sep 15, 2021
1ec442d
Placed each sentecnce on a separate line.
JPBergsma Dec 15, 2021
ff99f2e
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Dec 15, 2021
5ae4993
removed excess tilde
JPBergsma Dec 16, 2021
b52d5a7
Merge branch 'JPBergsma_add_Trajectories' of https://github.com/JPBer…
JPBergsma Dec 16, 2021
e2c7f2c
replaced reference to section 7.3.1-4 with links to the subsections
JPBergsma Dec 16, 2021
18f54c8
added link to "Retrieving trajectory data" from the introduction sect…
JPBergsma Dec 16, 2021
5058ce7
changed the formatting of properties in trajectories section.
JPBergsma Dec 16, 2021
1769178
Corrected spelling mistake
JPBergsma Dec 17, 2021
df284d8
Changed "fields" to "properties at the start of the "Retrieving the t…
JPBergsma Dec 17, 2021
57b801d
Readded uneccesary escape backslashes for underscores so the differen…
JPBergsma Dec 17, 2021
5bbef72
Added example query to show how fields within the reference structure…
JPBergsma Dec 17, 2021
e8af14d
Added that the query parameters first_frame, last_frame and frame_ste…
JPBergsma Dec 17, 2021
e69f8f6
changed frame serialization to frame_serialization_format under in th…
JPBergsma Dec 17, 2021
aed3e17
removed sentence about only returning trajectory data when the proper…
JPBergsma Dec 17, 2021
875f6cc
Removed undetected trailing white space.
JPBergsma Dec 17, 2021
c8d8769
Added missing comma in example available_properties.
JPBergsma Mar 4, 2022
9aadfca
Made the frame index start from 1.
JPBergsma Jun 2, 2022
beaea22
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Sep 23, 2022
c817004
Processed comments Merkys.
JPBergsma Sep 28, 2022
b51758d
Removed frame and trajectory from Definition of Terms.
JPBergsma Sep 28, 2022
bb6acaa
Further improvements to JSON examples.
JPBergsma Sep 28, 2022
fe6f0d7
Capitalized Structures Entries when referring to section 8.2.
JPBergsma Sep 28, 2022
3789943
removed commas from JSON comment lines.
JPBergsma Sep 29, 2022
5ba755f
Removed lines which stated queries must be performed on the propertie…
JPBergsma Sep 29, 2022
e8c5577
Apply suggestions from code review rartino
JPBergsma Sep 29, 2022
bd3bbd8
processed remark rartino and removed trailing whitespace.
JPBergsma Sep 29, 2022
c32c477
removed trailing white space
JPBergsma Sep 29, 2022
952ef2a
Apply suggestions from code review ml-evs
JPBergsma Oct 4, 2022
4958296
Added extra explanation to field nframes.
JPBergsma Oct 4, 2022
a6cd494
Add remark rartino
JPBergsma Oct 6, 2022
d210a97
Changed MUST to SHOULD for the support level of theg first_frame, las…
JPBergsma Oct 15, 2022
bded2a9
Merge branch 'JPBergsma_add_Trajectories' of https://github.com/JPBer…
JPBergsma Nov 29, 2022
6e82a48
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Nov 29, 2022
9d0df98
Removed Available properties field.
JPBergsma Dec 7, 2022
c0beb50
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Dec 7, 2022
a73f5c1
removed last reference to solely using the reference structure for qu…
JPBergsma Dec 7, 2022
a65f586
Removed reference to using the response_field parameter to trigger re…
JPBergsma Dec 8, 2022
7975f03
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Mar 16, 2023
9b75254
Updated description trajectory endpoint for new ranged property defin…
JPBergsma Mar 20, 2023
68b074e
Updated examples for the changes in the metadata and ranged propertie…
JPBergsma Jun 2, 2023
b5a72e7
Added returned_range_field to example.
JPBergsma Jun 2, 2023
3a0b503
some small changes.
JPBergsma Jun 2, 2023
399c6d7
corrected indexes field in example.
JPBergsma Jun 2, 2023
64714f8
Merge branch 'develop' into JPBergsma_add_Trajectories
JPBergsma Jun 29, 2023
75a97ba
Apply suggestions from code review
JPBergsma Jun 29, 2023
5cd0f98
intermediate state updating trajectory proposal for new developments.
JPBergsma Jun 29, 2023
92d0300
Updated example.
JPBergsma Jun 30, 2023
bea17d9
Small corrections
JPBergsma Jul 4, 2023
b351d46
Apated PR for moving range_ids to property definitions.
JPBergsma Jul 6, 2023
af26757
Changed reference_frame to reference_frames as it is now a list which…
JPBergsma Sep 13, 2023
2023e7f
Update optimade.rst
merkys Jan 18, 2024
68648d0
Update optimade.rst
giovannipizzi Jul 4, 2024
f7b5991
Merge branch 'develop' into JPBergsma_add_Trajectories
giovannipizzi Sep 18, 2025
161098f
Merge remote-tracking branch 'upstream/develop' into JPBergsma_add_Tr…
giovannipizzi Sep 18, 2025
1a28330
Fix during discussion
giovannipizzi Sep 18, 2025
d3be7b6
Adding first version of compact-list representation
giovannipizzi Sep 18, 2025
9388d6d
Rephrasing of an example
giovannipizzi Sep 18, 2025
b54a783
First rephrasing of the trajectory entry
giovannipizzi Sep 18, 2025
43b791d
Reformulated compactable definition after discussion on backward comp…
giovannipizzi Sep 18, 2025
6c7a0f5
Better section reorganization
giovannipizzi Sep 18, 2025
ca80ec7
Update optimade.rst
gmrigna Sep 18, 2025
1617fbb
Update optimade.rst
gmrigna Sep 18, 2025
6102cb1
Update optimade.rst
gmrigna Sep 18, 2025
e8f2c23
Update optimade.rst
gmrigna Sep 18, 2025
f6471b5
Update optimade.rst
gmrigna Sep 18, 2025
e72d94c
Update optimade.rst
gmrigna Sep 18, 2025
76d85ce
Update optimade.rst
gmrigna Sep 18, 2025
52f1caf
Update optimade.rst
gmrigna Sep 18, 2025
8f2999a
Clarifying compactable flag for first dimension in most trajectory pr…
giovannipizzi Sep 18, 2025
ea0052b
Fixing the remaining part of the trajectory endpoint specification
giovannipizzi Sep 18, 2025
a91ca00
Update optimade.rst
gmrigna Sep 19, 2025
c43c83c
Update optimade.rst
gmrigna Sep 19, 2025
b97f52c
Update optimade.rst
gmrigna Sep 19, 2025
7b85318
Update optimade.rst
gmrigna Sep 19, 2025
7d2c99f
Update optimade.rst
gmrigna Sep 19, 2025
6fefbf0
Merge branch 'develop' into JPBergsma_add_Trajectories
rartino Sep 19, 2025
fb9f9e8
Merge branch 'develop' of github.com:Materials-Consortia/OPTIMADE int…
giovannipizzi Sep 19, 2025
f0faac0
Update optimade.rst
giovannipizzi Sep 19, 2025
9db5082
Update optimade.rst
giovannipizzi Sep 19, 2025
5dfa9f7
Merge branch 'develop' into JPBergsma_add_Trajectories
rartino Sep 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
270 changes: 268 additions & 2 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,78 @@ Example of the corresponding metadata property definition contained in the field
}
// ...

Compact list representation
---------------------------

There are cases in which the response includes lists that can be expressed in a more compact form than explicitly providing each value.
For example, lists with constant values along a given axis (e.g., in the case of a trajectory with a fixed unit cell for all frames).

To allow for efficient data transfer, some dimensions of selected properties are thus marked as **compactable** in the corresponding property definitions.
This is achieved using the :field:`compactable` field inside the `x-optimade-dimensions` dictionary of the property definition.
This field is a list of strings of the same length as the property dimension.
Each string indicates if a dimension can be compacted and, if so, in which compact format, as detailed in the section of the `Property Definitions`_ describing the :field:`compactable` field.

If a property has at least one dimension declared as compactable, the server MUST return it in the response in one of the two following ways:

1. using the standard rules. This means either giving the values (which can possibly be :val:`null`) at each position directly in the :field:`data` field of the response, or using the large property values protocol (see `Transmission of large property values`_);

2. using the **compact format** specified in the corresponding :field:`compactable` field (limited to the dimensions set as compactable).

If none of the property dimensions are set as compactable, the server MUST always use the standard rules to represent the property.

Clients MUST be able to handle responses with both compact and non-compact property formats in the same response.
If a client finds a string in the :field:`compactable` field that it does not recognize (which may be defined by future versions of this specification), it MUST NOT attempt to interpret the corresponding property value.

Compact formats
~~~~~~~~~~~~~~~

Currently, only one **compact format** is defined, represented by the string :val:`"constant"`, supporting lists consisting of constant values along a given axis.
If the server adopts this compact format, the list MUST include only one value for that list axis.
This value MUST be interpreted as the constant value of the list along that dimension.

We highlight two advantages of the design of the :val:`"constant"` compact format representation:

- it is still possible to use the same schemas to validate the list property, since the list dimensionality and the
data type of its items are the same, both when explicitly writing all list items (using the standard rules)
and when using the compact format;

- even if in the future a compact format is implemented also in the large-property transfer protocol (described in the section `Transmission of large property values`_), using the approach described here (where data is directly provided in the :field:`data` section) avoids unnecessary separate requests for each individual property.

Example:

- A trajectory with a fixed unit cell for all frames could be represented as:

.. code:: jsonc

{
"data":{
"id": "traj00000001",
"type": "trajectories",
"attributes": {
"nframes": 5,
"last_modified":"2021-07-16T18:02:03Z",
"elements": [["H","O"]],
"nelements": [2],
"lattice_vectors" : [
[[4.0, 0.0, 0.0],[0.0, 4.0, 0.0],[0.0, 0.0, 4.0]]
],
"_exmpl_timestep": [0.0, 1.0, 2.0, 3.0, 4.0],
"cartesian_site_positions" : null,
// ...
},
//...
}

In this example, the properties :field:`elements`, :field:`nelements`, and :field:`lattice_vectors` are compacted along the first dimension (`dim_frames`) using the ``constant`` format.
Since all these arrays have a size of 5 along this dimension (see value of :field:`nframes`), the client MUST interpret them as if the specified value is repeated 5 times.
On the other hand, the :field:`_exmpl_timestep` property is not compacted, since it has different values for each frame.
Moreover, the value of the :field:`cartesian_site_positions` property is omitted (with value :val:`null`, as the server deems it to be too large for a single response) and its content is instead transferred using the large property values protocol (see section `Transmission of large property values`_; for brevity we do not show here the content of the :field:`meta` field).

The value to be repeated can either be a single item (as it is the case for :field:`nelements`, to be interpreted as :val:`[2, 2, 2, 2, 2]`) or a list.
In the latter case, the whole list is repeated, as it is the case for :field:`elements` (to be interpreted as :val:`[["H","O"], ["H","O"], ["H","O"], ["H","O"], ["H","O"]]`) and the :field:`lattice_vectors` (to be interpreted as the repetition of the 3x3 matrix :val:`[[4.0, 0.0, 0.0],[0.0, 4.0, 0.0],[0.0, 0.0, 4.0]]` 5 times, i.e., a trajectory with the same lattice vectors for all 5 frames).

Other compact formats might be introduced in future versions of this specification (e.g., constant values only in a range of indices, or linearly varying values).

Slices of list properties
-------------------------

Expand Down Expand Up @@ -1584,6 +1656,7 @@ Example:
"entry_types_by_format": {
"json": [
"structures",
"trajectories",
"calculations"
],
"xml": [
Expand All @@ -1592,6 +1665,7 @@ Example:
},
"available_endpoints": [
"structures",
"trajectories",
"calculations",
"info",
"links"
Expand Down Expand Up @@ -2038,7 +2112,6 @@ The following tokens are used in the filter query component:
- :property:`_exmpl_formula_sum` (a property specific to that database)
- :property:`_exmpl_band_gap`
- :property:`_exmpl_supercell`
- :property:`_exmpl_trajectory`
- :property:`_exmpl_workflow_id`

- **Nested property names** A nested property name is composed of at least two identifiers separated by periods (``.``).
Expand Down Expand Up @@ -2447,6 +2520,43 @@ A Property Definition MUST be composed according to the combination of the requi
Note: OPTIMADE Property Definitions use this field, and MUST NOT use the JSON Schema validating fields minItems and maxItems since that would require reprocessing the schema to handle requests using the OPTIMADE features that requests partial data in lists.
Instead, the length of lists can be validated against the length information provided in the :field:`sizes` subfield of :field:`x-optimade-dimensions` (which, at this time, can only specify a fixed length requirement.)

**OPTIONAL keys:**

- :field:`compactable`: List of Strings.
For each dimension, defines whether the data can be written in a compact form along that dimension.
If the value is :val:`"no"` for one given dimension, the standard rules to represent lists apply (i.e., the server CANNOT express that property using a compact format).
If the value is any other string for one given dimension (currently, only the string :val:`"constant"` is supported), the server MAY decide to express the data in the response using the compact format defined by that string, as specified in `Compact list representation`_. If it decides not to do so, then it MUST use the standard rules to represent lists.
If :field:`compactable` is provided, then a value MUST be given for each dimension.
If :field:`compactable` is not provided, then the default value is :val:`"no"` for each dimension.

For instance, for the :field:`lattice_vectors` property of an entry of type :entry:`trajectories`:

.. code:: jsonc

{
"data": {
"type": "info",
"id": "trajectories",
// ...
"properties": {
// ...
"lattice_vectors": {
"$id": "urn:uuid:81edf372-7b1b-4518-9c14-7d482bd67834",
"title": "Lattice vectors",
// ...
"x-optimade-type": "list",
"x-optimade-dimensions": {
"names": ["dim_frames", "dim_lattice", "dim_spatial"],
"sizes": [null, 3, 3] // size along dim_frames is variable, so not specified here
"compactable": ["constant", "no", "no"] // compactable (using the constant compact format) only along dim_frames
}
}
}
}
}

This means that the :field:`lattice_vectors` property MAY be expressed in a compact format along the outermost dimension (``dim_frames``) using the :val:`"constant"` compact format (but MUST be expressed as standard lists along the other two dimensions ``dim_lattice`` and ``dim_spatial``).

- :field:`x-optimade-implementation`: Dictionary.
A dictionary describing the level of OPTIMADE API functionality provided by the present implementation.
If an implementation omits this field in its response, a client interacting with that implementation SHOULD NOT make any assumptions about the availability of these features.
Expand Down Expand Up @@ -3071,6 +3181,7 @@ type
- **Examples**:

- :val:`"structures"`
- :val:`"trajectories"`

immutable\_id
~~~~~~~~~~~~~
Expand Down Expand Up @@ -3127,7 +3238,6 @@ Custom properties
- :property:`_exmpl_formula_sum`
- :property:`_exmpl_band_gap`
- :property:`_exmpl_supercell`
- :property:`_exmpl_trajectory`
- :property:`_exmpl_workflow_id`

Structures Entries
Expand Down Expand Up @@ -3898,6 +4008,162 @@ optimization\_type

- For a structure entry that encodes the structural information from a theoretical relaxation of an :val:`"experimental"` entry using computational software that implements density functional theory: :val:`"hybrid"`.


Trajectories Entries
--------------------

- **Description**: The :entry:`trajectories` entry is used to share data belonging to ordered sequences of structures such as, for example, those originating from molecular dynamics or Monte Carlo simulations.

Individual steps of trajectories are referred to as frames.

:entry:`trajectories` entries have:

- the properties described in the section `Properties Used by Multiple Entry Types`_;

- the properties `nframes`_ and `reference_frames`_, described below;

- all custom properties defined in the `Structures Entries`_ endpoint are also used for trajectories, with the following difference: each property is extended by wrapping it in a list, so that each custom property of a :entry:`structures` resource becomes a list with an additional first dimension of size `nframes`_ (with dimension name ``dim_frames``, as defined in the property definition). This allows these properties to be defined for each frame, and thus possibly change during the trajectory.

Moreover, for data-transfer efficiency reasons, all these properties have their first dimension ``dim_frames`` defined as compactable in the :field:`compactable` field of their property definition. The server MAY thus return the corresponding data using the `Compact list representation`_ format, if the property values are not changing over the trajectory.

For example, the property `lattice_vectors`_ for a trajectory with 100 frames would be a three-dimensional list of floats, where the first dimension has a size of 100 (the number of frames), and the second and third dimensions have a size of 3 (representing the lattice vectors at each frame).

Other database-specific properties MAY also be provided. These might include properties computed for all or some frames, such as the energy, the pressure or the temperature.

We stress that, in general, if any property consists of a very large amount of data (which might be a common case for trajectories), the server MAY decide to not return the data directly in the response, but using instead the large-property transfer protocol described in the section `Transmission of large property values`_.

nframes
~~~~~~~

- **Description**: The number of frames in the trajectory.
This value indicated the number of frames stored in the data, and may deviate from the number of steps used to calculate the trajectory.
For example, a 10 ps simulation with calculation steps of 1 fs where data is stored once every 50 fs, `nframes`_ will be 200.
- **Type**: integer
- **Requirements/Conventions**:

- **Support**: MUST be supported by all implementations, i.e., MUST NOT be :val:`null`.
- **Query**: MUST be a queryable property with support for all mandatory filter features.
- The integer value MUST be equal to the number of frames in the trajectory (i.e., the length of the `dim_frames` dimension).
- The integer MUST be a positive non-zero value.

- **Querying**:

- A filter that matches trajectories that have exactly 100 frames:
- :filter:`nframes=100`
- A filter that matches trajectories that have between 100 and 1000 frames:
- :filter:`nframes>=100 AND nframes<=1000`

- **Examples**:

- :val:`42`

reference_frames
~~~~~~~~~~~~~~~~

- **Description**: The indices of a set of frames that give a good but very brief overview of the trajectory.
The first reference frame could for example be a starting configuration, the second a transition state and the third the final state.
- **Type**: list of integers
- **Requirements/Conventions**: The values MUST be larger than or equal to 0 and less than :val:`nframes`.

- **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.
- **Query**: Support for queries on this property is OPTIONAL.
If supported, filters MAY support only a subset of comparison operators.

- **Examples**:

- :val:`[0, 397, 1000]`


Examples of a returned trajectory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is an example of the data field of a JSON object that could be returned after the following query:
:query-url:`http://example.com/optimade/v1/trajectories/traj00000001`

.. code:: jsonc

{
"data":{
"id": "traj00000001",
"type": "trajectories",
"attributes": {
"last_modified":"2021-07-16T18:02:03Z",
"elements": [["H","O"]],
"nelements": [2],
"elements_ratios": [[0.666667,0.333333]],
"chemical_formula_descriptive": ["H2O"],
"chemical_formula_reduced": ["H2O"],
"chemical_formula_anonymous": ["A2B"],
"dimension_types":[[0,0,0]],
"nperiodic_dimensions": [0],
"lattice_vectors" : [[[4.0,0.0,0.0],[0.0,4.0,0.0],[0.0,0.0,4.0]]],
"cartesian_site_positions" : null,
"nsites":[3],
"species_at_sites":[["O1","H1","H2"]],
"species":[[
{
"name":"O1",
"chemical_symbols":["O"],
"concentration":[1.0]
},
{
"name":"H1",
"chemical_symbols":["H"],
"concentration":[1.0]
},
{
"name":"H2",
"chemical_symbols":["H"],
"concentration":[1.0]
}
]],
"reference_frames": [0],
"nframes": 360,
"_exmpl_temperature": null,
"_exmpl_ekin": null
},
"meta":{
"partial_data_links": {
"cartesian_site_positions": [
{
"format": "jsonlines",
"link": "https://example.org/optimade/v1.2/extensions/partial_data/trajectories/traj00000001/cartesian_site_positions/jsonlines"
},{
"format": "_exmpl_xyz",
"link": "https://example.org/optimade/v1.2/extensions/partial_data/trajectories/traj00000001/cartesian_site_positions/xyz"
}
],
"_exmpl_temperature": [
{
"format": "jsonlines",
"link": "https://example.org/optimade/v1.2/extensions/partial_data/trajectories/traj00000001/temperature/jsonlines"
}
],
"_exmpl_ekin": [
{
"format": "jsonlines",
"link": "https://example.org/optimade/v1.2/extensions/partial_data/trajectories/traj00000001/ekin/jsonlines"
}
]
}
},
"relationships": {
"references": {
"data": [
{
"type": "references",
"id": "dummy/2019"
}
]
}
}
}
//...
}

Note how, in this example, several properties use the constant compact format, such as :field:`elements`, :field:`nelements`, :field:`elements_ratios`, ...
Furthermore, other properties (:field:`cartesian_site_positions`, :field:`_exmpl_temperature`, and :field:`_exmpl_ekin`) are not included directly in the response, but are instead made available via the large-property transfer protocol using the links in the :field:`partial_data_links` section of the :field:`meta` field.

Calculations Entries
--------------------

Expand Down