Pteros  2.0
Molecular modeling library for human beings!
pteros::PeriodicBox Class Reference

Class encapsulating all operations with arbitrary triclinic periodic boxes This class stores the periodic box itself and also contains pre-computed matrices for converting laboratory coordinates to the coordinates in triclinic basis and vice versa. More...

#include <periodic_box.h>

Public Member Functions

 PeriodicBox ()
 Default constructor.
 
 PeriodicBox (Matrix3f_const_ref m)
 Constructor from matrix.
 
 PeriodicBox (Vector3f_const_ref vectors, Vector3f_const_ref angles)
 Constructor from vector lengths and angles.
 
 PeriodicBox (const PeriodicBox &other)
 Copy constructor.
 
PeriodicBoxoperator= (const PeriodicBox &other)
 Assignment operator.
 
float get_element (int i, int j) const
 
void set_element (int i, int j, float val)
 
Eigen::Vector3f get_vector (int i) const
 Get i-th box vector.
 
void set_vector (Vector3f_const_ref vec, int i)
 Set i-th box vector.
 
Eigen::Matrix3f get_matrix () const
 Get stored matrix of box vectors.
 
void set_matrix (Matrix3f_const_ref box)
 Modify the box from 3x3 matrix.
 
void scale_vectors (Vector3f_const_ref scale)
 Scale box vectors by specified factors. More...
 
Eigen::Matrix3f get_inv_matrix () const
 Get stored inverted matrix of box vectors.
 
Eigen::Vector3f lab_to_box (Vector3f_const_ref point) const
 Convert point from lab coordinates to box coordinates.
 
Eigen::Matrix3f lab_to_box_transform () const
 Return the transformation from lab coordinates to box coordinates.
 
Eigen::Vector3f box_to_lab (Vector3f_const_ref point) const
 Convert point from box coordinates to lab coordinates.
 
Eigen::Matrix3f box_to_lab_transform () const
 Return the transformation from box coordinates to lab coordinates.
 
float extent (int i) const
 Return i-th extent of the box.
 
Eigen::Vector3f extents () const
 Return the vector of box extents.
 
bool is_triclinic () const
 Is the box triclinic?
 
bool is_periodic () const
 Is the box set? If false, the system is not periodic.
 
float distance (Vector3f_const_ref point1, Vector3f_const_ref point2, Array3i_const_ref pbc=fullPBC) const
 Compute a periodic distance between two points in the box Periodicity is only accouted for given set of dimensions If you need a non-periodic distance over all dimensions it is more efficient to compute it directly as: More...
 
float distance_squared (Vector3f_const_ref point1, Vector3f_const_ref point2, Array3i_const_ref pbc=fullPBC) const
 The same as distance but returns squared distance.
 
void wrap_point (Vector3f_ref point, Array3i_const_ref pbc=fullPBC, Vector3f_const_ref origin=Eigen::Vector3f::Zero()) const
 Wrap point to the box for given set of dimensions Origin of the box coordinates defaults to {0,0,0}.
 
bool in_box (Vector3f_const_ref point, Vector3f_const_ref origin=Eigen::Vector3f::Zero()) const
 Determine if the point is inside the box Origin of the box coordinates defaults to {0,0,0}.
 
Eigen::Vector3f closest_image (Vector3f_const_ref point, Vector3f_const_ref target, Array3i_const_ref pbc=fullPBC) const
 Finds a periodic image of point, which is closest in space to target and returns it

 
Eigen::Vector3f shortest_vector (Vector3f_const_ref point1, Vector3f_const_ref point2, Array3i_const_ref pbc=fullPBC) const
 Computes shortest vector from point1 to point2 between their closest images.
 
float volume ()
 Returns box volume.
 
void from_pdb_box (const char *line)
 Read box from CRYST string in PDB format. Overwrites current box!
 
std::string to_pdb_box () const
 Write box as CRYST string in PDB format.
 
void to_vectors_angles (Vector3f_ref vectors, Vector3f_ref angles) const
 Returns representation of the box as vector lengths and angles.
 
void from_vectors_angles (Vector3f_const_ref vectors, Vector3f_const_ref angles)
 Creates box from vector length and angles. More...
 

Detailed Description

Class encapsulating all operations with arbitrary triclinic periodic boxes This class stores the periodic box itself and also contains pre-computed matrices for converting laboratory coordinates to the coordinates in triclinic basis and vice versa.

Extents of the periodic box are also precomputed and stored internally.

Member Function Documentation

◆ scale_vectors()

void PeriodicBox::scale_vectors ( Vector3f_const_ref  scale)

Scale box vectors by specified factors.

Causes recomputing internal data.

◆ distance()

float PeriodicBox::distance ( Vector3f_const_ref  point1,
Vector3f_const_ref  point2,
Array3i_const_ref  pbc = fullPBC 
) const

Compute a periodic distance between two points in the box Periodicity is only accouted for given set of dimensions If you need a non-periodic distance over all dimensions it is more efficient to compute it directly as:

float dist = (point2-point1).norm();

◆ from_vectors_angles()

void PeriodicBox::from_vectors_angles ( Vector3f_const_ref  vectors,
Vector3f_const_ref  angles 
)

Creates box from vector length and angles.

Overwrites current box! vectors = {a,b,c} angles = {a^c, b^c, a^b}


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