8 #include "BondTensorAutoCorr.h" 9 #include <ddMd/analyzers/AutoCorrAnalyzer.tpp> 10 #include <ddMd/storage/BondStorage.h> 11 #include <ddMd/storage/GroupIterator.h> 12 #include <simp/boundary/Boundary.h> 49 int isLocal0, isLocal1, i, j;
55 for ( ; iter.
notEnd(); ++iter) {
56 atom0Ptr = iter->atomPtr(0);
57 atom1Ptr = iter->atomPtr(1);
58 isLocal0 = !(atom0Ptr->
isGhost());
59 isLocal1 = !(atom1Ptr->
isGhost());
64 assert(isLocal0 || isLocal1);
65 if (isLocal0 && isLocal1) {
69 localTensor(i, j) += dr[i]*dr[j];
76 localTensor(i, j) += 0.5*dr[i]*dr[j];
85 communicator.Reduce(&localTensor(0,0), &bondTensor_(0,0),
88 if (communicator.Get_rank() != 0) {
102 trace += bondTensor_(i,i);
104 trace = trace/double(Dimension);
106 bondTensor_(i,i) -= trace;
110 double factor = 1.0/sqrt(10.0*
simulation().boundary().volume());
113 bondTensor_(i,j) *= factor;
const int Dimension
Dimensionality of space.
Simulation & simulation()
Get the parent Simulation by reference.
A Vector is a Cartesian vector.
Compute an autocorrelation function for a sequence of Data values.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
virtual void computeData()
Compute Data value, call on all processors.
An orthorhombic periodic unit cell.
Vector & position()
Get position Vector by reference.
Tensor & zero()
Set all elements of this tensor to zero.
BondStorage & bondStorage()
Get the BondStorage by reference.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Main object for a domain-decomposition MD simulation.
A Tensor represents a Cartesian tensor.
MPI::Intracomm & communicator() const
Return Cartesian communicator by reference.
bool isGhost() const
Is this atom a ghost?
Iterator for all Group < N > objects owned by a GroupStorage< N >.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
virtual Tensor data()
Get current Data value, call only on master.
void begin(GroupIterator< N > &iterator)
Set iterator to beginning of the set of groups.
BondTensorAutoCorr(Simulation &simulation)
Constructor.
void setClassName(const char *className)
Set class name string.
Boundary & boundary()
Get the Boundary by reference.
Domain & domain()
Get the Domain by reference.
virtual ~BondTensorAutoCorr()
Destructor.
Container for for Group<2> (bond) objects.