Class SBDTypeUnitCell#
This class is used to represent a unit cell. More...
#include <SBDTypeUnitCell.hpp>
Public Types#
| Type | Name |
|---|---|
| enum | Periodicity Available unit-cell periodicity masks. |
| enum | ShapeType Available unit cell shape types. |
Public Functions#
| Type | Name |
|---|---|
| SBDTypeUnitCell () Constructs an infinite unit cell. |
|
| SBDTypeUnitCell (const SBQuantity::length & length, SBDTypeUnitCell::ShapeType shapeType=SBDTypeUnitCell::ShapeType::Cubic) Constructs a cubic, rhombic dodecahedral, or truncated octahedral box with the box length length . |
|
| SBDTypeUnitCell (const SBLength3 & lengths) Constructs an orthorhombic unit cell with the box size lengths . |
|
| SBDTypeUnitCell (const SBLength3 & lengths, const SBVector3 & angles) Constructs a triclinic unit cell with the box size length and anglesangles (in degrees) |
|
| SBDTypeUnitCell (const SBQuantity::length & a, const SBQuantity::length & b, const SBQuantity::length & c, const SBQuantity::degree & alpha, const SBQuantity::degree & beta, const SBQuantity::degree & gamma) Constructs a triclinic unit cell with the box size and angles (in degrees) |
|
| SBDTypeUnitCell (const SBLength3 & vectorA, const SBLength3 & vectorB, const SBLength3 & vectorC) Constructs a unit cell based on 3 vectors vectorA ,vectorB ,vectorC . |
|
| SBDTypeUnitCell (const SBMatrix33 & matrix) Constructs a unit cell based on the matrix matrix whose coefficients are expressed in internallength units. |
|
| bool | canUseMinimumImageConvention (const SBQuantity::length & cutoff) const Returns true if and only if the minimum-image convention is valid for the cutoffcutoff . |
| bool | checkTriclinicConditions (std::string & error) const Returns true if the box described by the unit cell satisfies a set of triclinic box conditions. |
| bool | contains (const SBPosition3 & position) const Returns true if and only ifposition belongs to the primary unit cell. |
| const SBVector3 & | getAngles () const Returns the angles of the unit cell. |
| SBPosition3 | getCartesianCoordinates (const SBVector3 & fractionalCoordinates) const Returns the Cartesian coordinates associated with fractionalCoordinates . |
| SBPosition3 | getCenter () const Returns the center of the primary unit cell. |
| SBPosition3 | getCenterOfTriclinicCell () const Returns the center of the triclinic unit cell. |
| SBVector3 | getFractionalCoordinates (const SBPosition3 & position) const Returns the fractional coordinates associated with position . |
| SBInverseLength3 | getInverseLengths () const Returns the inverse lengths of the unit cell. |
| SBMatrix33 | getInverseMatrix () const Returns the inverse lattice matrix whose coefficients are expressed in inverse internal length units. |
| const SBLength3 & | getLengths () const Returns the lengths of the unit cell. |
| const SBMatrix33 & | getMatrix () const Returns the matrix of the unit cell whose coefficients are expressed in internal length units. |
| SBLength3 | getMinimumImageDisplacement (const SBPosition3 & position1, const SBPosition3 & position2) const Returns the minimum-image displacement from position1 toposition2 . |
| SBQuantity::length | getMinimumImageDistance (const SBPosition3 & position1, const SBPosition3 & position2) const Returns the minimum-image distance between position1 andposition2 . |
| SBQuantity::squareLength | getMinimumImageSquaredDistance (const SBPosition3 & position1, const SBPosition3 & position2) const Returns the minimum-image squared distance between position1 andposition2 . |
| SBPosition3 | getNearestPeriodicImage (const SBPosition3 & position, const SBPosition3 & referencePosition) const Returns the periodic image of position that is nearest toreferencePosition . |
| const SBPosition3 & | getOrigin () const Returns the origin of the unit cell. |
| SBDTypeUnitCell::Periodicity | getPeriodicity () const Returns the unit cell periodicity mask. |
| SBMatrix33 | getReciprocalMatrix (bool include2Pi=false) const Returns the reciprocal lattice matrix whose coefficients are expressed in inverse internal length units. |
| SBDTypeUnitCell::ShapeType | getShapeType () const Returns the unit cell's shape type. |
| std::string | getShapeTypeString () const Returns the name of the unit cell's shape type. |
| SBLength3 | getVectorA () const Returns the first lattice vector. |
| SBLength3 | getVectorB () const Returns the second lattice vector. |
| SBLength3 | getVectorC () const Returns the third lattice vector. |
| SBQuantity::cubicLength | getVolume () const Returns the volume of the unit cell. |
| SBVector3 | getWrappedFractionalCoordinates (const SBVector3 & fractionalCoordinates) const Returns wrapped fractional coordinates for the periodic axes. |
| SBPosition3 | getWrappedPosition (const SBPosition3 & position) const Returns the wrapped position associated with position . |
| bool | isFinite () const Returns true if and only if the unit cell is finite. |
| bool | isPeriodic () const Returns true if and only if the unit cell is periodic along at least one axis. |
| bool | isPeriodicX () const Returns true if and only if the unit cell is periodic along the a / x axis. |
| bool | isPeriodicY () const Returns true if and only if the unit cell is periodic along the b / y axis. |
| bool | isPeriodicZ () const Returns true if and only if the unit cell is periodic along the c / z axis. |
| virtual bool | isSerializable () const Returns true __ |
| bool | operator!= (const SBDTypeUnitCell & unitCell) const Returns true if this unit cell is not equal to unit cellunitCell (component-wise) |
| SBDTypeUnitCell & | operator= (const SBDTypeUnitCell & unitCell) Assignment operator. |
| bool | operator== (const SBDTypeUnitCell & unitCell) const Returns true if this unit cell is equal to unit cellunitCell (component-wise) |
| virtual void | print (std::ostream & os) const Prints the unit cell. |
| virtual void | print () const Prints the unit cell. |
| virtual void | serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) const Serializes the color. |
| void | setOrigin (const SBPosition3 & origin) Sets the origin of the unit cell. |
| void | setPeriodicity (SBDTypeUnitCell::Periodicity periodicity) Sets the unit cell periodicity mask. |
| void | setShapeType (SBDTypeUnitCell::ShapeType shapeType) Sets the unit cell's shape type to shapeType . |
| virtual std::string | toPythonCode () const Returns the string representation of the object that can be used to reconstruct it in Python. |
| virtual void | unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) Unserializes the color. |
| ~SBDTypeUnitCell () Destructor. |
Public Static Functions#
| Type | Name |
|---|---|
| bool | checkTriclinicConditions (const SBMatrix33 & matrix, std::string & error) Returns true if the box described by the matrixmatrix whose coefficients are expressed in internallength units satisfies a set of triclinic box conditions. |
| SBVector3 | getAngles (const SBMatrix33 & matrix) Returns box angles based on the matrix matrix whose coefficients are expressed in internallength units. |
| SBLength3 | getLengths (const SBMatrix33 & matrix) Returns box length based on the matrix matrix whose coefficients are expressed in internallength units. |
| SBMatrix33 | getMatrix (const SBLength3 & lengths, const SBVector3 & angles) Returns box matrix based on length lengths and anglesangles . |
| SBDTypeUnitCell::ShapeType | getShapeType (const SBMatrix33 & matrix) Returns the unit cell's shape type based on the box matrix matrix whose coefficients are expressed in internallength units. |
| std::string | getShapeTypeString (SBDTypeUnitCell::ShapeType shapeType) Returns the name of the unit cell's shape type shapeType . |
Protected Attributes#
| Type | Name |
|---|---|
| SBVector3 | angles The angles, in degrees, of the unit cell between the box vectors (bc, ac, ab) |
| SBLength3 | lengths The lengths of the unit cell - the box vector lengths (a, b, c) |
| SBMatrix33 | matrix The unit cell matrix. |
| SBPosition3 | origin The origin of the unit cell, by default it is (0, 0, 0) |
| Periodicity | periodicity The unit-cell periodicity mask. |
| ShapeType | shapeType The type of the unit cell shape. |
Detailed Description#
Short name: SBUnitCell
See also: SAMSON's unit system
Public Types Documentation#
enum Periodicity#
Available unit-cell periodicity masks.
enum SBDTypeUnitCell::Periodicity {
None = 0,
X = 1,
Y = 2,
Z = 4,
XY = 3,
XZ = 5,
YZ = 6,
XYZ = 7
};
enum ShapeType#
Available unit cell shape types.
enum SBDTypeUnitCell::ShapeType {
Undefined = 0,
Infinite = 0,
Cubic = 1,
Orthorhombic = 2,
Triclinic = 3,
Dodecahedron = 4,
RhombicDodecahedron = 4,
Octahedron = 5,
TruncatedOctahedron = 5
};
Public Functions Documentation#
function SBDTypeUnitCell [1/7]#
Constructs an infinite unit cell.
function SBDTypeUnitCell [2/7]#
Constructs a cubic, rhombic dodecahedral, or truncated octahedral box with the box length length .
SBDTypeUnitCell::SBDTypeUnitCell (
const SBQuantity::length & length,
SBDTypeUnitCell::ShapeType shapeType=SBDTypeUnitCell::ShapeType::Cubic
)
Constructs a unit cell with the given box length and shape type.
Parameters:
lengthThe box length (absolute value is used).shapeTypeThe shape type of the unit cell.
function SBDTypeUnitCell [3/7]#
Constructs an orthorhombic unit cell with the box size lengths .
Constructs an orthorhombic unit cell with the given box lengths.
Parameters:
lengthsThe vector of three box lengths (a, b, c). Negative values are made positive.
function SBDTypeUnitCell [4/7]#
Constructs a triclinic unit cell with the box size length and anglesangles (in degrees)
Constructs a unit cell with the given box lengths and angles.
Parameters:
lengthsThe vector of three box lengths (a, b, c). Negative values are made positive.anglesThe vector of three angles (in degrees) between box vectors. Angles are clamped to [0,180] degrees.
function SBDTypeUnitCell [5/7]#
Constructs a triclinic unit cell with the box size and angles (in degrees)
SBDTypeUnitCell::SBDTypeUnitCell (
const SBQuantity::length & a,
const SBQuantity::length & b,
const SBQuantity::length & c,
const SBQuantity::degree & alpha,
const SBQuantity::degree & beta,
const SBQuantity::degree & gamma
)
Constructs a unit cell with the given box lengths and angles.
Parameters:
aLength of box vector a.bLength of box vector b.cLength of box vector c.alphaAngle alpha (in degrees) between box vectors b and c.betaAngle beta (in degrees) between box vectors c and a.gammaAngle gamma (in degrees) between box vectors a and b.
function SBDTypeUnitCell [6/7]#
Constructs a unit cell based on 3 vectors vectorA ,vectorB ,vectorC .
SBDTypeUnitCell::SBDTypeUnitCell (
const SBLength3 & vectorA,
const SBLength3 & vectorB,
const SBLength3 & vectorC
)
Constructs a unit cell based on three vectors.
Parameters:
vectorAThe first box vector.vectorBThe second box vector.vectorCThe third box vector.
function SBDTypeUnitCell [7/7]#
Constructs a unit cell based on the matrix matrix whose coefficients are expressed in internallength units.
Constructs a unit cell based on a matrix.
Parameters:
matrixThe 3x3 matrix defining the unit cell vectors. If the matrix has a negative determinant, it is reset to a zero matrix.
function canUseMinimumImageConvention#
Returns true if and only if the minimum-image convention is valid for the cutoffcutoff .
Returns whether the minimum-image convention is valid for the cutoff cutoff.
Parameters:
cutoffThe interaction cutoff.
Returns:
true if and only if the minimum-image convention is valid for cutoff.
function checkTriclinicConditions [1/2]#
Returns true if the box described by the unit cell satisfies a set of triclinic box conditions.
Checks whether the unit cell satisfies the triclinic box conditions.
Parameters:
errorReference to a string that receives an error message if the check fails.
Returns:
true if the unit cell satisfies the conditions; otherwise false.
function contains#
Returns true if and only ifposition belongs to the primary unit cell.
Returns whether position belongs to the primary unit cell.
Parameters:
positionThe position to test.
Returns:
true if and only if position belongs to the primary unit cell.
function getAngles [1/2]#
Returns the angles of the unit cell.
Returns:
Reference to the vector of angles (alpha, beta, gamma) in degrees.
function getCartesianCoordinates#
Returns the Cartesian coordinates associated with fractionalCoordinates .
SBPosition3 SBDTypeUnitCell::getCartesianCoordinates (
const SBVector3 & fractionalCoordinates
) const
Parameters:
fractionalCoordinatesThe fractional coordinates.
Returns:
The associated Cartesian coordinates.
function getCenter#
Returns the center of the primary unit cell.
Returns:
The center of the primary unit cell.
function getCenterOfTriclinicCell#
Returns the center of the triclinic unit cell.
Returns:
The position of the cell's center.
function getFractionalCoordinates#
Returns the fractional coordinates associated with position .
Parameters:
positionThe Cartesian position.
Returns:
The associated fractional coordinates.
function getInverseLengths#
Returns the inverse lengths of the unit cell.
Returns:
An SBInverseLength3 object containing the reciprocal of each length component.
function getInverseMatrix#
Returns the inverse lattice matrix whose coefficients are expressed in inverse internal length units.
Returns the inverse lattice matrix of the unit cell.
Returns:
The inverse lattice matrix.
function getLengths [1/2]#
Returns the lengths of the unit cell.
Returns:
Reference to the vector of lengths (a, b, c).
function getMatrix [1/2]#
Returns the matrix of the unit cell whose coefficients are expressed in internal length units.
Returns the matrix representing the unit cell.
Returns:
Reference to the 3×3 matrix of the unit cell.
function getMinimumImageDisplacement#
Returns the minimum-image displacement from position1 toposition2 .
SBLength3 SBDTypeUnitCell::getMinimumImageDisplacement (
const SBPosition3 & position1,
const SBPosition3 & position2
) const
Parameters:
position1The start position.position2The end position.
Returns:
The minimum-image displacement.
function getMinimumImageDistance#
Returns the minimum-image distance between position1 andposition2 .
SBQuantity::length SBDTypeUnitCell::getMinimumImageDistance (
const SBPosition3 & position1,
const SBPosition3 & position2
) const
Parameters:
position1The first position.position2The second position.
Returns:
The minimum-image distance.
function getMinimumImageSquaredDistance#
Returns the minimum-image squared distance between position1 andposition2 .
SBQuantity::squareLength SBDTypeUnitCell::getMinimumImageSquaredDistance (
const SBPosition3 & position1,
const SBPosition3 & position2
) const
Parameters:
position1The first position.position2The second position.
Returns:
The minimum-image squared distance.
function getNearestPeriodicImage#
Returns the periodic image of position that is nearest toreferencePosition .
SBPosition3 SBDTypeUnitCell::getNearestPeriodicImage (
const SBPosition3 & position,
const SBPosition3 & referencePosition
) const
Parameters:
positionThe position to image.referencePositionThe reference position.
Returns:
The nearest periodic image of position.
function getOrigin#
Returns the origin of the unit cell.
Returns:
Reference to the origin position.
function getPeriodicity#
Returns the unit cell periodicity mask.
Returns the periodicity mask of this unit cell.
Returns:
The periodicity mask.
function getReciprocalMatrix#
Returns the reciprocal lattice matrix whose coefficients are expressed in inverse internal length units.
Returns the reciprocal lattice matrix of the unit cell.
Parameters:
include2PiWhether to multiply the reciprocal lattice vectors by2*pi.
Returns:
The reciprocal lattice matrix.
function getShapeType [1/2]#
Returns the unit cell's shape type.
Returns the shape type of this unit cell.
Returns:
The shape type.
function getShapeTypeString [1/2]#
Returns the name of the unit cell's shape type.
Returns the name of this unit cell's shape type.
Returns:
The string representation of the shape type.
function getVectorA#
Returns the first lattice vector.
Returns the first lattice vector of the unit cell.
Returns:
The first lattice vector.
function getVectorB#
Returns the second lattice vector.
Returns the second lattice vector of the unit cell.
Returns:
The second lattice vector.
function getVectorC#
Returns the third lattice vector.
Returns the third lattice vector of the unit cell.
Returns:
The third lattice vector.
function getVolume#
Returns the volume of the unit cell.
Computes the volume of the unit cell.
Returns:
The volume as a cubic length quantity. Returns zero for infinite or undefined boxes.
function getWrappedFractionalCoordinates#
Returns wrapped fractional coordinates for the periodic axes.
SBVector3 SBDTypeUnitCell::getWrappedFractionalCoordinates (
const SBVector3 & fractionalCoordinates
) const
Parameters:
fractionalCoordinatesThe fractional coordinates to wrap.
Returns:
The wrapped fractional coordinates.
function getWrappedPosition#
Returns the wrapped position associated with position .
Parameters:
positionThe position to wrap.
Returns:
The wrapped position.
function isFinite#
Returns true if and only if the unit cell is finite.
Returns whether this unit cell is finite.
Returns:
true if and only if the unit cell is finite.
function isPeriodic#
Returns true if and only if the unit cell is periodic along at least one axis.
Returns whether this unit cell is periodic.
Returns:
true if and only if the unit cell is periodic along at least one axis.
function isPeriodicX#
Returns true if and only if the unit cell is periodic along the a / x axis.
Returns whether this unit cell is periodic along the a / x axis.
Returns:
true if and only if the unit cell is periodic along the a / x axis.
function isPeriodicY#
Returns true if and only if the unit cell is periodic along the b / y axis.
Returns whether this unit cell is periodic along the b / y axis.
Returns:
true if and only if the unit cell is periodic along the b / y axis.
function isPeriodicZ#
Returns true if and only if the unit cell is periodic along the c / z axis.
Returns whether this unit cell is periodic along the c / z axis.
Returns:
true if and only if the unit cell is periodic along the c / z axis.
function isSerializable#
Returns true __
Indicates that the unit cell can be serialized.
Returns:
true.
function operator!=#
Returns true if this unit cell is not equal to unit cellunitCell (component-wise)
Inequality comparison operator.
Parameters:
unitCellThe unit cell to compare with.
Returns:
true if any of shape type, matrix, or origin differ; otherwise false.
function operator=#
Assignment operator.
Parameters:
unitCellThe source unit cell to copy from.
Returns:
Reference to this unit cell.
function operator==#
Returns true if this unit cell is equal to unit cellunitCell (component-wise)
Equality comparison operator.
Parameters:
unitCellThe unit cell to compare with.
Returns:
true if the unit cells have the same shape type, matrix, and origin; otherwise false.
function print [1/2]#
Prints the unit cell.
Prints the unit cell to the given output stream.
Writes the lengths, angles, and matrix of the unit cell to the provided output stream.
Parameters:
osThe output stream to which the unit cell data will be printed.
function print [2/2]#
Prints the unit cell.
Prints the unit cell to the standard output.
Calls the overload of print that writes to a stream, using std::cout.
function serialize#
Serializes the color.
virtual void SBDTypeUnitCell::serialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) const
Serializes the unit cell.
Parameters:
serializerThe serializer to write the unit cell data to.sdkVersionNumberThe SDK version number; defaults to SB_SDK_VERSION_NUMBER.
function setOrigin#
Sets the origin of the unit cell.
Parameters:
originThe new origin position.
function setPeriodicity#
Sets the unit cell periodicity mask.
Sets the periodicity mask of this unit cell.
Parameters:
periodicityThe periodicity mask to set.
function setShapeType#
Sets the unit cell's shape type to shapeType .
Sets the shape type of this unit cell.
Parameters:
shapeTypeThe shape type to set.
function toPythonCode#
Returns the string representation of the object that can be used to reconstruct it in Python.
Generates a Python code snippet that reconstructs the unit cell.
Returns:
A string containing the Python code representation of this unit cell.
function unserialize#
Unserializes the color.
virtual void SBDTypeUnitCell::unserialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
)
Unserializes the unit cell.
Parameters:
serializerThe serializer to read the unit cell data from.sdkVersionNumberThe SDK version number; defaults to SB_SDK_VERSION_NUMBER.
function ~SBDTypeUnitCell#
Destructor.
Public Static Functions Documentation#
function checkTriclinicConditions [2/2]#
Returns true if the box described by the matrixmatrix whose coefficients are expressed in internallength units satisfies a set of triclinic box conditions.
static bool SBDTypeUnitCell::checkTriclinicConditions (
const SBMatrix33 & matrix,
std::string & error
)
Checks whether a given matrix satisfies the triclinic box conditions.
Parameters:
matrixThe unit cell matrix to check.errorReference to a string that receives an error message if the check fails.
Returns:
true if the matrix satisfies the conditions; otherwise false.
function getAngles [2/2]#
Returns box angles based on the matrix matrix whose coefficients are expressed in internallength units.
Extracts the unit cell angles from a matrix.
Parameters:
matrixThe unit cell matrix.
Returns:
The angles (alpha, beta, gamma) in degrees as an SBVector3.
function getLengths [2/2]#
Returns box length based on the matrix matrix whose coefficients are expressed in internallength units.
Extracts the unit cell lengths from a matrix.
Parameters:
matrixThe unit cell matrix.
Returns:
The lengths (a, b, c) as an SBLength3.
function getMatrix [2/2]#
Returns box matrix based on length lengths and anglesangles .
static SBMatrix33 SBDTypeUnitCell::getMatrix (
const SBLength3 & lengths,
const SBVector3 & angles
)
Computes a unit cell matrix from the given lengths and angles.
Parameters:
lengthsThe lengths of the unit cell (a, b, c).anglesThe angles of the unit cell (alpha, beta, gamma) in degrees.
Returns:
The computed SBMatrix33 representing the unit cell.
function getShapeType [2/2]#
Returns the unit cell's shape type based on the box matrix matrix whose coefficients are expressed in internallength units.
Determines the shape type of a unit cell from its matrix.
Parameters:
matrixThe unit cell matrix.
Returns:
The ShapeType enumeration value representing the unit cell shape.
function getShapeTypeString [2/2]#
Returns the name of the unit cell's shape type shapeType .
Returns the name of the unit cell's shape type.
Parameters:
shapeTypeThe shape type to get the name for.
Returns:
The string representation of the shape type.
Protected Attributes Documentation#
variable angles#
The angles, in degrees, of the unit cell between the box vectors (bc, ac, ab)
variable lengths#
The lengths of the unit cell - the box vector lengths (a, b, c)
variable matrix#
The unit cell matrix.
variable origin#
The origin of the unit cell, by default it is (0, 0, 0)
variable periodicity#
The unit-cell periodicity mask.
variable shapeType#
The type of the unit cell shape.