Skip to content

Commit

Permalink
Fix code sample indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jun 11, 2021
1 parent 38f89c5 commit 6befa79
Showing 1 changed file with 141 additions and 141 deletions.
282 changes: 141 additions & 141 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,11 @@ Every response SHOULD contain the following fields, and MUST contain at least :f
.. code:: jsonc
{
"id": "dep_chemical_formula_01",
"type": "warning",
"code": "_exmpl_dep_chemical_formula",
"title": "Deprecation Warning",
"detail": "chemical_formula is deprecated, use instead chemical_formula_hill"
"id": "dep_chemical_formula_01",
"type": "warning",
"code": "_exmpl_dep_chemical_formula",
"title": "Deprecation Warning",
"detail": "chemical_formula is deprecated, use instead chemical_formula_hill"
}
**Note**: warning :field:`id`\ s MUST NOT be trusted to identify the exceptional situations (i.e., they are not error codes, use instead the field :field:`code` for this.
Expand All @@ -535,33 +535,33 @@ Every response SHOULD contain the following fields, and MUST contain at least :f
.. code:: jsonc
{
"meta": {
"query": {
"representation": "/structures/?filter=a=1 AND b=2",
},
"api_version": "1.0.0",
"schema": "http://schema.optimade.org/openapi/v1.0/optimade.json",
"time_stamp": "2007-04-05T14:30:20Z",
"data_returned": 10,
"data_available": 10,
"more_data_available": false,
"provider": {
"name": "Example provider",
"description": "Provider used for examples, not to be assigned to a real database",
"prefix": "exmpl",
"homepage": "http://example.com"
},
"implementation": {
"name": "exmpl-optimade",
"version": "0.1.0",
"source_url": "http://git.example.com/exmpl-optimade",
"maintainer": {
"email": "admin@example.com"
},
"issue_tracker": "http://tracker.example.com/exmpl-optimade"
}
}
// ...
"meta": {
"query": {
"representation": "/structures/?filter=a=1 AND b=2",
},
"api_version": "1.0.0",
"schema": "http://schema.optimade.org/openapi/v1.0/optimade.json",
"time_stamp": "2007-04-05T14:30:20Z",
"data_returned": 10,
"data_available": 10,
"more_data_available": false,
"provider": {
"name": "Example provider",
"description": "Provider used for examples, not to be assigned to a real database",
"prefix": "exmpl",
"homepage": "http://example.com"
},
"implementation": {
"name": "exmpl-optimade",
"version": "0.1.0",
"source_url": "http://git.example.com/exmpl-optimade",
"maintainer": {
"email": "admin@example.com"
},
"issue_tracker": "http://tracker.example.com/exmpl-optimade"
}
}
// ...
}
- **data**: The schema of this value varies by endpoint, it can be either a *single* `JSON API resource object <http://jsonapi.org/format/1.0/#document-resource-objects>`__ or a *list* of JSON API resource objects.
Expand Down Expand Up @@ -631,44 +631,44 @@ An example of a full response:
{
"links": {
"next": null,
"base_url": {
"href": "http://example.com/optimade",
"meta": {
"_exmpl_db_version": "3.2.1"
}
}
"next": null,
"base_url": {
"href": "http://example.com/optimade",
"meta": {
"_exmpl_db_version": "3.2.1"
}
}
},
"meta": {
"query": {
"representation": "/structures?filter=a=1 AND b=2"
},
"api_version": "1.0.0",
"time_stamp": "2007-04-05T14:30:20Z",
"data_returned": 10,
"data_available": 10,
"last_id": "xy10",
"more_data_available": false,
"provider": {
"name": "Example provider",
"description": "Provider used for examples, not to be assigned to a real database",
"prefix": "exmpl",
"homepage": {
"href": "http://example.com",
"meta": {
"_exmpl_title": "This is an example site"
}
}
},
"response_message": "OK"
// <OPTIONAL implementation- or database-provider-specific metadata, global to the query>
"query": {
"representation": "/structures?filter=a=1 AND b=2"
},
"api_version": "1.0.0",
"time_stamp": "2007-04-05T14:30:20Z",
"data_returned": 10,
"data_available": 10,
"last_id": "xy10",
"more_data_available": false,
"provider": {
"name": "Example provider",
"description": "Provider used for examples, not to be assigned to a real database",
"prefix": "exmpl",
"homepage": {
"href": "http://example.com",
"meta": {
"_exmpl_title": "This is an example site"
}
}
},
"response_message": "OK"
// <OPTIONAL implementation- or database-provider-specific metadata, global to the query>
},
"data": [
// ...
],
"included": [
// ...
],
"data": [
// ...
],
"included": [
// ...
],
}
HTTP Response Status Codes
Expand Down Expand Up @@ -900,27 +900,27 @@ Example:
{
"data": [
{
"type": "structures",
"id": "example.db:structs:0001",
"attributes": {
"chemical_formula_descriptive": "Es2 O3",
"url": "http://example.db/structs/0001",
"immutable_id": "http://example.db/structs/0001@123",
"last_modified": "2007-04-05T14:30:20Z"
}
},
{
"type": "structures",
"id": "example.db:structs:1234",
"attributes": {
"chemical_formula_descriptive": "Es2",
"url": "http://example.db/structs/1234",
"immutable_id": "http://example.db/structs/1234@123",
"last_modified": "2007-04-07T12:02:20Z"
}
}
// ...
{
"type": "structures",
"id": "example.db:structs:0001",
"attributes": {
"chemical_formula_descriptive": "Es2 O3",
"url": "http://example.db/structs/0001",
"immutable_id": "http://example.db/structs/0001@123",
"last_modified": "2007-04-05T14:30:20Z"
}
},
{
"type": "structures",
"id": "example.db:structs:1234",
"attributes": {
"chemical_formula_descriptive": "Es2",
"url": "http://example.db/structs/1234",
"immutable_id": "http://example.db/structs/1234@123",
"last_modified": "2007-04-07T12:02:20Z"
}
}
// ...
]
// ...
}
Expand Down Expand Up @@ -961,20 +961,20 @@ Example:
{
"data": {
"type": "structures",
"id": "example.db:structs:1234",
"attributes": {
"chemical_formula_descriptive": "Es2",
"url": "http://example.db/structs/1234",
"immutable_id": "http://example.db/structs/1234@123",
"last_modified": "2007-04-07T12:02:20Z"
}
"type": "structures",
"id": "example.db:structs:1234",
"attributes": {
"chemical_formula_descriptive": "Es2",
"url": "http://example.db/structs/1234",
"immutable_id": "http://example.db/structs/1234@123",
"last_modified": "2007-04-07T12:02:20Z"
}
},
"meta": {
"query": {
"representation": "/structures/example.db:structs:1234?"
}
// ...
"query": {
"representation": "/structures/example.db:structs:1234?"
}
// ...
}
// ...
}
Expand Down Expand Up @@ -2165,7 +2165,7 @@ species
Elements denoting vacancies MUST have masses equal to 0.
- **original\_name**: OPTIONAL. Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database.
Note: With regards to "source database", we refer to the immediate source being queried via the OPTIMADE API implementation.
The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`_).
The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`_).

- For systems that have only species formed by a single chemical symbol, and that have at most one species per chemical symbol, SHOULD use the chemical symbol as species name (e.g., :val:`"Ti"` for titanium, :val:`"O"` for oxygen, etc.)
However, note that this is OPTIONAL, and client implementations MUST NOT assume that the key corresponds to a chemical symbol, nor assume that if the species name is a valid chemical symbol, that it represents a species with that chemical symbol.
Expand Down Expand Up @@ -2233,40 +2233,40 @@ assemblies

.. code:: jsonc
{
"cartesian_site_positions": [[0,0,0]],
"species_at_sites": ["SiGe-vac"],
"species": [
{
"name": "SiGe-vac",
"chemical_symbols": ["Si", "Ge", "vacancy"],
"concentration": [0.3, 0.5, 0.2]
}
]
// ...
}
{
"cartesian_site_positions": [[0,0,0]],
"species_at_sites": ["SiGe-vac"],
"species": [
{
"name": "SiGe-vac",
"chemical_symbols": ["Si", "Ge", "vacancy"],
"concentration": [0.3, 0.5, 0.2]
}
]
// ...
}


- Using multiple species and the assemblies:

.. code:: jsonc
{
"cartesian_site_positions": [ [0,0,0], [0,0,0], [0,0,0] ],
"species_at_sites": ["Si", "Ge", "vac"],
"species": [
{ "name": "Si", "chemical_symbols": ["Si"], "concentration": [1.0] },
{ "name": "Ge", "chemical_symbols": ["Ge"], "concentration": [1.0] },
{ "name": "vac", "chemical_symbols": ["vacancy"], "concentration": [1.0] }
],
"assemblies": [
{
"sites_in_groups": [ [0], [1], [2] ],
"group_probabilities": [0.3, 0.5, 0.2]
}
]
// ...
}
{
"cartesian_site_positions": [ [0,0,0], [0,0,0], [0,0,0] ],
"species_at_sites": ["Si", "Ge", "vac"],
"species": [
{ "name": "Si", "chemical_symbols": ["Si"], "concentration": [1.0] },
{ "name": "Ge", "chemical_symbols": ["Ge"], "concentration": [1.0] },
{ "name": "vac", "chemical_symbols": ["vacancy"], "concentration": [1.0] }
],
"assemblies": [
{
"sites_in_groups": [ [0], [1], [2] ],
"group_probabilities": [0.3, 0.5, 0.2]
}
]
// ...
}

- It is up to the database provider to decide which representation to use, typically depending on the internal format in which the structure is stored.
However, given a structure identified by a unique ID, the API implementation MUST always provide the same representation for it.
Expand All @@ -2275,18 +2275,18 @@ assemblies

.. code:: jsonc
{
"assemblies": [
{
"sites_in_groups": [ [0], [1] ],
"group_probabilities": [0.2, 0.8],
},
{
"sites_in_groups": [ [2], [3] ],
"group_probabilities": [0.3, 0.7]
}
]
}
{
"assemblies": [
{
"sites_in_groups": [ [0], [1] ],
"group_probabilities": [0.2, 0.8],
},
{
"sites_in_groups": [ [2], [3] ],
"group_probabilities": [0.3, 0.7]
}
]
}

Site 0 is present with a probability of 20 % and site 1 with a probability of 80 %. These two sites are correlated (either site 0 or 1 is present). Similarly, site 2 is present with a probability of 30 % and site 3 with a probability of 70 %.
These two sites are correlated (either site 2 or 3 is present).
Expand Down

0 comments on commit 6befa79

Please sign in to comment.