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

Comparing trunk/src/applications/staticProps/StaticProps.cpp (file contents):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1413 by gezelter, Mon Mar 22 19:21:22 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 <iostream>
# Line 52 | Line 52
52   #include "applications/staticProps/StaticPropsCmd.h"
53   #include "applications/staticProps/StaticAnalyser.hpp"
54   #include "applications/staticProps/GofR.hpp"
55 + #include "applications/staticProps/GofZ.hpp"
56   #include "applications/staticProps/GofRAngle.hpp"
57   #include "applications/staticProps/GofAngle2.hpp"
58   #include "applications/staticProps/GofXyz.hpp"
59   #include "applications/staticProps/P2OrderParameter.hpp"
60 + #include "applications/staticProps/BondOrderParameter.hpp"
61 + #include "applications/staticProps/BOPofR.hpp"
62 + #include "applications/staticProps/RippleOP.hpp"
63   #include "applications/staticProps/SCDOrderParameter.hpp"
64   #include "applications/staticProps/DensityPlot.hpp"
65   #include "applications/staticProps/RhoZ.hpp"
66 + #include "applications/staticProps/pAngle.hpp"
67 + #include "applications/staticProps/BondAngleDistribution.hpp"
68 + #include "applications/staticProps/NanoVolume.hpp"
69   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
70   #include "applications/staticProps/Hxy.hpp"
71   #endif
72 + #include "applications/staticProps/RhoR.hpp"
73  
74 < using namespace oopse;
74 > using namespace OpenMD;
75  
76   int main(int argc, char* argv[]){
77    
# Line 77 | Line 85 | int main(int argc, char* argv[]){
85      exit(1) ;
86    }
87  
88 <
81 <  //get the dumpfile name and meta-data file name
88 >  //get the dumpfile name
89    std::string dumpFileName = args_info.input_arg;
83
84  std::string mdFileName = dumpFileName.substr(0, dumpFileName.rfind(".")) + ".md";
85
86    
90    std::string sele1;
91    std::string sele2;
92 +  bool userSpecifiedSelect1;
93 +  bool userSpecifiedSelect2;
94  
95 +  // check the first selection argument, or set it to the environment
96 +  // variable, or failing that, set it to "select all"
97 +
98    if (args_info.sele1_given) {
99      sele1 = args_info.sele1_arg;
100 <  }else {
101 <    char*  sele1Env= getenv("OOPSE_SELE1");
100 >  } else {
101 >    char*  sele1Env= getenv("SELECTION1");
102      if (sele1Env) {
103        sele1 = sele1Env;
104 <    }else if (!args_info.scd_given) {
105 <      sprintf( painCave.errMsg,
98 <               "neither --sele1 option nor $OOPSE_SELE1 is set");
99 <      painCave.severity = OOPSE_ERROR;
100 <      painCave.isFatal = 1;
101 <      simError();
104 >    } else {
105 >      sele1 = "select all";
106      }
107    }
108 <    
108 >
109 >  // check the second selection argument, or set it to the environment
110 >  // variable, or failing that, set it to "select all"
111 >  
112    if (args_info.sele2_given) {
113      sele2 = args_info.sele2_arg;
114 <  }else {
115 <    char* sele2Env = getenv("OOPSE_SELE2");
114 >  } else {
115 >    char* sele2Env = getenv("SELECTION1");
116      if (sele2Env) {
117        sele2 = sele2Env;            
118 <    } else if (args_info.density_given) {
118 >    } else {
119        sele2 = "select all";
113    } else if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given)  {
114      sprintf( painCave.errMsg,
115               "neither --sele2 option nor $OOPSE_SELE2 is set");
116      painCave.severity = OOPSE_ERROR;
117      painCave.isFatal = 1;
118      simError();        
120      }
121    }
122  
123 +
124 +  // Problems if sele1 wasn't specified, but
125 + // if (!args_info.scd_given) {
126 + //       sprintf( painCave.errMsg,
127 + //                "neither --sele1 option nor $SELECTION1 is set");
128 + //       painCave.severity = OPENMD_ERROR;
129 + //       painCave.isFatal = 1;
130 + //       simError();
131 + //     }
132 + //   }
133 +
134 +  // Problems if sele1 wasn't specified
135 +
136 + //     if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given)  {
137 + //       sprintf( painCave.errMsg,
138 + //                "neither --sele2 option nor $SELECTION1 is set");
139 + //       painCave.severity = OPENMD_ERROR;
140 + //       painCave.isFatal = 1;
141 + //       simError();        
142 + //     }
143 + //   }
144 +
145    bool batchMode;
146    if (args_info.scd_given){
147      if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) {
148 <        batchMode = false;
148 >      batchMode = false;
149      } else if (args_info.molname_given && args_info.begin_given && args_info.end_given) {
150 <        if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) {
128 <            sprintf( painCave.errMsg,
129 <                     "below conditions are not satisfied:\n"
130 <                     "0 <= begin && 0<= end && begin <= end-2\n");
131 <            painCave.severity = OOPSE_ERROR;
132 <            painCave.isFatal = 1;
133 <            simError();                    
134 <        }
135 <        batchMode = true;        
136 <    } else{
150 >      if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) {
151          sprintf( painCave.errMsg,
152 <                 "either --sele1, --sele2, --sele3 are specified,"
153 <                 " or --molname, --begin, --end are specified\n");
154 <        painCave.severity = OOPSE_ERROR;
152 >                 "below conditions are not satisfied:\n"
153 >                 "0 <= begin && 0<= end && begin <= end-2\n");
154 >        painCave.severity = OPENMD_ERROR;
155          painCave.isFatal = 1;
156 <        simError();        
156 >        simError();                    
157 >      }
158 >      batchMode = true;        
159 >    } else{
160 >      sprintf( painCave.errMsg,
161 >               "either --sele1, --sele2, --sele3 are specified,"
162 >               " or --molname, --begin, --end are specified\n");
163 >      painCave.severity = OPENMD_ERROR;
164 >      painCave.isFatal = 1;
165 >      simError();        
166      
167      }
168    }
169  
170    //parse md file and set up the system
171    SimCreator creator;
172 <  SimInfo* info = creator.createSim(mdFileName);
172 >  std::cout << "dumpFile = " << dumpFileName << "\n";
173 >  SimInfo* info = creator.createSim(dumpFileName);
174  
175    RealType maxLen;
176    if (args_info.length_given) {
# Line 158 | Line 182 | int main(int argc, char* argv[]){
182  
183    StaticAnalyser* analyser;
184    if (args_info.gofr_given){
185 <    analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg);        
185 >    analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen,
186 >                       args_info.nbins_arg);        
187 >  } else if (args_info.gofz_given) {
188 >    analyser= new GofZ(info, dumpFileName, sele1, sele2, maxLen,
189 >                       args_info.nbins_arg);
190    } else if (args_info.r_theta_given) {
191 <    analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg, args_info.nanglebins_arg);
191 >    analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen,
192 >                              args_info.nbins_arg, args_info.nanglebins_arg);
193    } else if (args_info.r_omega_given) {
194 <    analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg, args_info.nanglebins_arg);
194 >    analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen,
195 >                              args_info.nbins_arg, args_info.nanglebins_arg);
196    } else if (args_info.theta_omega_given) {
197 <    analyser  = new GofAngle2(info, dumpFileName, sele1, sele2, args_info.nanglebins_arg);
197 >    analyser  = new GofAngle2(info, dumpFileName, sele1, sele2,
198 >                              args_info.nanglebins_arg);
199    } else if (args_info.gxyz_given) {
200      if (args_info.refsele_given) {
201 <      analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg, maxLen, args_info.nrbins_arg);        
201 >      analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg,
202 >                           maxLen, args_info.nbins_arg);        
203      } else {
204        sprintf( painCave.errMsg,
205                 "--refsele must set when --gxyz is used");
206 <      painCave.severity = OOPSE_ERROR;
206 >      painCave.severity = OPENMD_ERROR;
207        painCave.isFatal = 1;
208        simError();  
209      }
210    } else if (args_info.p2_given) {
211 <      analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
211 >    analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
212 >  } else if (args_info.rp2_given){
213 >    analyser = new RippleOP(info, dumpFileName, sele1, sele2);
214 >  } else if (args_info.bo_given){
215 >    if (args_info.rcut_given) {
216 >      analyser = new BondOrderParameter(info, dumpFileName, sele1,
217 >                                        args_info.rcut_arg,
218 >                                        args_info.nbins_arg);
219 >    } else {
220 >      sprintf( painCave.errMsg,
221 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
222 >      painCave.severity = OPENMD_ERROR;
223 >      painCave.isFatal = 1;
224 >      simError();
225 >    }
226 >  } else if (args_info.bor_given){
227 >    if (args_info.rcut_given) {
228 >      analyser = new BOPofR(info, dumpFileName, sele1, args_info.rcut_arg,
229 >                            args_info.nbins_arg, maxLen);
230 >    } else {
231 >      sprintf( painCave.errMsg,
232 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
233 >      painCave.severity = OPENMD_ERROR;
234 >      painCave.isFatal = 1;
235 >      simError();
236 >    }
237 >  } else if (args_info.bad_given){
238 >    if (args_info.rcut_given) {
239 >      analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg,
240 >                            args_info.nbins_arg);
241 >    } else {
242 >      sprintf( painCave.errMsg,
243 >               "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions");
244 >      painCave.severity = OPENMD_ERROR;
245 >      painCave.isFatal = 1;
246 >      simError();
247 >    }
248    } else if (args_info.scd_given) {
249 <      if (batchMode) {
250 <          analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg,
251 <            args_info.begin_arg, args_info.end_arg);
252 <      } else{
253 <          std::string sele3 = args_info.sele3_arg;
254 <          analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3);
255 <      }
249 >    if (batchMode) {
250 >      analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg,
251 >                                        args_info.begin_arg, args_info.end_arg);
252 >    } else{
253 >      std::string sele3 = args_info.sele3_arg;
254 >      analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3);
255 >    }
256    }else if (args_info.density_given) {
257 <      analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg);  
257 >    analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen,
258 >                              args_info.nbins_arg);  
259    } else if (args_info.slab_density_given) {
260 <      Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat();
261 <      analyser = new RhoZ(info, dumpFileName, sele1, hmat(2, 2), args_info.nrbins_arg);
260 >    analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg);
261 >  } else if (args_info.p_angle_given) {
262 >    analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg);
263   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
264    }else if (args_info.hxy_given) {
265 <    analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg, args_info.nbins_y_arg, args_info.nrbins_arg);
265 >    analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg,
266 >                       args_info.nbins_y_arg, args_info.nbins_arg);
267   #endif
268 +  }else if (args_info.rho_r_given) {
269 +    if (args_info.radius_given){
270 +      analyser = new RhoR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg,args_info.radius_arg);
271 +    }else{
272 +      sprintf( painCave.errMsg,
273 +               "A particle radius (radius) must be specified when calculating Rho(r)");
274 +      painCave.severity = OPENMD_ERROR;
275 +      painCave.isFatal = 1;
276 +      simError();
277 +    }
278 +        }else if (args_info.hullvol_given) {
279 +    analyser = new NanoVolume(info, dumpFileName, sele1);
280    }
281 <    
281 >  
282    if (args_info.output_given) {
283      analyser->setOutputName(args_info.output_arg);
284    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines