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