|
faunus
|
#include <group.h>


Public Types | |
| enum | Selectors : unsigned int { ANY = (1U << 1U), ACTIVE = (1U << 2U), INACTIVE = (1U << 3U), NEUTRAL = (1U << 4U), ATOMIC = (1U << 5U), MOLECULAR = (1U << 6U), FULL = (1U << 7U) } |
Selections to filter groups using getSelectionFilter() More... | |
| using | base = ElasticRange< Particle > |
| using | iter = typename base::Titer |
Public Types inherited from Faunus::ElasticRange< Particle > | |
| using | Titer = typename std::vector< Particle >::iterator |
| using | const_iterator = typename std::vector< Particle >::const_iterator |
| using | base = IterRange< typename std::vector< Particle >::iterator > |
Public Member Functions | |
| bool | isAtomic () const |
| Is it an atomic group? | |
| bool | isMolecular () const |
| is it a molecular group? | |
| bool | isFull () const override |
| True of all particles are active. | |
| std::optional< std::reference_wrapper< Point > > | massCenter () |
| Optional reference to mass center. More... | |
| std::optional< std::reference_wrapper< const Point > > | massCenter () const |
| Optional ref. to mass center. | |
| template<unsigned int mask> | |
| bool | match () const |
Determines if given Selectors bitmask matches group. More... | |
| const MoleculeData & | traits () const |
| Convenient access to molecule properties. | |
| Group (Group &other) | |
| Group (const Group &other) | |
| Group (MoleculeData::index_type molid, iter begin, iter end) | |
| Constructor. More... | |
| Group & | operator= (const Group &other) |
| Deep copy contents from another Group. More... | |
| Group & | shallowCopy (const Group &other) |
copy from other but not particle data More... | |
| bool | contains (const Particle &particle, bool include_inactive=false) const |
| Does particle belong? | |
| double | mass () const |
| Sum of all active masses. | |
| auto | positions () |
| Range of positions of active particles. | |
| auto | positions () const |
| Range of positions of active particles. | |
| AtomData::index_type | getParticleIndex (const Particle &particle, bool include_inactive=false) const |
| Finds index of particle within group. Throws if not part of group. | |
| auto | findAtomID (AtomData::index_type atomid) const |
| Range of all (active) elements with matching particle id. | |
| auto & | operator[] (size_t index) |
| Returns i'th element in group. More... | |
| const auto & | operator[] (size_t index) const |
| Particle & | at (size_t index) |
| Returns i'th element in group. More... | |
| const Particle & | at (size_t index) const |
| Returns i'th element in group. More... | |
| template<std::integral Tint = size_t> | |
| auto | operator[] (std::vector< Tint > &indices) |
| Reference to subset of given indices, where 0 is the start of the group. More... | |
| template<typename TdistanceFunc > | |
| void | unwrap (const TdistanceFunc &vector_distance) |
| Remove PBC for molecular groups w. More... | |
| void | wrap (Geometry::BoundaryFunction boundary) |
| Apply periodic boundaries (Order N complexity). | |
| void | translate (const Point &displacement, Geometry::BoundaryFunction boundary=[](Point &) { }) |
| Translate particle positions and mass center. | |
| void | rotate (const Eigen::Quaterniond &quaternion, Geometry::BoundaryFunction boundary) |
| Rotate particles incl. internal coordinates (dipole moment etc.) | |
| void | updateMassCenter (Geometry::BoundaryFunction boundary, const Point &approximate_mass_center) |
| Calculates mass center. More... | |
| void | updateMassCenter (Geometry::BoundaryFunction boundary) |
| Calculates mass center. More... | |
Public Member Functions inherited from Faunus::ElasticRange< Particle > | |
| ElasticRange (Titer begin, Titer end) | |
| size_t | capacity () const |
| auto | inactive () const |
| Range of inactive elements. | |
| void | deactivate (Titer first, Titer last) |
| Deactivate particles by moving to end, reducing the effective size. | |
| void | activate (Titer first, Titer last) |
| Activate previously deactivated elements. | |
| Titer & | trueend () |
| const Titer & | trueend () const |
| void | relocate (const_iterator oldorigin, Titer neworigin) |
| Shift all iterators to new underlying container; useful when resizing vectors. | |
| auto | numInactive () const |
| Number of inactive elements. More... | |
| bool | resizeIsPossible (int number_to_insert_or_delete) const |
| auto | all () |
| Active and inactive elements. | |
| auto | all () const |
| Active and inactive elements. | |
Public Member Functions inherited from Faunus::IterRange< std::vector< Particle >::iterator > | |
| std::vector< Particle >::iterator & | begin () |
| const std::vector< Particle >::iterator & | begin () const |
| std::vector< Particle >::iterator & | end () |
| const std::vector< Particle >::iterator & | end () const |
| size_t | size () const |
| void | resize (size_t n) |
| bool | empty () const |
| void | clear () |
| std::pair< int, int > | to_index (std::vector< Particle >::iterator reference) const |
| Returns particle index pair relative to given reference. | |
Public Attributes | |
| int | id = -1 |
| Molecule id. | |
| int | conformation_id = 0 |
| Conformation index / id. | |
| Point | mass_center = {0.0, 0.0, 0.0} |
| Mass center. | |
End of Group class.
| enum Faunus::Group::Selectors : unsigned int |
Selections to filter groups using getSelectionFilter()
| Faunus::Group::Group | ( | MoleculeData::index_type | molid, |
| Group::iter | begin, | ||
| Group::iter | end | ||
| ) |
Constructor.
| molid | Molecule id the group points to, i.e. a valid index in global Faunus::molecules. |
| begin | Iterator to first particle |
| end | Iterator to (beyond) end particle |
| if | molid is out of range w. respect to Faunus::molecules |
| Particle & Faunus::Group::at | ( | size_t | index | ) |
Returns i'th element in group.
| index | index starting at zero |
| if | out of interval [0:capacity[ |
| const Particle & Faunus::Group::at | ( | size_t | index | ) | const |
Returns i'th element in group.
| index | index starting at zero |
| if | out of interval [0:capacity[ |
| std::optional< std::reference_wrapper< Point > > Faunus::Group::massCenter | ( | ) |
Optional reference to mass center.
If the group supports mass centers (i.e.
molecular groups), an optional reference will be returned. Example usage:
if (auto mass_center = group.massCenter()) { (*mass_center).get() = Point(0,1,2); }
|
inline |
Determines if given Selectors bitmask matches group.
| mask | Bitmask build from enum Group::Selectors |
Note that for INACTIVE | NEUTRAL, the criterion is applied to all active and inactive particles, i.e. until trueend().
Deep copy contents from another Group.
Performs a deep copy from another group.
| if | the capacities of the two groups differ |
|
inline |
Returns i'th element in group.
| i | index starting at zero |
[0:size[
|
inline |
Reference to subset of given indices, where 0 is the start of the group.
| indices | Range of indices relative to group |
indices to const& which would create a dangling reference copy from other but not particle data
This copies size, id, mass center etc.
from another group but does not copy particle data.
| if | the capacities of the two groups differ |
|
inline |
Remove PBC for molecular groups w.
respect to mass center
| TdistanceFunc |
| vector_distance | Distance calculation function |
| void Faunus::Group::updateMassCenter | ( | Geometry::BoundaryFunction | boundary_function, |
| const Point & | approximate_mass_center | ||
| ) |
Calculates mass center.
| boundary_function | Function to apply periodic boundaries |
| approximate_mass_center | Original or appriximate mass center used for PBC removal |
Only active, molecular groups are affected. Before the mass center is calculated, the molecule is translated towards the center of the simulation box to remove possible periodic boundary conditions; then translated back again. The translation is done by subtracting / adding approximate_mass_center. Safely handles empty groups.
| void Faunus::Group::updateMassCenter | ( | Geometry::BoundaryFunction | boundary_function | ) |
Calculates mass center.
| boundary_function | Function to apply periodic boundaries |
This will approximate the existing mass center by the middle particle which for PBC systems is generally safer then using the old mass center.
1.8.13