ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/staticProps/pAngle.cpp
(Generate patch)

Comparing trunk/src/applications/staticProps/pAngle.cpp (file contents):
Revision 1988 by gezelter, Fri Apr 18 19:49:54 2014 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 54 | Line 54 | namespace OpenMD {
54    
55    pAngle::pAngle(SimInfo* info, const std::string& filename,
56                   const std::string& sele1, int nthetabins)
57 <    : StaticAnalyser(info, filename), selectionScript1_(sele1),  
58 <      evaluator1_(info),  evaluator2_(info), seleMan1_(info), seleMan2_(info),
59 <      nThetaBins_(nthetabins),
60 <      doVect_(true), doOffset_(false) {
57 >    : StaticAnalyser(info, filename), doVect_(true), doOffset_(false),
58 >      selectionScript1_(sele1), seleMan1_(info), seleMan2_(info),
59 >      evaluator1_(info),  evaluator2_(info),
60 >      nThetaBins_(nthetabins) {
61      
62      setOutputName(getPrefix(filename) + ".pAngle");
63  
# Line 73 | Line 73 | namespace OpenMD {
73    pAngle::pAngle(SimInfo* info, const std::string& filename,
74                   const std::string& sele1, const std::string& sele2,
75                   int nthetabins)
76 <    : StaticAnalyser(info, filename), selectionScript1_(sele1),
77 <      selectionScript2_(sele2), evaluator1_(info), evaluator2_(info),
78 <      seleMan1_(info), seleMan2_(info), nThetaBins_(nthetabins),
79 <      doVect_(false), doOffset_(false) {
76 >    : StaticAnalyser(info, filename), doVect_(false), doOffset_(false),
77 >      selectionScript1_(sele1), selectionScript2_(sele2),
78 >      seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info),
79 >      nThetaBins_(nthetabins) {
80      
81      setOutputName(getPrefix(filename) + ".pAngle");
82  
# Line 96 | Line 96 | namespace OpenMD {
96  
97    pAngle::pAngle(SimInfo* info, const std::string& filename,
98                   const std::string& sele1, int seleOffset, int nthetabins)
99 <    : StaticAnalyser(info, filename), selectionScript1_(sele1),  
100 <      evaluator1_(info), evaluator2_(info), seleMan1_(info), seleMan2_(info),
101 <      nThetaBins_(nthetabins), seleOffset_(seleOffset),
102 <      doVect_(false), doOffset_(true) {
99 >    : StaticAnalyser(info, filename), doVect_(false), doOffset_(true),
100 >      doOffset2_(false), selectionScript1_(sele1),  
101 >      seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info),
102 >      seleOffset_(seleOffset),  nThetaBins_(nthetabins) {
103      
104      setOutputName(getPrefix(filename) + ".pAngle");
105      
# Line 111 | Line 111 | namespace OpenMD {
111      count_.resize(nThetaBins_);
112      histogram_.resize(nThetaBins_);    
113    }
114 +
115 +  pAngle::pAngle(SimInfo* info, const std::string& filename,
116 +                 const std::string& sele1, int seleOffset, int seleOffset2,
117 +                 int nthetabins)
118 +    : StaticAnalyser(info, filename), doVect_(false), doOffset_(true),
119 +      doOffset2_(true), selectionScript1_(sele1),  
120 +      seleMan1_(info), seleMan2_(info), evaluator1_(info), evaluator2_(info),
121 +      seleOffset_(seleOffset), seleOffset2_(seleOffset2),
122 +      nThetaBins_(nthetabins) {
123 +    
124 +    setOutputName(getPrefix(filename) + ".pAngle");
125 +    
126 +    evaluator1_.loadScriptString(sele1);
127 +    if (!evaluator1_.isDynamic()) {
128 +      seleMan1_.setSelectionSet(evaluator1_.evaluate());
129 +    }            
130 +    
131 +    count_.resize(nThetaBins_);
132 +    histogram_.resize(nThetaBins_);    
133 +  }
134    
135    void pAngle::process() {
136      Molecule* mol;
# Line 162 | Line 182 | namespace OpenMD {
182            // only do this if the stunt double actually has a vector associated
183            // with it
184            if (sd1->isDirectional()) {
185 <            Vector3d vec = sd1->getA().getColumn(2);
166 <            RealType distance = r1.length();
167 <            
185 >            Vector3d vec = sd1->getA().getColumn(2);            
186              vec.normalize();
187              r1.normalize();
188              RealType cosangle = dot(r1, vec);
# Line 182 | Line 200 | namespace OpenMD {
200              // This will require careful rewriting if StaticProps is
201              // ever parallelized.  For an example, see
202              // Thermo::getTaggedAtomPairDistance
203 +            Vector3d r1;
204              
205 <            int sd2Index = sd1->getGlobalIndex() + seleOffset_;
206 <            sd2 = info_->getIOIndexToIntegrableObject(sd2Index);
207 <            
208 <            Vector3d r1 = CenterOfMass - sd1->getPos();
205 >            if (doOffset2_) {
206 >              int sd1Aind = sd1->getGlobalIndex() + seleOffset2_;
207 >              StuntDouble* sd1A = info_->getIOIndexToIntegrableObject(sd1Aind);
208 >              r1 = CenterOfMass - sd1A->getPos();              
209 >            } else {
210 >              r1 = CenterOfMass - sd1->getPos();
211 >            }
212 >
213              if (usePeriodicBoundaryConditions_)
214                currentSnapshot_->wrapVector(r1);
215 <            
215 >
216 >
217 >            int sd2Index = sd1->getGlobalIndex() + seleOffset_;
218 >            sd2 = info_->getIOIndexToIntegrableObject(sd2Index);
219 >
220              Vector3d r2 = CenterOfMass - sd2->getPos();
221              if (usePeriodicBoundaryConditions_)
222                currentSnapshot_->wrapVector(r1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines