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

Comparing trunk/src/applications/staticProps/StaticProps.cpp (property svn:keywords):
Revision 1267 by gpuliti, Mon Jun 30 17:53:42 2008 UTC vs.
Revision 1454 by gezelter, Wed Jun 23 19:25:02 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines