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

Comparing trunk/src/applications/staticProps/DensityPlot.cpp (file contents):
Revision 565 by tim, Wed Jul 13 16:48:49 2005 UTC vs.
Revision 1442 by gezelter, Mon May 10 17:28:26 2010 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
35 + *                                                                      
36 + * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37 + * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 + * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 + * [4]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   #include <algorithm>
# Line 46 | Line 46
46   #include "io/DumpReader.hpp"
47   #include "primitives/Molecule.hpp"
48   #include "utils/NumericConstant.hpp"
49 < namespace oopse {
49 > namespace OpenMD {
50  
51  
52 < DensityPlot::DensityPlot(SimInfo* info, const std::string& filename, const std::string& sele, const std::string& cmSele, double len, int nrbins)
52 > DensityPlot::DensityPlot(SimInfo* info, const std::string& filename, const std::string& sele, const std::string& cmSele, RealType len, int nrbins)
53    : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info),
54      cmSelectionScript_(cmSele), cmEvaluator_(info), cmSeleMan_(info),    
55      len_(len), nRBins_(nrbins), halfLen_(len/2)     {
# Line 107 | Line 107 | void DensityPlot::process() {
107      Vector3d origin = calcNewOrigin();
108  
109      Mat3x3d hmat = currentSnapshot_->getHmat();
110 <    double slabVolume = deltaR_ * hmat(0, 0) * hmat(1, 1);
110 >    RealType slabVolume = deltaR_ * hmat(0, 0) * hmat(1, 1);
111      int k;
112      for (StuntDouble* sd = seleMan_.beginSelected(k); sd != NULL; sd = seleMan_.nextSelected(k)) {
113  
114  
115              if (!sd->isAtom()) {
116                  sprintf( painCave.errMsg, "Can not calculate electron density if it is not atom\n");
117 <                painCave.severity = OOPSE_ERROR;
117 >                painCave.severity = OPENMD_ERROR;
118                  painCave.isFatal = 1;
119                  simError();
120              }
# Line 123 | Line 123 | void DensityPlot::process() {
123              GenericData* data = atom->getAtomType()->getPropertyByName("nelectron");
124              if (data == NULL) {
125                  sprintf( painCave.errMsg, "Can not find Parameters for nelectron\n");
126 <                painCave.severity = OOPSE_ERROR;
126 >                painCave.severity = OPENMD_ERROR;
127                  painCave.isFatal = 1;
128                  simError();
129              }
# Line 132 | Line 132 | void DensityPlot::process() {
132              if (doubleData == NULL) {
133                  sprintf( painCave.errMsg,
134                       "Can not cast GenericData to DoubleGenericData\n");
135 <                painCave.severity = OOPSE_ERROR;
135 >                painCave.severity = OPENMD_ERROR;
136                  painCave.isFatal = 1;
137                  simError();  
138              }
139              
140 <            double nelectron = doubleData->getData();
140 >            RealType nelectron = doubleData->getData();
141  
142              data = atom->getAtomType()->getPropertyByName("LennardJones");
143              if (data == NULL) {
144                  sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n");
145 <                painCave.severity = OOPSE_ERROR;
145 >                painCave.severity = OPENMD_ERROR;
146                  painCave.isFatal = 1;
147                  simError();
148              }
# Line 151 | Line 151 | void DensityPlot::process() {
151              if (ljData == NULL) {
152                  sprintf( painCave.errMsg,
153                       "Can not cast GenericData to LJParam\n");
154 <                painCave.severity = OOPSE_ERROR;
154 >                painCave.severity = OPENMD_ERROR;
155                  painCave.isFatal = 1;
156                  simError();          
157              }
158  
159              LJParam ljParam = ljData->getData();
160 <            double sigma = ljParam.sigma * 0.5;
161 <            double sigma2 = sigma * sigma;
160 >            RealType sigma = ljParam.sigma * 0.5;
161 >            RealType sigma2 = sigma * sigma;
162  
163              Vector3d pos = sd->getPos() - origin;
164              for (int j =0; j < nRBins_; ++j) {
165                  Vector3d tmp(pos);
166 <                double zdist =j * deltaR_ - halfLen_;
166 >                RealType zdist =j * deltaR_ - halfLen_;
167                  tmp[2] += zdist;
168 <                currentSnapshot_->wrapVector(tmp);
168 >                if (usePeriodicBoundaryConditions_)
169 >                  currentSnapshot_->wrapVector(tmp);
170  
171 <                double wrappedZdist = tmp.z() + halfLen_;
171 >                RealType wrappedZdist = tmp.z() + halfLen_;
172                  if (wrappedZdist < 0.0 || wrappedZdist > len_) {
173                      continue;
174                  }
# Line 183 | Line 184 | void DensityPlot::process() {
184      }
185  
186    int nProcessed = nFrames /step_;
187 <  std::transform(density_.begin(), density_.end(), density_.begin(), std::bind2nd(std::divides<double>(), nProcessed));  
187 >  std::transform(density_.begin(), density_.end(), density_.begin(), std::bind2nd(std::divides<RealType>(), nProcessed));  
188    writeDensity();
189          
190  
# Line 194 | Line 195 | Vector3d DensityPlot::calcNewOrigin() {
195  
196      int i;
197      Vector3d newOrigin(0.0);
198 <    double totalMass = 0.0;
198 >    RealType totalMass = 0.0;
199      for (StuntDouble* sd = seleMan_.beginSelected(i); sd != NULL; sd = seleMan_.nextSelected(i)) {
200 <        double mass = sd->getMass();
200 >        RealType mass = sd->getMass();
201          totalMass += mass;
202          newOrigin += sd->getPos() * mass;        
203      }

Comparing trunk/src/applications/staticProps/DensityPlot.cpp (property svn:keywords):
Revision 565 by tim, Wed Jul 13 16:48:49 2005 UTC vs.
Revision 1442 by gezelter, Mon May 10 17:28:26 2010 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines