crystals.CODParser

class crystals.CODParser(num: int, revision: int | None = None, download_dir: PathLike | None = None, overwrite: bool = False, **kwargs)

Collection of methods that parses CIF files retrieved from the Crystallography Open Database. The preferred method of using this object is as a context manager.

Parameters:
  • num (int) – COD identification number.

  • revision (int or None, optional) – Revision number. If None (default), the latest revision is used.

  • download_dir (path-like object or None, optional) – Directory where to save the CIF file.

  • overwrite (bool, optional) – Whether or not to overwrite files in cache if they exist. If no revision number is provided, files will always be overwritten.

:raises RuntimeError : If the file could not be downloaded from any of the mirrors.:

__init__(num: int, revision: int | None = None, download_dir: PathLike | None = None, overwrite: bool = False, **kwargs)

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__enter__()

Return self upon entering the runtime context.

__eq__(value, /)

Return self==value.

__exit__(*args, **kwargs)

Raise any exception triggered within the runtime context.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(num[, revision, download_dir, ...])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__(C)

Abstract classes can override this to customize issubclass().

atoms()

Asymmetric unit cell.

download_cif(download_dir, num[, revision, ...])

Download a CIF file from the Crystallography Open Database.

hall_symbol()

Returns the Hall symbol

lattice_parameters()

Returns the lattice parameters associated to a CIF structure.

lattice_vectors()

Returns the lattice vectors associated to a CIF structure.

sym_ops_from_equiv(equiv_site)

Parse a symmetry operator from an equivalent-site representation

symmetry_operators()

Returns the symmetry operators that map the fractional atomic positions in a CIF file to the crystal conventional unit cell.

Attributes

__abstractmethods__

__annotations__

__class_getitem__

__slots__

_abc_impl

filename

mirrors

structure_block

Retrieve which CIF block has the appropriate structural information