Skip to content

Commit db22f3f

Browse files
committed
feature: updating S(Q) and pair correlation functions
1 parent 2bf81b3 commit db22f3f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

include/action.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class ActionBase {
135135
beadLocator bead2,bead3; // Bead indexers
136136
dVec sep,sep2; // The spatial separation between beads.
137137
double dSep; // The discretization for the separation histogram
138+
double dPerSep; // The PBC discretization for the separation histogram
138139

139140
/* Update the separation histogram */
140141
void updateSepHist(const dVec &);

src/action.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ ActionBase::ActionBase (const Path &_path, LookupTable &_lookup,
4343
sepHist = 0;
4444
cylSepHist.resize(NPCFSEP);
4545
cylSepHist = 0;
46-
dSep = 0.5*sqrt(sum(path.boxPtr->periodic))*path.boxPtr->side[NDIM-1] / (1.0*NPCFSEP);
46+
dSep = 0.5*sqrt(NDIM)*path.boxPtr->side[NDIM-1] / (1.0*NPCFSEP);
47+
dPerSep = 0.5*sqrt(sum(path.boxPtr->periodic))*path.boxPtr->side[NDIM-1] / (1.0*NPCFSEP);
4748

4849
/* Needed for canonical ensemble weighting */
4950
canonical = constants()->canonical();
@@ -70,9 +71,11 @@ ActionBase::~ActionBase() {
7071
******************************************************************************/
7172
inline void ActionBase::updateSepHist(const dVec &_sep) {
7273
dVec psep;
73-
psep = path.boxPtr->periodic*_sep;
74+
/* Temporarly computing full radial g(r) */
75+
/* psep = path.boxPtr->periodic*_sep; */
76+
psep = _sep;
7477
int nR = int(sqrt(dot(psep,psep))/dSep);
75-
if (nR < NPCFSEP)
78+
if (nR >= 0 && nR < NPCFSEP)
7679
++sepHist(nR);
7780
}
7881

@@ -658,7 +661,7 @@ double LocalAction::V(const int slice, const double maxR) {
658661

659662
sep = path.getSeparation(bead2,bead1);
660663
if (r2sq < maxR*maxR) {
661-
int nR = int(abs(sep[2])/dSep);
664+
int nR = int(abs(sep[2])/dPerSep);
662665
if (nR < NPCFSEP)
663666
++cylSepHist(nR);
664667
}

src/estimator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ PairCorrelationEstimator::PairCorrelationEstimator (const Path &_path,
25742574

25752575
/* The normalization factor for the pair correlation function depends
25762576
* on the dimensionality, and container type */
2577-
if (path.boxPtr->name == "Cylinder") {
2577+
if (path.boxPtr->name == "XXX") {
25782578
for (int n = 0; n < NPCFSEP; n++)
25792579
norm(n) = 0.5*path.boxPtr->side[NDIM-1] / dR;
25802580
}

0 commit comments

Comments
 (0)