pymatgen¶
Convert an OPTIMADE structure, in the format of
StructureResource
to a pymatgen Molecule
or Structure
object.
This conversion function relies on the pymatgen package.
For more information on the pymatgen code see their documentation.
from_pymatgen(pmg_structure)
¶
Convert a pymatgen Structure
(3D) into an OPTIMADE StructureResourceAttributes
model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pmg_structure |
Structure
|
The pymatgen |
required |
Returns:
Type | Description |
---|---|
StructureResourceAttributes
|
An OPTIMADE |
Source code in optimade/adapters/structures/pymatgen.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
get_pymatgen(optimade_structure)
¶
Get pymatgen Structure
or Molecule
from OPTIMADE structure.
This function will return either a pymatgen Structure
or Molecule
based
on the periodicity or periodic dimensionality of OPTIMADE structure.
For bulk, three-dimensional structures, a pymatgen Structure
is returned.
This means, if the dimension_types
attribute is comprised of all 1
s (or Periodicity.PERIODIC
s).
Otherwise, a pymatgen Molecule
is returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
optimade_structure |
OptimadeStructure
|
OPTIMADE structure. |
required |
Returns:
Type | Description |
---|---|
Union[Structure, Molecule]
|
A pymatgen |
Union[Structure, Molecule]
|
OPTIMADE structure. |
Source code in optimade/adapters/structures/pymatgen.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|