54 link.clusterId_ = id_;
84 thisClusterStart =
head();
88 int nAtomsInCluster = 0;
92 while(thisClusterStart) {
93 next = thisClusterStart->
next();
94 thisMolecule = thisClusterStart->
molecule();
95 thisMolecule.
begin(atomIter);
96 for( ; atomIter.
notEnd(); ++atomIter) {
97 if (atomIter->typeId() == atomTypeInCluster) {
98 boundary.
distanceSq(atomIter->position(),r0,dr);
100 nAtomsInCluster += 1;
103 thisClusterStart = next;
105 com /= nAtomsInCluster;
118 thisClusterStart =
head();
123 int nAtomsInCluster = 0;
124 while(thisClusterStart) {
125 next = thisClusterStart->
next();
126 thisMolecule = thisClusterStart->
molecule();
127 thisMolecule.
begin(atomIter);
128 for( ; atomIter.
notEnd(); ++atomIter) {
129 if (atomIter->typeId() == atomTypeInCluster) {
130 nAtomsInCluster += 1;
131 boundary.
distanceSq(atomIter->position(), com,dr);
132 rgTensor += rgDyad.
dyad(dr,dr);
135 thisClusterStart = next;
137 rgTensor /= nAtomsInCluster;
Vector & zero()
Set all elements of a 3D vector to zero.
A Vector is a Cartesian vector.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
void clear()
Set to default state.
An orthorhombic periodic unit cell.
int clusterId() const
Get cluster identifier.
Tensor & zero()
Set all elements of this tensor to zero.
void begin(AtomIterator &iterator)
Set an Molecule::AtomIterator to first Atom in this Molecule.
bool isValid() const
Return true if valid, false otherwise.
void clear()
Set cluster to empty.
ClusterLink * next() const
Get pointer to next link in linked list.
File containing preprocessor macros for error handling.
A Tensor represents a Cartesian tensor.
Forward const iterator for an Array or a C array.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
ClusterLink * head() const
Get a pointer to the first link in the linked list.
Utility classes for scientific computation.
int id() const
Get the cluster id.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
Molecule & molecule() const
Get associated molecule by reference.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void setId(int id)
Set cluster identifier.
Vector clusterCOM(int atomTypeInCluster, Boundary const &boundary)
Return the cluster COM.
A physical molecule (a set of covalently bonded Atoms).
bool notEnd() const
Is this not the end of the array?
Tensor momentTensor(int atomTypeInCluster, Boundary const &boundary)
Return the cluster radius of gyration tensor.
Tensor & dyad(const Vector &v1, const Vector &v2)
Create dyad of two vectors.
void addLink(ClusterLink &link)
Add a link to the list.