Loading...
Searching...
No Matches
OBUnitCell Class Reference

`#include <openbabel/generic.h>`

Inheritance diagram for OBUnitCell:
[legend]

## Public Types

enum | LatticeType { Undefined , Triclinic , Monoclinic , Orthorhombic , Tetragonal , Rhombohedral , Hexagonal , Cubic }

## Public Member Functions

| OBUnitCell ()
| OBUnitCell (const OBUnitCell &)
virtual OBGenericData * | Clone (OBBase *) const
| ~OBUnitCell ()
OBUnitCell & | operator= (const OBUnitCell &)
void | SetData (const double a, const double b, const double c, const double alpha, const double beta, const double gamma)
void | SetData (const vector3 v1, const vector3 v2, const vector3 v3)
void | SetData (const matrix3x3 m)
void | SetOffset (const vector3 v1)
void | SetSpaceGroup (const SpaceGroup *sg)
void | SetSpaceGroup (const std::string sg)
void | SetSpaceGroup (const int sg)
void | SetLatticeType (const LatticeType lt)
void | FillUnitCell (OBMol *)
double | GetA ()
double | GetA () const
double | GetB ()
double | GetB () const
double | GetC ()
double | GetC () const
double | GetAlpha ()
double | GetAlpha () const
double | GetBeta ()
double | GetBeta () const
double | GetGamma ()
double | GetGamma () const
vector3 | GetOffset ()
vector3 | GetOffset () const
const SpaceGroup * | GetSpaceGroup ()
const SpaceGroup * | GetSpaceGroup () const
const std::string | GetSpaceGroupName ()
const std::string | GetSpaceGroupName () const
LatticeType | GetLatticeType (int spacegroup)
LatticeType | GetLatticeType (int spacegroup) const
LatticeType | GetLatticeType ()
LatticeType | GetLatticeType () const
std::vector< vector3 > | GetCellVectors ()
std::vector< vector3 > | GetCellVectors () const
matrix3x3 | GetCellMatrix ()
matrix3x3 | GetCellMatrix () const
matrix3x3 | GetOrthoMatrix ()
matrix3x3 | GetOrthoMatrix () const
matrix3x3 | GetOrientationMatrix ()
matrix3x3 | GetOrientationMatrix () const
matrix3x3 | GetFractionalMatrix ()
matrix3x3 | GetFractionalMatrix () const
vector3 | FractionalToCartesian (vector3 frac)
vector3 | FractionalToCartesian (vector3 frac) const
vector3 | CartesianToFractional (vector3 cart)
vector3 | CartesianToFractional (vector3 cart) const
vector3 | WrapCartesianCoordinate (vector3 cart)
vector3 | WrapCartesianCoordinate (vector3 cart) const
vector3 | WrapFractionalCoordinate (vector3 frac)
vector3 | WrapFractionalCoordinate (vector3 frac) const
vector3 | UnwrapCartesianNear (vector3 new_loc, vector3 ref_loc)
vector3 | UnwrapCartesianNear (vector3 new_loc, vector3 ref_loc) const
vector3 | UnwrapFractionalNear (vector3 new_loc, vector3 ref_loc)
vector3 | UnwrapFractionalNear (vector3 new_loc, vector3 ref_loc) const
vector3 | MinimumImageCartesian (vector3 cart)
vector3 | MinimumImageCartesian (vector3 cart) const
vector3 | MinimumImageFractional (vector3 frac)
vector3 | MinimumImageFractional (vector3 frac) const
int | GetSpaceGroupNumber (std::string name="")
int | GetSpaceGroupNumber (std::string name="") const
double | GetCellVolume ()
double | GetCellVolume () const
void | SetAttribute (const std::string &v)
void | SetOrigin (const DataOrigin s)
virtual const std::string & | GetAttribute () const
unsigned int | GetDataType () const
virtual const std::string & | GetValue () const
virtual DataOrigin | GetOrigin () const

## Protected Attributes

matrix3x3 | _mOrtho
matrix3x3 | _mOrient
vector3 | _offset
std::string | _spaceGroupName
const SpaceGroup * | _spaceGroup
LatticeType | _lattice
std::string | _attr
unsigned int | _type
DataOrigin | _source

## Detailed Description

Used for storing information about periodic boundary conditions with conversion to/from translation vectors and (a, b, c, alpha, beta, gamma).

## Member Enumeration Documentation

## LatticeType

enum LatticeType

Enumerator
Undefined |
Triclinic |
Monoclinic |
Orthorhombic |
Tetragonal |
Rhombohedral | also called trigonal
Hexagonal |
Cubic |

## Constructor & Destructor Documentation

## OBUnitCell() [1/2]

OBUnitCell | ( |  | ) |

public constructor

Referenced by Clone(), OBUnitCell(), and operator=().

## OBUnitCell() [2/2]

OBUnitCell | ( | const OBUnitCell & | src | ) |

## ~OBUnitCell()

~OBUnitCell | ( |  | ) |

inline

## Member Function Documentation

## Clone()

virtual OBGenericData * Clone | ( | OBBase * |  | ) | const

inline virtual

Reimplemented from OBGenericData.

Referenced by OBMol::CopySubstructure().

## operator=()

OBUnitCell & operator= | ( | const OBUnitCell & | src | ) |

## SetData() [1/3]

void SetData | ( | const double | a,
|  | const double | b,
|  | const double | c,
|  | const double | alpha,
|  | const double | beta,
|  | const double | gamma )

Constructs the cell matrix in lower triangular form from the values supplied.

Implements blue-obelisk:calculateOrthogonalisationMatrix.

Parameters

  a | The length a
  b | The length b
  c | The length c
  alpha | The angle alpha
  beta | The angle beta
  gamma | The angle gamma

Referenced by SetData().

## SetData() [2/3]

void SetData | ( | const vector3 | v1,
|  | const vector3 | v2,
|  | const vector3 | v3 )

Constructs the cell matrix using the supplied row vectors.

Implements blue-obelisk:calculateOrthogonalisationMatrix.

Parameters

  v1 | The x-vector
  v2 | The y-vector
  v3 | The z-vector

See also
  OBUnitCell::GetCellVectors

## SetData() [3/3]

void SetData | ( | const matrix3x3 | m | ) |

Sets the unit cell matrix.

Implements blue-obelisk:calculateOrthogonalisationMatrix.

Parameters

  m | The unit cell matrix (row vectors)

See also
  OBUnitCell::GetCellMatrix

## SetOffset()

void SetOffset | ( | const vector3 | v1 | ) |

Set the offset to the origin to `v1`.

## SetSpaceGroup() [1/3]

void SetSpaceGroup | ( | const SpaceGroup * | sg | ) |

inline

Set the space group for this unit cell. Does not create an OBSymmetryData entry

Referenced by FillUnitCell().

## SetSpaceGroup() [2/3]

void SetSpaceGroup | ( | const std::string | sg | ) |

inline

Set the space group symbol for this unit cell. Does not create an OBSymmetryData entry or attempt to convert between different symbol notations

## SetSpaceGroup() [3/3]

void SetSpaceGroup | ( | const int | sg | ) |

inline

Set the space group for this unit cell. Each spacegroup-symbol has a numeric equivalent which is easier to use to convert between notations. Does not create an OBSymmetryData entry or attempt to convert between different symbol notations

## SetLatticeType()

void SetLatticeType | ( | const LatticeType | lt | ) |

inline

Set the Bravais lattice type for this unit cell.

## FillUnitCell()

void FillUnitCell | ( | OBMol * | mol | ) |

Duplicate symmetry-unique atoms to fill out the unit cell of the molecule, based on the known space group

## GetA() [1/2]

double GetA | ( |  | ) |

Todo
  Remove nonconst overloads in OBUnitCell on next version bump

Returns
  vector a

Referenced by GetA(), and GetLatticeType().

## GetA() [2/2]

double GetA | ( |  | ) | const

## GetB() [1/2]

double GetB | ( |  | ) |

Returns
  vector b

Referenced by GetB(), and GetLatticeType().

## GetB() [2/2]

double GetB | ( |  | ) | const

## GetC() [1/2]

double GetC | ( |  | ) |

Returns
  vector c

Referenced by GetC(), and GetLatticeType().

## GetC() [2/2]

double GetC | ( |  | ) | const

## GetAlpha() [1/2]

double GetAlpha | ( |  | ) |

Returns
  angle alpha

Referenced by GetAlpha(), and GetLatticeType().

## GetAlpha() [2/2]

double GetAlpha | ( |  | ) | const

## GetBeta() [1/2]

double GetBeta | ( |  | ) |

Returns
  angle beta

Referenced by GetBeta(), and GetLatticeType().

## GetBeta() [2/2]

double GetBeta | ( |  | ) | const

## GetGamma() [1/2]

double GetGamma | ( |  | ) |

Returns
  angle gamma

Referenced by GetGamma(), and GetLatticeType().

## GetGamma() [2/2]

double GetGamma | ( |  | ) | const

## GetOffset() [1/2]

vector3 GetOffset | ( |  | ) |

Returns
  any offset in the origin of the periodic boundaries

Referenced by GetOffset().

## GetOffset() [2/2]

vector3 GetOffset | ( |  | ) | const

## GetSpaceGroup() [1/2]

const SpaceGroup * GetSpaceGroup | ( |  | ) |

inline

Returns
  the text representation of the space group for this unit cell

Referenced by FillUnitCell().

## GetSpaceGroup() [2/2]

const SpaceGroup * GetSpaceGroup | ( |  | ) | const

inline

## GetSpaceGroupName() [1/2]

const std::string GetSpaceGroupName | ( |  | ) |

inline

Returns
  the text representation of the space group for this unit cell

## GetSpaceGroupName() [2/2]

const std::string GetSpaceGroupName | ( |  | ) | const

inline

## GetLatticeType() [1/4]

LatticeType GetLatticeType | ( | int | spacegroup | ) |

Returns
  lattice type (based on the `spacegroup`)

Referenced by GetLatticeType(), and GetLatticeType().

## GetLatticeType() [2/4]

OBUnitCell::LatticeType GetLatticeType | ( | int | spacegroup | ) | const

## GetLatticeType() [3/4]

LatticeType GetLatticeType | ( |  | ) |

Returns
  lattice type (based on angles and distances)

Referenced by GetLatticeType().

## GetLatticeType() [4/4]

OBUnitCell::LatticeType GetLatticeType | ( |  | ) | const

## GetCellVectors() [1/2]

std::vector< vector3 > GetCellVectors | ( |  | ) |

Returns
  v1, v2, v3 cell vectors

Referenced by GetCellVectors().

## GetCellVectors() [2/2]

vector< vector3 > GetCellVectors | ( |  | ) | const

Implements blue-obelisk:convertNotionalIntoCartesianCoordinates.

## GetCellMatrix() [1/2]

matrix3x3 GetCellMatrix | ( |  | ) |

Access to the cell matrix as row vectors, useful for writing input files. Equivalent to the transpose of GetOrientationMatrix() * GetOrthoMatrix()

Returns
  The cell matrix with row vectors.

See also
  OBUnitCell::GetOrthoMatrix
  OBUnitCell::GetFractionalMatrix
  OBUnitCell::GetOrientationMatrix
  OBUnitCell::FractionalToCartesian
  OBUnitCell::CartesianToFractional

Referenced by GetCellMatrix(), GetCellVectors(), and GetCellVolume().

## GetCellMatrix() [2/2]

matrix3x3 GetCellMatrix | ( |  | ) | const

## GetOrthoMatrix() [1/2]

matrix3x3 GetOrthoMatrix | ( |  | ) |

Returns
  The orthogonalization matrix, used for converting from fractional to Cartesian coords.

See also
  OBUnitCell::GetCellMatrix
  OBUnitCell::GetFractionalMatrix
  OBUnitCell::GetOrientationMatrix
  OBUnitCell::FractionalToCartesian
  OBUnitCell::CartesianToFractional

Referenced by GetOrthoMatrix().

## GetOrthoMatrix() [2/2]

matrix3x3 GetOrthoMatrix | ( |  | ) | const

## GetOrientationMatrix() [1/2]

matrix3x3 GetOrientationMatrix | ( |  | ) |

Used to convert fractional and cartesian coordinates if the cell is not oriented in standard form (a parallel to x axis, b in xy plane)

Returns
  The orientation matrix

See also
  OBUnitCell::GetOrthoMatrix
  OBUnitCell::GetCellMatrix
  OBUnitCell::GetFractionalMatrix
  OBUnitCell::FractionalToCartesian
  OBUnitCell::CartesianToFractional

Referenced by GetOrientationMatrix().

## GetOrientationMatrix() [2/2]

matrix3x3 GetOrientationMatrix | ( |  | ) | const

## GetFractionalMatrix() [1/2]

matrix3x3 GetFractionalMatrix | ( |  | ) |

Returns
  The fractionalization matrix, used for converting from Cartesian to fractional coords.

See also
  OBUnitCell::GetOrthoMatrix
  OBUnitCell::GetCellMatrix
  OBUnitCell::GetOrientationMatrix
  OBUnitCell::FractionalToCartesian
  OBUnitCell::CartesianToFractional

Referenced by GetFractionalMatrix().

## GetFractionalMatrix() [2/2]

matrix3x3 GetFractionalMatrix | ( |  | ) | const

## FractionalToCartesian() [1/2]

vector3 FractionalToCartesian | ( | vector3 | frac | ) |

Convenience function to convert fractional coordinates to cartesian coordinates. Returns

GetOrientationMatrix() * GetOrthoMatrix() * frac + GetOffset()

Parameters

  frac | Vector of fractional coordinates

Returns
  Cartesian coordinates

Referenced by FillUnitCell(), FractionalToCartesian(), MinimumImageCartesian(), and WrapCartesianCoordinate().

## FractionalToCartesian() [2/2]

vector3 FractionalToCartesian | ( | vector3 | frac | ) | const

## CartesianToFractional() [1/2]

vector3 CartesianToFractional | ( | vector3 | cart | ) |

Convenience function to convert cartesian coordinates to fractional coordinates. Returns

GetFractionalMatrix() * GetOrientationMatrix().inverse() * (cart - GetOffset())

Parameters

  cart | Vector of cartesian coordinates

Returns
  Fractional coordinates

Referenced by CartesianToFractional(), FillUnitCell(), MinimumImageCartesian(), and WrapCartesianCoordinate().

## CartesianToFractional() [2/2]

vector3 CartesianToFractional | ( | vector3 | cart | ) | const

## WrapCartesianCoordinate() [1/2]

vector3 WrapCartesianCoordinate | ( | vector3 | cart | ) |

Wraps cartesian coordinate to fall within the unit cell.

Parameters

  cart | Vector of cartesian coordinates

Returns
  Cartesian coordinates within cell boundaries.

Referenced by WrapCartesianCoordinate().

## WrapCartesianCoordinate() [2/2]

vector3 WrapCartesianCoordinate | ( | vector3 | cart | ) | const

## WrapFractionalCoordinate() [1/2]

vector3 WrapFractionalCoordinate | ( | vector3 | frac | ) |

Wraps fractional coordinate to fall within the unit cell.

Parameters

  frac | Vector of fractional coordinates

Returns
  Fractional coordinates within cell boundaries (between 0 and 1).

Todo
  Make OBUnitCell::WrapFractionalCoordinate static in the next ABI break

Referenced by FillUnitCell(), WrapCartesianCoordinate(), and WrapFractionalCoordinate().

## WrapFractionalCoordinate() [2/2]

vector3 WrapFractionalCoordinate | ( | vector3 | frac | ) | const

## UnwrapCartesianNear() [1/2]

vector3 UnwrapCartesianNear | ( | vector3 | new_loc,
|  | vector3 | ref_loc )

Unwraps Cartesian coordinates near a reference location

Parameters

  new_loc | Cartesian coordinates of target
  ref_loc | Cartesian coordinates of the reference location

Returns
  Unwrapped coordinates of new_loc near ref_loc

Referenced by OBMol::GetTorsion(), and UnwrapCartesianNear().

## UnwrapCartesianNear() [2/2]

vector3 UnwrapCartesianNear | ( | vector3 | new_loc,
|  | vector3 | ref_loc ) const

## UnwrapFractionalNear() [1/2]

vector3 UnwrapFractionalNear | ( | vector3 | new_loc,
|  | vector3 | ref_loc )

Unwraps fractional coordinates near a reference location.

Parameters

  new_loc | Fractional coordinates of target
  ref_loc | Fractional coordinates of the reference location

Returns
  Unwrapped coordinates of new_loc near ref_loc

Todo
  Add a simple test case/example, like unwrapNear(<0.9, 0.2, 0.2>, <0.3, 0.9, 0.2>) -> <-0.1, 1.2, 0.2>

Referenced by UnwrapFractionalNear().

## UnwrapFractionalNear() [2/2]

vector3 UnwrapFractionalNear | ( | vector3 | new_loc,
|  | vector3 | ref_loc ) const

## MinimumImageCartesian() [1/2]

vector3 MinimumImageCartesian | ( | vector3 | cart | ) |

Applies the minimum image convention to a Cartesian displacement vector

Parameters

  cart | Displacement vector between two atoms in Cartesian coordinates

Returns
  Cartesian difference, wrapped within half the unit cell

Referenced by OBMol::ConnectTheDots(), OBAtom::GetAngle(), OBAtom::GetDistance(), OBBond::GetLength(), MinimumImageCartesian(), and UnwrapCartesianNear().

## MinimumImageCartesian() [2/2]

vector3 MinimumImageCartesian | ( | vector3 | cart | ) | const

## MinimumImageFractional() [1/2]

vector3 MinimumImageFractional | ( | vector3 | frac | ) |

Applies the minimum image convention to a fractional displacement vector

Parameters

  cart | Displacement vector between two atoms in fractional coordinates

Returns
  Fractional difference, wrapped within half the unit cell (-0.5 to 0.5)

Referenced by MinimumImageCartesian(), MinimumImageFractional(), and UnwrapFractionalNear().

## MinimumImageFractional() [2/2]

vector3 MinimumImageFractional | ( | vector3 | frac | ) | const

## GetSpaceGroupNumber() [1/2]

int GetSpaceGroupNumber | ( | std::string | name = "" | ) |

Returns
  The numeric value of the given spacegroup

Referenced by GetSpaceGroupNumber().

## GetSpaceGroupNumber() [2/2]

int GetSpaceGroupNumber | ( | std::string | name = "" | ) | const

## GetCellVolume() [1/2]

double GetCellVolume | ( |  | ) |

Returns
  The cell volume (in Angstroms^3)

Referenced by GetCellVolume().

## GetCellVolume() [2/2]

double GetCellVolume | ( |  | ) | const

## SetAttribute()

void SetAttribute | ( | const std::string & | v | ) |

inline inherited

Set the attribute (key), which can be used to retrieve this data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), AliasData::Expand(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBForceField::GetAtomTypes(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## SetOrigin()

void SetOrigin | ( | const DataOrigin | s | ) |

inline inherited

Set the origin of this data, which can be used to filter the data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

## GetAttribute()

virtual const std::string & GetAttribute | ( |  | ) | const

inline virtual inherited

Returns
  The attribute (key), which can be used to retrieve this data

Referenced by OBMoleculeFormat::MakeCombinedMolecule().

## GetDataType()

unsigned int GetDataType | ( |  | ) | const

inline inherited

Returns
  the data type for this object as defined in OBGenericDataType

## GetValue()

virtual const std::string & GetValue | ( |  | ) | const

inline virtual inherited

Base class returns a default value (the attribute type) but should never be called.

Reimplemented in OBCommentData, and OBPairData.

Referenced by OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), and OBDescriptor::GetValues().

## GetOrigin()

virtual DataOrigin GetOrigin | ( |  | ) | const

inline virtual inherited

## Member Data Documentation

## _mOrtho

matrix3x3 _mOrtho

protected

Referenced by CartesianToFractional(), FractionalToCartesian(), GetA(), GetAlpha(), GetB(), GetBeta(), GetC(), GetCellMatrix(), GetFractionalMatrix(), GetGamma(), GetOrthoMatrix(), OBUnitCell(), OBUnitCell(), operator=(), SetData(), and SetData().

## _mOrient

matrix3x3 _mOrient

protected

Referenced by CartesianToFractional(), FractionalToCartesian(), GetCellMatrix(), GetOrientationMatrix(), OBUnitCell(), OBUnitCell(), operator=(), SetData(), and SetData().

## _offset

vector3 _offset

protected

Referenced by CartesianToFractional(), FractionalToCartesian(), GetOffset(), OBUnitCell(), OBUnitCell(), operator=(), and SetOffset().

## _spaceGroupName

std::string _spaceGroupName

protected

Referenced by GetSpaceGroupName(), GetSpaceGroupName(), GetSpaceGroupNumber(), OBUnitCell(), OBUnitCell(), operator=(), SetData(), SetData(), and SetSpaceGroup().

## _spaceGroup

const SpaceGroup* _spaceGroup

protected

Referenced by GetLatticeType(), GetLatticeType(), GetSpaceGroup(), GetSpaceGroup(), GetSpaceGroupNumber(), OBUnitCell(), OBUnitCell(), operator=(), SetData(), SetData(), SetSpaceGroup(), SetSpaceGroup(), and SetSpaceGroup().

## _lattice

LatticeType _lattice

protected

Referenced by GetLatticeType(), OBUnitCell(), OBUnitCell(), operator=(), SetData(), SetData(), and SetLatticeType().

## _attr

std::string _attr

protected inherited

attribute tag (e.g., "UnitCell", "Comment" or "Author")

Referenced by OBRotamerList::Clone(), GetAttribute(), GetValue(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), OBSymmetryData::OBSymmetryData(), and SetAttribute().

## _type

unsigned int _type

protected inherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), GetDataType(), OBGenericData(), OBNasaThermoData::OBNasaThermoData(), OBRotamerList::OBRotamerList(), and OBSymmetryData::OBSymmetryData().

## _source

DataOrigin _source

protected inherited

source of data for accounting

Referenced by GetOrigin(), OBGenericData(), OBSymmetryData::OBSymmetryData(), OBAngleData::operator=(), OBConformerData::operator=(), OBSymmetryData::operator=(), OBTorsionData::operator=(), and SetOrigin().

The documentation for this class was generated from the following files:

- generic.h
- generic.cpp