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 1180 by chuckv, Mon Sep 17 20:05:51 2007 UTC vs.
Revision 1542 by gezelter, Thu Mar 3 20:32:49 2011 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/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   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
73   #include "applications/staticProps/Hxy.hpp"
74   #endif
75   #include "applications/staticProps/RhoR.hpp"
76 + #include "applications/staticProps/AngleR.hpp"
77 + #include "applications/staticProps/RhoAngleR.hpp"
78 + #include "applications/staticProps/TetrahedralityParam.hpp"
79  
80 < using namespace oopse;
80 > using namespace OpenMD;
81  
82   int main(int argc, char* argv[]){
83    
84    //register force fields
85    registerForceFields();
86 <
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 <
93 >  
94    //get the dumpfile name
95    std::string dumpFileName = args_info.input_arg;
96    std::string sele1;
97    std::string sele2;
98    bool userSpecifiedSelect1;
99    bool userSpecifiedSelect2;
100 <
100 >  
101    // check the first selection argument, or set it to the environment
102    // variable, or failing that, set it to "select all"
103 <
103 >  
104    if (args_info.sele1_given) {
105      sele1 = args_info.sele1_arg;
106    } else {
107 <    char*  sele1Env= getenv("OOPSE_SELE1");
107 >    char*  sele1Env= getenv("SELECTION1");
108      if (sele1Env) {
109        sele1 = sele1Env;
110      } else {
111        sele1 = "select all";
112      }
113    }
114 <
114 >  
115    // check the second selection argument, or set it to the environment
116    // variable, or failing that, set it to "select all"
117    
118    if (args_info.sele2_given) {
119      sele2 = args_info.sele2_arg;
120    } else {
121 <    char* sele2Env = getenv("OOPSE_SELE2");
121 >    char* sele2Env = getenv("SELECTION1");
122      if (sele2Env) {
123        sele2 = sele2Env;            
124      } else {
125        sele2 = "select all";
126      }
127    }
128 <
129 <
128 >  
129 >  
130    // Problems if sele1 wasn't specified, but
131 < // if (!args_info.scd_given) {
132 < //       sprintf( painCave.errMsg,
133 < //                "neither --sele1 option nor $OOPSE_SELE1 is set");
134 < //       painCave.severity = OOPSE_ERROR;
135 < //       painCave.isFatal = 1;
136 < //       simError();
137 < //     }
138 < //   }
139 <
131 >  // if (!args_info.scd_given) {
132 >  //       sprintf( painCave.errMsg,
133 >  //                "neither --sele1 option nor $SELECTION1 is set");
134 >  //       painCave.severity = OPENMD_ERROR;
135 >  //       painCave.isFatal = 1;
136 >  //       simError();
137 >  //     }
138 >  //   }
139 >  
140    // Problems if sele1 wasn't specified
141 <
142 < //     if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given)  {
143 < //       sprintf( painCave.errMsg,
144 < //                "neither --sele2 option nor $OOPSE_SELE2 is set");
145 < //       painCave.severity = OOPSE_ERROR;
146 < //       painCave.isFatal = 1;
147 < //       simError();        
148 < //     }
149 < //   }
150 <
141 >  
142 >  //     if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given)  {
143 >  //       sprintf( painCave.errMsg,
144 >  //                "neither --sele2 option nor $SELECTION1 is set");
145 >  //       painCave.severity = OPENMD_ERROR;
146 >  //       painCave.isFatal = 1;
147 >  //       simError();        
148 >  //     }
149 >  //   }
150 >  
151    bool batchMode;
152    if (args_info.scd_given){
153      if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) {
# Line 149 | Line 157 | int main(int argc, char* argv[]){
157          sprintf( painCave.errMsg,
158                   "below conditions are not satisfied:\n"
159                   "0 <= begin && 0<= end && begin <= end-2\n");
160 <        painCave.severity = OOPSE_ERROR;
160 >        painCave.severity = OPENMD_ERROR;
161          painCave.isFatal = 1;
162          simError();                    
163        }
# Line 158 | Line 166 | int main(int argc, char* argv[]){
166        sprintf( painCave.errMsg,
167                 "either --sele1, --sele2, --sele3 are specified,"
168                 " or --molname, --begin, --end are specified\n");
169 <      painCave.severity = OOPSE_ERROR;
169 >      painCave.severity = OPENMD_ERROR;
170        painCave.isFatal = 1;
171        simError();        
172 <    
172 >      
173      }
174    }
175 <
175 >  
176    //parse md file and set up the system
177    SimCreator creator;
178    std::cout << "dumpFile = " << dumpFileName << "\n";
179    SimInfo* info = creator.createSim(dumpFileName);
180  
181    RealType maxLen;
182 +  RealType zmaxLen;
183    if (args_info.length_given) {
184      maxLen = args_info.length_arg;
185 +    if (args_info.zlength_given){
186 +      zmaxLen = args_info.zlength_arg;
187 +    }
188    } else {
189      Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat();
190 <    maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0;        
190 >    maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0;
191 >    zmaxLen = hmat(2,2);    
192    }    
193 <
193 >  
194    StaticAnalyser* analyser;
195    if (args_info.gofr_given){
196      analyser= new GofR(info, dumpFileName, sele1, sele2, maxLen,
197 <                       args_info.nbins_arg);        
197 >                       args_info.nbins_arg);        
198 >  } else if (args_info.gofz_given) {
199 >    analyser= new GofZ(info, dumpFileName, sele1, sele2, maxLen,
200 >                       args_info.nbins_arg);
201 >  } else if (args_info.r_z_given) {
202 >    analyser  = new GofRZ(info, dumpFileName, sele1, sele2, maxLen, zmaxLen,
203 >                          args_info.nbins_arg, args_info.nbins_z_arg);
204    } else if (args_info.r_theta_given) {
205      analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen,
206 <                              args_info.nbins_arg, args_info.nanglebins_arg);
206 >                              args_info.nbins_arg, args_info.nanglebins_arg);
207    } else if (args_info.r_omega_given) {
208      analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen,
209 <                              args_info.nbins_arg, args_info.nanglebins_arg);
209 >                              args_info.nbins_arg, args_info.nanglebins_arg);
210    } else if (args_info.theta_omega_given) {
211      analyser  = new GofAngle2(info, dumpFileName, sele1, sele2,
212 <                              args_info.nanglebins_arg);
212 >                              args_info.nanglebins_arg);
213    } else if (args_info.gxyz_given) {
214      if (args_info.refsele_given) {
215        analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg,
216 <                           maxLen, args_info.nbins_arg);        
216 >                           maxLen, args_info.nbins_arg);        
217      } else {
218        sprintf( painCave.errMsg,
219 <               "--refsele must set when --gxyz is used");
220 <      painCave.severity = OOPSE_ERROR;
219 >               "--refsele must set when --gxyz is used");
220 >      painCave.severity = OPENMD_ERROR;
221        painCave.isFatal = 1;
222        simError();  
223      }
224 +  } else if (args_info.twodgofr_given){
225 +    if (args_info.dz_given) {
226 +      analyser= new TwoDGofR(info, dumpFileName, sele1, sele2, maxLen,
227 +                             args_info.dz_arg, args_info.nbins_arg);        
228 +    } else {
229 +      sprintf( painCave.errMsg,
230 +               "A slab width (dz) must be specified when calculating TwoDGofR");
231 +      painCave.severity = OPENMD_ERROR;
232 +      painCave.isFatal = 1;
233 +      simError();
234 +    }    
235    } else if (args_info.p2_given) {
236 <    analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
236 >    if (args_info.sele1_given) {    
237 >      if (args_info.sele2_given)
238 >        analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2);
239 >      else
240 >        analyser  = new P2OrderParameter(info, dumpFileName, sele1);
241 >    } else {
242 >      sprintf( painCave.errMsg,
243 >               "At least one selection script (--sele1) must be specified when calculating P2 order parameters");
244 >      painCave.severity = OPENMD_ERROR;
245 >      painCave.isFatal = 1;
246 >      simError();
247 >    }
248    } else if (args_info.rp2_given){
249      analyser = new RippleOP(info, dumpFileName, sele1, sele2);
250    } else if (args_info.bo_given){
251      if (args_info.rcut_given) {
252        analyser = new BondOrderParameter(info, dumpFileName, sele1,
253 <                                        args_info.rcut_arg,
254 <                                        args_info.nbins_arg);
253 >                                        args_info.rcut_arg,
254 >                                        args_info.nbins_arg);
255      } else {
256        sprintf( painCave.errMsg,
257 <               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
258 <      painCave.severity = OOPSE_ERROR;
257 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
258 >      painCave.severity = OPENMD_ERROR;
259        painCave.isFatal = 1;
260        simError();
261      }
262 +    
263 +  } else if (args_info.tet_param_given) {
264 +    if (args_info.rcut_given) {  
265 +      analyser = new TetrahedralityParam(info, dumpFileName, sele1,
266 +                                         args_info.rcut_arg,
267 +                                         args_info.nbins_arg);
268 +    } else {
269 +      sprintf( painCave.errMsg,
270 +               "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters");
271 +      painCave.severity = OPENMD_ERROR;
272 +      painCave.isFatal = 1;
273 +      simError();
274 +    }
275    } else if (args_info.bor_given){
276      if (args_info.rcut_given) {
277        analyser = new BOPofR(info, dumpFileName, sele1, args_info.rcut_arg,
278                              args_info.nbins_arg, maxLen);
279      } else {
280        sprintf( painCave.errMsg,
281 <               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
282 <      painCave.severity = OOPSE_ERROR;
281 >               "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters");
282 >      painCave.severity = OPENMD_ERROR;
283        painCave.isFatal = 1;
284        simError();
285      }
286    } else if (args_info.bad_given){
287      if (args_info.rcut_given) {
288        analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg,
289 <                            args_info.nbins_arg);
289 >                                           args_info.nbins_arg);
290      } else {
291        sprintf( painCave.errMsg,
292 <               "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions");
293 <      painCave.severity = OOPSE_ERROR;
292 >               "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions");
293 >      painCave.severity = OPENMD_ERROR;
294        painCave.isFatal = 1;
295        simError();
296 <    }
296 >      }
297    } else if (args_info.scd_given) {
298      if (batchMode) {
299        analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg,
300 <                                        args_info.begin_arg, args_info.end_arg);
300 >                                        args_info.begin_arg, args_info.end_arg);
301      } else{
302        std::string sele3 = args_info.sele3_arg;
303        analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3);
304      }
305    }else if (args_info.density_given) {
306 <    analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen,
307 <                              args_info.nbins_arg);  
306 >    analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen,
307 >                              args_info.nbins_arg);  
308 >  } else if (args_info.count_given) {
309 >    analyser = new ObjectCount(info, dumpFileName, sele1 );
310    } else if (args_info.slab_density_given) {
311 <    Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat();
312 <    analyser = new RhoZ(info, dumpFileName, sele1, hmat(2, 2), args_info.nbins_arg);
311 >    analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg);
312 >  } else if (args_info.p_angle_given) {
313 >    analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg);
314   #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
315    }else if (args_info.hxy_given) {
316      analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg,
317 <                       args_info.nbins_y_arg, args_info.nbins_arg);
317 >                       args_info.nbins_y_arg, args_info.nbins_arg);
318   #endif
319    }else if (args_info.rho_r_given) {
320      if (args_info.radius_given){
321        analyser = new RhoR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg,args_info.radius_arg);
322      }else{
323        sprintf( painCave.errMsg,
324 <               "A particle radius (radius) must be specified when calculating Rho(r)");
325 <      painCave.severity = OOPSE_ERROR;
324 >               "A particle radius (radius) must be specified when calculating Rho(r)");
325 >      painCave.severity = OPENMD_ERROR;
326        painCave.isFatal = 1;
327        simError();
328      }
329 <        }else if (args_info.hullvol_given) {
329 >  } else if (args_info.hullvol_given) {
330      analyser = new NanoVolume(info, dumpFileName, sele1);
331 +  } else if (args_info.angle_r_given) {
332 +    analyser = new AngleR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg);
333    }
334 <  
334 >    
335    if (args_info.output_given) {
336      analyser->setOutputName(args_info.output_arg);
337    }
338    if (args_info.step_given) {
339      analyser->setStep(args_info.step_arg);
340    }
341 <
341 >  
342    analyser->process();
343 <
343 >  
344    delete analyser;    
345    delete info;
346  

Comparing trunk/src/applications/staticProps/StaticProps.cpp (property svn:keywords):
Revision 1180 by chuckv, Mon Sep 17 20:05:51 2007 UTC vs.
Revision 1542 by gezelter, Thu Mar 3 20:32:49 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines