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