occ
Loading...
Searching...
No Matches
occ::crystal::AsymmetricUnit Struct Reference

A class representing an asymmetric unit of a crystal structure. More...

#include <asymmetric_unit.h>

Public Member Functions

 AsymmetricUnit ()
 Constructs an empty asymmetric unit.
 
 AsymmetricUnit (const Mat3N &positions, const IVec &atomic_numbers)
 Constructs an asymmetric unit from the given positions and atomic numbers.
 
 AsymmetricUnit (const Mat3N &positions, const IVec &atomic_numbers, const std::vector< std::string > &labels)
 Constructs an asymmetric unit from the given positions, atomic numbers, and labels.
 
std::string chemical_formula () const
 Returns the chemical formula of the asymmetric unit.
 
Vec covalent_radii () const
 Returns the covalent radii of the atoms in the asymmetric unit.
 
Vec vdw_radii () const
 Returns the van der Waals radii of the atoms in the asymmetric unit.
 
void generate_default_labels ()
 Generates default labels for the atoms in the unit cell.
 
size_t size () const
 Returns the number of atoms in the unit cell.
 
void resize (Eigen::Index n)
 Resize every member to hold n atoms.
 
bool is_consistent () const
 Whether every member is sized consistently with the atom count.
 
void ensure_consistent ()
 Give any inconsistently sized member its default, sized to the atom count.
 

Public Attributes

Mat3N positions
 The positions of the atoms in the unit cell, expressed as a matrix of size (3, n), where n is the number of atoms.
 
IVec atomic_numbers
 The atomic numbers of the atoms in the unit cell, expressed as a vector of size n.
 
Vec occupations
 The occupations of the atoms in the unit cell, expressed as a vector of size n.
 
Vec charges
 The charges of the atoms in the unit cell, expressed as a vector of size n.
 
Mat6N adps
 The anisotropic displacement parameters of the atoms in the unit cell, expressed as a (6, N) matrix matrix of columns of (u11, u22, u33, u12, u13, u23)
 
std::vector< std::string > labels
 The labels of the atoms in the unit cell, expressed as a vector of strings of size n.
 

Detailed Description

A class representing an asymmetric unit of a crystal structure.

An asymmetric unit is a building block of a crystal lattice, and it contains a set of atoms with their positions, atomic numbers, occupations, charges, and labels.

Constructor & Destructor Documentation

◆ AsymmetricUnit() [1/3]

occ::crystal::AsymmetricUnit::AsymmetricUnit ( )
inline

Constructs an empty asymmetric unit.

◆ AsymmetricUnit() [2/3]

occ::crystal::AsymmetricUnit::AsymmetricUnit ( const Mat3N &  positions,
const IVec &  atomic_numbers 
)

Constructs an asymmetric unit from the given positions and atomic numbers.

Parameters
positionsThe positions of the atoms in the unit cell, expressed as a matrix of size (3, n), where n is the number of atoms. Each column of the matrix represents the (x, y, z) coordinates of an atom.
atomic_numbersThe atomic numbers of the atoms in the unit cell, expressed as a vector of size n.

◆ AsymmetricUnit() [3/3]

occ::crystal::AsymmetricUnit::AsymmetricUnit ( const Mat3N &  positions,
const IVec &  atomic_numbers,
const std::vector< std::string > &  labels 
)

Constructs an asymmetric unit from the given positions, atomic numbers, and labels.

Parameters
positionsThe positions of the atoms in the unit cell, expressed as a matrix of size (3, n), where n is the number of atoms. Each column of the matrix represents the (x, y, z) coordinates of an atom.
atomic_numbersThe atomic numbers of the atoms in the unit cell, expressed as a vector of size n.
labelsThe labels of the atoms in the unit cell, expressed as a vector of strings of size n. Each string represents the label of the corresponding atom.

Member Function Documentation

◆ chemical_formula()

std::string occ::crystal::AsymmetricUnit::chemical_formula ( ) const

Returns the chemical formula of the asymmetric unit.

The chemical formula is a string that represents the composition of the unit cell, using the symbols of the chemical elements. For example, "H2O" or "CuZn"

Returns
The chemical formula of the asymmetric unit.

◆ covalent_radii()

Vec occ::crystal::AsymmetricUnit::covalent_radii ( ) const

Returns the covalent radii of the atoms in the asymmetric unit.

The covalent radii of an atom is a measure of the size of its atomic nucleus, and it is typically used to calculate the distances between atoms in a molecule.

Returns
A vector of size n containing the covalent radii of the atoms in the unit cell, in the same order as their atomic numbers.

◆ ensure_consistent()

void occ::crystal::AsymmetricUnit::ensure_consistent ( )

Give any inconsistently sized member its default, sized to the atom count.

Idempotent, and a no-op when the asymmetric unit is already consistent. Because the members are public, code can build an AsymmetricUnit by default-constructing it and resizing only the members it cares about; this restores the invariant that the rest of the library relies on. Crystal calls it on construction.

Does not touch a member that is already correctly sized, so real data is never overwritten.

◆ generate_default_labels()

void occ::crystal::AsymmetricUnit::generate_default_labels ( )

Generates default labels for the atoms in the unit cell.

The default labels are assigned based on the chemical element of each atom, using the standard one- or two-letter symbol followed by a number. For example, "C1", "N2", "Fe3".

◆ is_consistent()

bool occ::crystal::AsymmetricUnit::is_consistent ( ) const

Whether every member is sized consistently with the atom count.

◆ resize()

void occ::crystal::AsymmetricUnit::resize ( Eigen::Index  n)

Resize every member to hold n atoms.

Members that carry no information of their own are given their neutral default: occupancy 1, charge 0, zero ADPs. Labels are cleared, since a meaningful default needs the atomic numbers – call generate_default_labels() after filling those in.

Prefer this over resizing positions and atomic_numbers by hand: the members are public, so a partial resize silently leaves the rest inconsistent, and consumers then index out of bounds.

◆ size()

size_t occ::crystal::AsymmetricUnit::size ( ) const
inline

Returns the number of atoms in the unit cell.

Returns
The size of the unit cell, i.e., the number of atoms it contains.

◆ vdw_radii()

Vec occ::crystal::AsymmetricUnit::vdw_radii ( ) const

Returns the van der Waals radii of the atoms in the asymmetric unit.

Returns
A vector of size n containing the van der Waals radii of the atoms in the unit cell, in the same order as their atomic numbers.

Member Data Documentation

◆ adps

Mat6N occ::crystal::AsymmetricUnit::adps

The anisotropic displacement parameters of the atoms in the unit cell, expressed as a (6, N) matrix matrix of columns of (u11, u22, u33, u12, u13, u23)

◆ atomic_numbers

IVec occ::crystal::AsymmetricUnit::atomic_numbers

The atomic numbers of the atoms in the unit cell, expressed as a vector of size n.

◆ charges

Vec occ::crystal::AsymmetricUnit::charges

The charges of the atoms in the unit cell, expressed as a vector of size n.

◆ labels

std::vector<std::string> occ::crystal::AsymmetricUnit::labels

The labels of the atoms in the unit cell, expressed as a vector of strings of size n.

Each string represents the label of the corresponding atom.

◆ occupations

Vec occ::crystal::AsymmetricUnit::occupations

The occupations of the atoms in the unit cell, expressed as a vector of size n.

◆ positions

Mat3N occ::crystal::AsymmetricUnit::positions

The positions of the atoms in the unit cell, expressed as a matrix of size (3, n), where n is the number of atoms.

Each column of the matrix represents the (x, y, z) coordinates of an atom.


The documentation for this struct was generated from the following file: