io
File I/O functions for Crystal structures.
All loaders and savers are implemented as standalone functions. Loaders return Crystal instances; savers accept a crystal as first argument.
from_aims_file(filename, **kwargs)
from_aims_string(string, **kwargs)
Initialize a crystal structure from an FHI-aims geometry.in string
Source code in chmpy/crystal/io.py
from_cif_data(cif_data, titl=None)
Initialize a crystal structure from a dictionary of CIF data
Source code in chmpy/crystal/io.py
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
from_cif_file(filename, data_block_name=None, options=None)
Initialize a crystal structure from a CIF file
options is a :class:chmpy.fmt.cif.CifOptions, for the rare file that
needs reading in a way other than plain CIF 1.1.
Source code in chmpy/crystal/io.py
from_cif_string(file_content, data_block_name=None, options=None, **kwargs)
Initialize a crystal structure from the contents of a CIF
options is a :class:chmpy.fmt.cif.CifOptions, for the rare file that
needs reading in a way other than plain CIF 1.1.
Source code in chmpy/crystal/io.py
from_shelx_file(filename, **kwargs)
Initialize a crystal structure from a shelx .res file
from_shelx_string(file_content, **kwargs)
Initialize a crystal structure from a shelx .res string
Source code in chmpy/crystal/io.py
from_vasp_file(filename, **kwargs)
from_vasp_string(string, **kwargs)
Initialize a crystal structure from a VASP POSCAR string
Source code in chmpy/crystal/io.py
load(filename, **kwargs)
Load a crystal structure from file (.res, .cif)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
the path to the crystal structure file |
required |
Returns:
| Type | Description |
|---|---|
Crystal | dict
|
the resulting crystal structure or dictionary of crystal structures |
Source code in chmpy/crystal/io.py
save(crystal, filename, **kwargs)
Save a crystal structure to file (.cif, .res, POSCAR)
Source code in chmpy/crystal/io.py
to_cif_data(crystal, data_block_name=None, source_data=True)
Convert a crystal structure to CIF data.
The crystal is the source of truth for the cell, the symmetry and the atom sites: these are always written from its current state, so a structure altered since it was read is written as it is now, not as it was on disk.
When the crystal was read from a CIF, the parts of that file which are
not about the structure -- bibliography, chemical identity, experimental
and refinement details -- are carried through unchanged, along with any
extra per-site column that still has one value per site. Pass
source_data=False for just the structure.
Source code in chmpy/crystal/io.py
to_cif_file(crystal, filename, **kwargs)
to_cif_string(crystal, **kwargs)
to_pdb_file(crystal, filename, header=None)
to_pdb_string(crystal, header=None)
Represent a crystal structure as a PDB formatted string.
to_poscar_file(crystal, filename, **kwargs)
to_poscar_string(crystal, **kwargs)
to_shelx_file(crystal, filename)
to_shelx_string(crystal, titl=None)
Represent a crystal structure as a shelx .res formatted string