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 1026 by gezelter, Wed Aug 30 21:04:04 2006 UTC vs.
Revision 1992 by gezelter, Thu Apr 24 17:30:00 2014 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, 234107 (2008).          
39 + * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <iostream>
44   #include <fstream>
45   #include <string>
46  
46 #include "brains/Register.hpp"
47   #include "brains/SimCreator.hpp"
48   #include "brains/SimInfo.hpp"
49   #include "io/DumpReader.hpp"
# 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/GofRZ.hpp"
57   #include "applications/staticProps/GofRAngle.hpp"
58   #include "applications/staticProps/GofAngle2.hpp"
59   #include "applications/staticProps/GofXyz.hpp"
60 + #include "applications/staticProps/TwoDGofR.hpp"
61   #include "applications/staticProps/P2OrderParameter.hpp"
62 + #include "applications/staticProps/BondOrderParameter.hpp"
63 + #include "applications/staticProps/BOPofR.hpp"
64   #include "applications/staticProps/RippleOP.hpp"
65   #include "applications/staticProps/SCDOrderParameter.hpp"
66   #include "applications/staticProps/DensityPlot.hpp"
67 + #include "applications/staticProps/ObjectCount.hpp"
68   #include "applications/staticProps/RhoZ.hpp"
69 + #include "applications/staticProps/pAngle.hpp"
70 + #include "applications/staticProps/BondAngleDistribution.hpp"
71 + #include "applications/staticProps/NanoVolume.hpp"
72 + #include "applications/staticProps/NanoLength.hpp"
73   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
74   #include "applications/staticProps/Hxy.hpp"
75   #endif
76 + #include "applications/staticProps/RhoR.hpp"
77 + #include "applications/staticProps/AngleR.hpp"
78 + #include "applications/staticProps/TetrahedralityParam.hpp"
79 + #include "applications/staticProps/TetrahedralityParamZ.hpp"
80 + #include "applications/staticProps/RNEMDStats.hpp"
81  
82 < using namespace oopse;
82 > using namespace OpenMD;
83  
84   int main(int argc, char* argv[]){
85    
86 <  //register force fields
72 <  registerForceFields();
73 <
86 >  
87    gengetopt_args_info args_info;
88 <
88 >  
89    //parse the command line option
90    if (cmdline_parser (argc, argv, &args_info) != 0) {
91      exit(1) ;
92    }
93 <
94 <
82 <  //get the dumpfile name and meta-data file name
93 >  
94 >  //get the dumpfile name
95    std::string dumpFileName = args_info.input_arg;
84
85    
96    std::string sele1;
97    std::string sele2;
98 <
98 >  
99 >  // check the first selection argument, or set it to the environment
100 >  // variable, or failing that, set it to "select all"
101 >  
102    if (args_info.sele1_given) {
103      sele1 = args_info.sele1_arg;
104 <  }else {
105 <    char*  sele1Env= getenv("OOPSE_SELE1");
104 >  } else {
105 >    char*  sele1Env= getenv("SELECTION1");
106      if (sele1Env) {
107        sele1 = sele1Env;
108 <    }else if (!args_info.scd_given) {
109 <      sprintf( painCave.errMsg,
97 <               "neither --sele1 option nor $OOPSE_SELE1 is set");
98 <      painCave.severity = OOPSE_ERROR;
99 <      painCave.isFatal = 1;
100 <      simError();
108 >    } else {
109 >      sele1 = "select all";
110      }
111    }
112 <    
112 >  
113 >  // check the second selection argument, or set it to the environment
114 >  // variable, or failing that, set it to the first selection
115 >  
116    if (args_info.sele2_given) {
117      sele2 = args_info.sele2_arg;
118 <  }else {
119 <    char* sele2Env = getenv("OOPSE_SELE2");
118 >  } else {
119 >    char* sele2Env = getenv("SELECTION2");
120      if (sele2Env) {
121        sele2 = sele2Env;            
122 <    } else if (args_info.density_given) {
123 <      sele2 = "select all";
124 <    } else if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given)  {
125 <      sprintf( painCave.errMsg,
114 <               "neither --sele2 option nor $OOPSE_SELE2 is set");
115 <      painCave.severity = OOPSE_ERROR;
116 <      painCave.isFatal = 1;
117 <      simError();        
122 >    } else {
123 >      //If sele2 is not specified, then the default behavior
124 >      //should be what is already intended for sele1
125 >      sele2 = sele1;
126      }
127    }
128  
129    bool batchMode;
130    if (args_info.scd_given){
131 <    if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) {
132 <        batchMode = false;
133 <    } else if (args_info.molname_given && args_info.begin_given && args_info.end_given) {
134 <        if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) {
135 <            sprintf( painCave.errMsg,
136 <                     "below conditions are not satisfied:\n"
137 <                     "0 <= begin && 0<= end && begin <= end-2\n");
130 <            painCave.severity = OOPSE_ERROR;
131 <            painCave.isFatal = 1;
132 <            simError();                    
133 <        }
134 <        batchMode = true;        
135 <    } else{
131 >    if (args_info.sele1_given &&
132 >        args_info.sele2_given && args_info.sele3_given) {
133 >      batchMode = false;
134 >    } else if (args_info.molname_given &&
135 >               args_info.begin_given && args_info.end_given) {
136 >      if (args_info.begin_arg < 0 ||
137 >          args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) {
138          sprintf( painCave.errMsg,
139 <                 "either --sele1, --sele2, --sele3 are specified,"
140 <                 " or --molname, --begin, --end are specified\n");
141 <        painCave.severity = OOPSE_ERROR;
139 >                 "below conditions are not satisfied:\n"
140 >                 "0 <= begin && 0<= end && begin <= end-2\n");
141 >        painCave.severity = OPENMD_ERROR;
142          painCave.isFatal = 1;
143 <        simError();        
144 <    
143 >        simError();                    
144 >      }
145 >      batchMode = true;        
146 >    } else{
147 >      sprintf( painCave.errMsg,
148 >               "either --sele1, --sele2, --sele3 are specified,"
149 >               " or --molname, --begin, --end are specified\n");
150 >      painCave.severity = OPENMD_ERROR;
151 >      painCave.isFatal = 1;
152 >      simError();
153      }
154    }
155 <
155 >  
156    //parse md file and set up the system
157    SimCreator creator;
158    SimInfo* info = creator.createSim(dumpFileName);
159  
160    RealType maxLen;
161 +  RealType zmaxLen;
162    if (args_info.length_given) {
163      maxLen = args_info.length_arg;
164 +    if (args_info.zlength_given){
165 +      zmaxLen = args_info.zlength_arg;
166 +    }
167    } else {
168      Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat();
169 <    maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0;        
169 >    maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0;
170 >    zmaxLen = hmat(2,2);    
171    }    
172 <
172 >  
173    StaticAnalyser* analyser;
174    if (args_info.gofr_given){
175 <    analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg);        
175 >    analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen,
176 >                       args_info.nbins_arg);        
177 >  } else if (args_info.gofz_given) {
178 >    analyser= new GofZ(info, dumpFileName, sele1, sele2, maxLen,
179 >                       args_info.nbins_arg);
180 >  } else if (args_info.r_z_given) {
181 >    analyser  = new GofRZ(info, dumpFileName, sele1, sele2, maxLen, zmaxLen,
182 >                          args_info.nbins_arg, args_info.nbins_z_arg);
183    } else if (args_info.r_theta_given) {
184 <    analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg, args_info.nanglebins_arg);
184 >    analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen,
185 >                              args_info.nbins_arg, args_info.nanglebins_arg);
186    } else if (args_info.r_omega_given) {
187 <    analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg, args_info.nanglebins_arg);
187 >    analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen,
188 >                              args_info.nbins_arg, args_info.nanglebins_arg);
189    } else if (args_info.theta_omega_given) {
190 <    analyser  = new GofAngle2(info, dumpFileName, sele1, sele2, args_info.nanglebins_arg);
190 >    analyser  = new GofAngle2(info, dumpFileName, sele1, sele2,
191 >                              args_info.nanglebins_arg);
192    } else if (args_info.gxyz_given) {
193      if (args_info.refsele_given) {
194 <      analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg, maxLen, args_info.nrbins_arg);        
194 >      analyser= new GofXyz(info, dumpFileName, sele1, sele2,
195 >                           args_info.refsele_arg, maxLen, args_info.nbins_arg);
196      } else {
197        sprintf( painCave.errMsg,
198 <               "--refsele must set when --gxyz is used");
199 <      painCave.severity = OOPSE_ERROR;
198 >               "--refsele must set when --gxyz is used");
199 >      painCave.severity = OPENMD_ERROR;
200        painCave.isFatal = 1;
201        simError();  
202      }
203 <  } else if (args_info.p2_given) {
204 <      analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
205 <  }    else if (args_info.rp2_given){
206 <      analyser = new RippleOP(info, dumpFileName, sele1, sele2);
207 < }else if (args_info.scd_given) {
208 <      if (batchMode) {
209 <          analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg,
210 <            args_info.begin_arg, args_info.end_arg);
211 <      } else{
212 <          std::string sele3 = args_info.sele3_arg;
213 <          analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3);
214 <      }
215 <  }else if (args_info.density_given) {
216 <      analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, args_info.nrbins_arg);  
203 >  } else if (args_info.twodgofr_given){
204 >    if (args_info.dz_given) {
205 >      analyser= new TwoDGofR(info, dumpFileName, sele1, sele2, maxLen,
206 >                             args_info.dz_arg, args_info.nbins_arg);        
207 >    } else {
208 >      sprintf( painCave.errMsg,
209 >               "A slab width (dz) must be specified when calculating TwoDGofR");
210 >      painCave.severity = OPENMD_ERROR;
211 >      painCave.isFatal = 1;
212 >      simError();
213 >    }    
214 >  } else if (args_info.p2_given) {
215 >    if (args_info.sele1_given) {    
216 >      if (args_info.sele2_given)
217 >        analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
218 >      else
219 >        if (args_info.seleoffset_given)
220 >          analyser  = new P2OrderParameter(info, dumpFileName, sele1,
221 >                                           args_info.seleoffset_arg);
222 >        else
223 >          analyser  = new P2OrderParameter(info, dumpFileName, sele1);
224 >    } else {
225 >      sprintf( painCave.errMsg,
226 >               "At least one selection script (--sele1) must be specified when calculating P2 order parameters");
227 >      painCave.severity = OPENMD_ERROR;
228 >      painCave.isFatal = 1;
229 >      simError();
230 >    }
231 >  } else if (args_info.rp2_given){
232 >    analyser = new RippleOP(info, dumpFileName, sele1, sele2);
233 >  } else if (args_info.bo_given){
234 >    if (args_info.rcut_given) {
235 >      analyser = new BondOrderParameter(info, dumpFileName, sele1,
236 >                                        args_info.rcut_arg,
237 >                                        args_info.nbins_arg);
238 >    } else {
239 >      sprintf( painCave.errMsg,
240 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
241 >      painCave.severity = OPENMD_ERROR;
242 >      painCave.isFatal = 1;
243 >      simError();
244 >    }
245 >    
246 >  } else if (args_info.tet_param_given) {
247 >    if (args_info.rcut_given) {  
248 >      analyser = new TetrahedralityParam(info, dumpFileName, sele1,
249 >                                         args_info.rcut_arg,
250 >                                         args_info.nbins_arg);
251 >    } else {
252 >      sprintf( painCave.errMsg,
253 >               "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters");
254 >      painCave.severity = OPENMD_ERROR;
255 >      painCave.isFatal = 1;
256 >      simError();
257 >    }
258 >  } else if (args_info.tet_param_z_given) {
259 >    if (args_info.rcut_given) {  
260 >      analyser = new TetrahedralityParamZ(info, dumpFileName, sele1, sele2,
261 >                                          args_info.rcut_arg,
262 >                                          args_info.nbins_arg);
263 >    } else {
264 >      sprintf( painCave.errMsg,
265 >               "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters");
266 >      painCave.severity = OPENMD_ERROR;
267 >      painCave.isFatal = 1;
268 >      simError();
269 >    }
270 >  } else if (args_info.ior_given){
271 >    if (args_info.rcut_given) {
272 >      analyser = new IcosahedralOfR(info, dumpFileName, sele1,
273 >                                    args_info.rcut_arg,
274 >                                    args_info.nbins_arg, maxLen);
275 >    } else {
276 >      sprintf( painCave.errMsg,
277 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
278 >      painCave.severity = OPENMD_ERROR;
279 >      painCave.isFatal = 1;
280 >      simError();
281 >    }
282 >  } else if (args_info.for_given){
283 >    if (args_info.rcut_given) {
284 >      analyser = new FCCOfR(info, dumpFileName, sele1, args_info.rcut_arg,
285 >                            args_info.nbins_arg, maxLen);
286 >    } else {
287 >      sprintf( painCave.errMsg,
288 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
289 >      painCave.severity = OPENMD_ERROR;
290 >      painCave.isFatal = 1;
291 >      simError();
292 >    }
293 >  } else if (args_info.bad_given){
294 >    if (args_info.rcut_given) {
295 >      analyser = new BondAngleDistribution(info, dumpFileName, sele1,
296 >                                           args_info.rcut_arg,
297 >                                           args_info.nbins_arg);
298 >    } else {
299 >      sprintf( painCave.errMsg,
300 >               "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions");
301 >      painCave.severity = OPENMD_ERROR;
302 >      painCave.isFatal = 1;
303 >      simError();
304 >    }
305 >  } else if (args_info.scd_given) {
306 >    if (batchMode) {
307 >      analyser  = new SCDOrderParameter(info, dumpFileName,
308 >                                        args_info.molname_arg,
309 >                                        args_info.begin_arg, args_info.end_arg);
310 >    } else{
311 >      std::string sele3 = args_info.sele3_arg;
312 >      analyser  = new SCDOrderParameter(info, dumpFileName,
313 >                                        sele1, sele2, sele3);
314 >    }
315 >  }else if (args_info.density_given) {
316 >    analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen,
317 >                              args_info.nbins_arg);  
318 >  } else if (args_info.count_given) {
319 >    analyser = new ObjectCount(info, dumpFileName, sele1 );
320    } else if (args_info.slab_density_given) {
321 <      Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat();
322 <      analyser = new RhoZ(info, dumpFileName, sele1, hmat(2, 2), args_info.nrbins_arg);
321 >    analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg);
322 >  } else if (args_info.rnemdz_given) {
323 >    analyser = new RNEMDZ(info, dumpFileName, sele1, args_info.nbins_arg);
324 >  } else if (args_info.rnemdr_given) {
325 >    analyser = new RNEMDR(info, dumpFileName, sele1, args_info.nbins_arg);
326 >  } else if (args_info.rnemdrt_given) {
327 >    analyser = new RNEMDRTheta(info, dumpFileName, sele1,
328 >                               args_info.nbins_arg, args_info.nanglebins_arg);
329 >  } else if (args_info.p_angle_given) {
330 >    if (args_info.sele1_given) {    
331 >      if (args_info.sele2_given)
332 >        analyser  = new pAngle(info, dumpFileName, sele1, sele2,
333 >                               args_info.nbins_arg);
334 >      else
335 >        if (args_info.seleoffset_given) {
336 >          if (args_info.seleoffset2_given) {
337 >            analyser  = new pAngle(info, dumpFileName, sele1,
338 >                                   args_info.seleoffset_arg,
339 >                                   args_info.seleoffset2_arg,
340 >                                   args_info.nbins_arg);
341 >          } else {
342 >            analyser  = new pAngle(info, dumpFileName, sele1,
343 >                                   args_info.seleoffset_arg,
344 >                                   args_info.nbins_arg);
345 >          }
346 >        } else
347 >          analyser  = new pAngle(info, dumpFileName, sele1,
348 >                                 args_info.nbins_arg);
349 >    } else {
350 >      sprintf( painCave.errMsg,
351 >               "At least one selection script (--sele1) must be specified when "
352 >               "calculating P(angle) distributions");
353 >      painCave.severity = OPENMD_ERROR;
354 >      painCave.isFatal = 1;
355 >      simError();
356 >    }
357   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
358    }else if (args_info.hxy_given) {
359 <    analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg, args_info.nbins_y_arg, args_info.nrbins_arg);
359 >    analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg,
360 >                       args_info.nbins_y_arg, args_info.nbins_arg);
361   #endif
362 +  }else if (args_info.rho_r_given) {
363 +    if (args_info.radius_given){
364 +      analyser = new RhoR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg,args_info.radius_arg);
365 +    }else{
366 +      sprintf( painCave.errMsg,
367 +               "A particle radius (radius) must be specified when calculating Rho(r)");
368 +      painCave.severity = OPENMD_ERROR;
369 +      painCave.isFatal = 1;
370 +      simError();
371 +    }
372 +  } else if (args_info.hullvol_given) {
373 +    analyser = new NanoVolume(info, dumpFileName, sele1);
374 +  } else if (args_info.rodlength_given) {
375 +    analyser = new NanoLength(info, dumpFileName, sele1);
376 +  } else if (args_info.angle_r_given) {
377 +    analyser = new AngleR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg);
378    }
379 <    
379 >  
380    if (args_info.output_given) {
381      analyser->setOutputName(args_info.output_arg);
382    }
383    if (args_info.step_given) {
384      analyser->setStep(args_info.step_arg);
385    }
386 <
386 >  
387    analyser->process();
388 <
388 >  
389    delete analyser;    
390    delete info;
391 <
391 >  
392    return 0;  
393   }
214

Comparing trunk/src/applications/staticProps/StaticProps.cpp (property svn:keywords):
Revision 1026 by gezelter, Wed Aug 30 21:04:04 2006 UTC vs.
Revision 1992 by gezelter, Thu Apr 24 17:30:00 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines