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
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 186 187 188 189 190 191 192 193 194 |
|
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 structures that are periodic in one or more dimensions, a pymatgen Structure
is returned when valid lattice_vectors are given.
This means, if the any of the values in the dimension_types
attribute is 1
s or if nperiodic_dimesions
> 0.
Otherwise, a pymatgen Molecule
is returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
optimade_structure
|
StructureResource
|
OPTIMADE structure. |
required |
Returns:
Type | Description |
---|---|
Structure | Molecule
|
A pymatgen |
Structure | Molecule
|
OPTIMADE structure. |
Source code in optimade/adapters/structures/pymatgen.py
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 66 67 68 69 70 71 |
|