| 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). | 
| 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" | 
| 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" | 
| 77 | – | #include "applications/staticProps/RhoAngleR.hpp" | 
| 78 |  | #include "applications/staticProps/TetrahedralityParam.hpp" | 
| 79 | + | #include "applications/staticProps/TetrahedralityParamZ.hpp" | 
| 80 | + | #include "applications/staticProps/TetrahedralityParamXYZ.hpp" | 
| 81 | + | #include "applications/staticProps/RNEMDStats.hpp" | 
| 82 | + | #include "applications/staticProps/NitrileFrequencyMap.hpp" | 
| 83 | + | #include "applications/staticProps/MultipoleSum.hpp" | 
| 84 |  |  | 
| 85 |  | using namespace OpenMD; | 
| 86 |  |  | 
| 87 |  | int main(int argc, char* argv[]){ | 
| 88 |  |  | 
| 84 | – | //register force fields | 
| 85 | – | registerForceFields(); | 
| 89 |  |  | 
| 90 |  | gengetopt_args_info args_info; | 
| 91 |  |  | 
| 98 |  | std::string dumpFileName = args_info.input_arg; | 
| 99 |  | std::string sele1; | 
| 100 |  | std::string sele2; | 
| 101 | < | bool userSpecifiedSelect1; | 
| 99 | < | bool userSpecifiedSelect2; | 
| 101 | > | std::string sele3; | 
| 102 |  |  | 
| 103 |  | // check the first selection argument, or set it to the environment | 
| 104 |  | // variable, or failing that, set it to "select all" | 
| 115 |  | } | 
| 116 |  |  | 
| 117 |  | // check the second selection argument, or set it to the environment | 
| 118 | < | // variable, or failing that, set it to "select all" | 
| 118 | > | // variable, or failing that, set it to the first selection | 
| 119 |  |  | 
| 120 |  | if (args_info.sele2_given) { | 
| 121 |  | sele2 = args_info.sele2_arg; | 
| 122 |  | } else { | 
| 123 | < | char* sele2Env = getenv("SELECTION1"); | 
| 123 | > | char* sele2Env = getenv("SELECTION2"); | 
| 124 |  | if (sele2Env) { | 
| 125 |  | sele2 = sele2Env; | 
| 126 |  | } else { | 
| 127 | < | sele2 = "select all"; | 
| 127 | > | //If sele2 is not specified, then the default behavior | 
| 128 | > | //should be what is already intended for sele1 | 
| 129 | > | sele2 = sele1; | 
| 130 |  | } | 
| 131 |  | } | 
| 132 | < |  | 
| 133 | < |  | 
| 134 | < | // Problems if sele1 wasn't specified, but | 
| 135 | < | // if (!args_info.scd_given) { | 
| 136 | < | //       sprintf( painCave.errMsg, | 
| 137 | < | //                "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 $SELECTION1 is set"); | 
| 145 | < | //       painCave.severity = OPENMD_ERROR; | 
| 146 | < | //       painCave.isFatal = 1; | 
| 147 | < | //       simError(); | 
| 148 | < | //     } | 
| 149 | < | //   } | 
| 150 | < |  | 
| 132 | > |  | 
| 133 | > | // check the third selection argument, which is only set if | 
| 134 | > | // requested by the user | 
| 135 | > |  | 
| 136 | > | if (args_info.sele3_given) sele3 = args_info.sele3_arg; | 
| 137 | > |  | 
| 138 |  | bool batchMode; | 
| 139 |  | if (args_info.scd_given){ | 
| 140 | < | if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) { | 
| 140 | > | if (args_info.sele1_given && | 
| 141 | > | args_info.sele2_given && args_info.sele3_given) { | 
| 142 |  | batchMode = false; | 
| 143 | < | } else if (args_info.molname_given && args_info.begin_given && args_info.end_given) { | 
| 144 | < | if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) { | 
| 143 | > | } else if (args_info.molname_given && | 
| 144 | > | args_info.begin_given && args_info.end_given) { | 
| 145 | > | if (args_info.begin_arg < 0 || | 
| 146 | > | args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) { | 
| 147 |  | sprintf( painCave.errMsg, | 
| 148 |  | "below conditions are not satisfied:\n" | 
| 149 |  | "0 <= begin && 0<= end && begin <= end-2\n"); | 
| 158 |  | " or --molname, --begin, --end are specified\n"); | 
| 159 |  | painCave.severity = OPENMD_ERROR; | 
| 160 |  | painCave.isFatal = 1; | 
| 161 | < | simError(); | 
| 172 | < |  | 
| 161 | > | simError(); | 
| 162 |  | } | 
| 163 |  | } | 
| 164 |  |  | 
| 165 |  | //parse md file and set up the system | 
| 166 |  | SimCreator creator; | 
| 178 | – | std::cout << "dumpFile = " << dumpFileName << "\n"; | 
| 167 |  | SimInfo* info = creator.createSim(dumpFileName); | 
| 168 |  |  | 
| 169 |  | RealType maxLen; | 
| 190 |  | analyser  = new GofRZ(info, dumpFileName, sele1, sele2, maxLen, zmaxLen, | 
| 191 |  | args_info.nbins_arg, args_info.nbins_z_arg); | 
| 192 |  | } else if (args_info.r_theta_given) { | 
| 193 | < | analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, | 
| 194 | < | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 193 | > | if (args_info.sele3_given) | 
| 194 | > | analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, sele3, maxLen, | 
| 195 | > | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 196 | > | else | 
| 197 | > | analyser  = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, | 
| 198 | > | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 199 |  | } else if (args_info.r_omega_given) { | 
| 200 | < | analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen, | 
| 201 | < | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 200 | > | if (args_info.sele3_given) | 
| 201 | > | analyser  = new GofROmega(info, dumpFileName, sele1, sele2, sele3, maxLen, | 
| 202 | > | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 203 | > | else | 
| 204 | > | analyser  = new GofROmega(info, dumpFileName, sele1, sele2, maxLen, | 
| 205 | > | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 206 | > |  | 
| 207 |  | } else if (args_info.theta_omega_given) { | 
| 208 | < | analyser  = new GofAngle2(info, dumpFileName, sele1, sele2, | 
| 209 | < | args_info.nanglebins_arg); | 
| 208 | > | if (args_info.sele3_given) | 
| 209 | > | analyser  = new GofAngle2(info, dumpFileName, sele1, sele2, sele3, | 
| 210 | > | args_info.nanglebins_arg); | 
| 211 | > | else | 
| 212 | > | analyser  = new GofAngle2(info, dumpFileName, sele1, sele2, | 
| 213 | > | args_info.nanglebins_arg); | 
| 214 |  | } else if (args_info.gxyz_given) { | 
| 215 |  | if (args_info.refsele_given) { | 
| 216 | < | analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg, | 
| 217 | < | maxLen, args_info.nbins_arg); | 
| 216 | > | analyser= new GofXyz(info, dumpFileName, sele1, sele2, | 
| 217 | > | args_info.refsele_arg, maxLen, args_info.nbins_arg); | 
| 218 |  | } else { | 
| 219 |  | sprintf( painCave.errMsg, | 
| 220 |  | "--refsele must set when --gxyz is used"); | 
| 234 |  | simError(); | 
| 235 |  | } | 
| 236 |  | } else if (args_info.p2_given) { | 
| 237 | < | analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2); | 
| 237 | > | if (args_info.sele1_given) { | 
| 238 | > | if (args_info.sele2_given) | 
| 239 | > | analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2); | 
| 240 | > | else | 
| 241 | > | if (args_info.seleoffset_given) | 
| 242 | > | analyser  = new P2OrderParameter(info, dumpFileName, sele1, | 
| 243 | > | args_info.seleoffset_arg); | 
| 244 | > | else | 
| 245 | > | analyser  = new P2OrderParameter(info, dumpFileName, sele1); | 
| 246 | > | } else { | 
| 247 | > | sprintf( painCave.errMsg, | 
| 248 | > | "At least one selection script (--sele1) must be specified when calculating P2 order parameters"); | 
| 249 | > | painCave.severity = OPENMD_ERROR; | 
| 250 | > | painCave.isFatal = 1; | 
| 251 | > | simError(); | 
| 252 | > | } | 
| 253 |  | } else if (args_info.rp2_given){ | 
| 254 |  | analyser = new RippleOP(info, dumpFileName, sele1, sele2); | 
| 255 |  | } else if (args_info.bo_given){ | 
| 264 |  | painCave.isFatal = 1; | 
| 265 |  | simError(); | 
| 266 |  | } | 
| 267 | < |  | 
| 267 | > | } else if (args_info.multipole_given){ | 
| 268 | > | analyser = new MultipoleSum(info, dumpFileName, sele1, | 
| 269 | > | maxLen, args_info.nbins_arg); | 
| 270 |  | } else if (args_info.tet_param_given) { | 
| 271 |  | if (args_info.rcut_given) { | 
| 272 |  | analyser = new TetrahedralityParam(info, dumpFileName, sele1, | 
| 279 |  | painCave.isFatal = 1; | 
| 280 |  | simError(); | 
| 281 |  | } | 
| 282 | < | } else if (args_info.bor_given){ | 
| 282 | > | } else if (args_info.tet_param_z_given) { | 
| 283 | > | if (args_info.rcut_given) { | 
| 284 | > | analyser = new TetrahedralityParamZ(info, dumpFileName, sele1, sele2, | 
| 285 | > | args_info.rcut_arg, | 
| 286 | > | args_info.nbins_arg); | 
| 287 | > | } else { | 
| 288 | > | sprintf( painCave.errMsg, | 
| 289 | > | "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters"); | 
| 290 | > | painCave.severity = OPENMD_ERROR; | 
| 291 | > | painCave.isFatal = 1; | 
| 292 | > | simError(); | 
| 293 | > | } | 
| 294 | > | } else if (args_info.tet_param_xyz_given) { | 
| 295 | > | if (!args_info.rcut_given) { | 
| 296 | > | sprintf( painCave.errMsg, | 
| 297 | > | "A cutoff radius (rcut) must be specified when calculating" | 
| 298 | > | " Tetrahedrality Parameters"); | 
| 299 | > | painCave.severity = OPENMD_ERROR; | 
| 300 | > | painCave.isFatal = 1; | 
| 301 | > | simError(); | 
| 302 | > | } | 
| 303 | > | if (!args_info.voxelSize_given) { | 
| 304 | > | sprintf( painCave.errMsg, | 
| 305 | > | "A voxel size must be specified when calculating" | 
| 306 | > | " volume-resolved Tetrahedrality Parameters"); | 
| 307 | > | painCave.severity = OPENMD_ERROR; | 
| 308 | > | painCave.isFatal = 1; | 
| 309 | > | simError(); | 
| 310 | > | } | 
| 311 | > | if (!args_info.gaussWidth_given) { | 
| 312 | > | sprintf( painCave.errMsg, | 
| 313 | > | "A gaussian width must be specified when calculating" | 
| 314 | > | " volume-resolved Tetrahedrality Parameters"); | 
| 315 | > | painCave.severity = OPENMD_ERROR; | 
| 316 | > | painCave.isFatal = 1; | 
| 317 | > | simError(); | 
| 318 | > | } | 
| 319 | > | analyser = new TetrahedralityParamXYZ(info, dumpFileName, sele1, sele2, | 
| 320 | > | args_info.rcut_arg, | 
| 321 | > | args_info.voxelSize_arg, | 
| 322 | > | args_info.gaussWidth_arg); | 
| 323 | > | } else if (args_info.ior_given){ | 
| 324 |  | if (args_info.rcut_given) { | 
| 325 | < | analyser = new BOPofR(info, dumpFileName, sele1, args_info.rcut_arg, | 
| 325 | > | analyser = new IcosahedralOfR(info, dumpFileName, sele1, | 
| 326 | > | args_info.rcut_arg, | 
| 327 | > | args_info.nbins_arg, maxLen); | 
| 328 | > | } else { | 
| 329 | > | sprintf( painCave.errMsg, | 
| 330 | > | "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); | 
| 331 | > | painCave.severity = OPENMD_ERROR; | 
| 332 | > | painCave.isFatal = 1; | 
| 333 | > | simError(); | 
| 334 | > | } | 
| 335 | > | } else if (args_info.for_given){ | 
| 336 | > | if (args_info.rcut_given) { | 
| 337 | > | analyser = new FCCOfR(info, dumpFileName, sele1, args_info.rcut_arg, | 
| 338 |  | args_info.nbins_arg, maxLen); | 
| 339 |  | } else { | 
| 340 |  | sprintf( painCave.errMsg, | 
| 345 |  | } | 
| 346 |  | } else if (args_info.bad_given){ | 
| 347 |  | if (args_info.rcut_given) { | 
| 348 | < | analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg, | 
| 348 | > | analyser = new BondAngleDistribution(info, dumpFileName, sele1, | 
| 349 | > | args_info.rcut_arg, | 
| 350 |  | args_info.nbins_arg); | 
| 351 |  | } else { | 
| 352 |  | sprintf( painCave.errMsg, | 
| 354 |  | painCave.severity = OPENMD_ERROR; | 
| 355 |  | painCave.isFatal = 1; | 
| 356 |  | simError(); | 
| 357 | < | } | 
| 357 | > | } | 
| 358 |  | } else if (args_info.scd_given) { | 
| 359 |  | if (batchMode) { | 
| 360 | < | analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg, | 
| 360 | > | analyser  = new SCDOrderParameter(info, dumpFileName, | 
| 361 | > | args_info.molname_arg, | 
| 362 |  | args_info.begin_arg, args_info.end_arg); | 
| 363 |  | } else{ | 
| 364 | < | std::string sele3 = args_info.sele3_arg; | 
| 365 | < | analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3); | 
| 364 | > | analyser  = new SCDOrderParameter(info, dumpFileName, | 
| 365 | > | sele1, sele2, sele3); | 
| 366 |  | } | 
| 367 |  | }else if (args_info.density_given) { | 
| 368 |  | analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, | 
| 371 |  | analyser = new ObjectCount(info, dumpFileName, sele1 ); | 
| 372 |  | } else if (args_info.slab_density_given) { | 
| 373 |  | analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 374 | + | } else if (args_info.rnemdz_given) { | 
| 375 | + | analyser = new RNEMDZ(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 376 | + | } else if (args_info.rnemdr_given) { | 
| 377 | + | analyser = new RNEMDR(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 378 | + | } else if (args_info.rnemdrt_given) { | 
| 379 | + | analyser = new RNEMDRTheta(info, dumpFileName, sele1, | 
| 380 | + | args_info.nbins_arg, args_info.nanglebins_arg); | 
| 381 | + | } else if (args_info.nitrile_given) { | 
| 382 | + | analyser = new NitrileFrequencyMap(info, dumpFileName, sele1, | 
| 383 | + | args_info.nbins_arg); | 
| 384 |  | } else if (args_info.p_angle_given) { | 
| 385 | < | analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 385 | > | if (args_info.sele1_given) { | 
| 386 | > | if (args_info.sele2_given) | 
| 387 | > | analyser  = new pAngle(info, dumpFileName, sele1, sele2, | 
| 388 | > | args_info.nbins_arg); | 
| 389 | > | else | 
| 390 | > | if (args_info.seleoffset_given) { | 
| 391 | > | if (args_info.seleoffset2_given) { | 
| 392 | > | analyser  = new pAngle(info, dumpFileName, sele1, | 
| 393 | > | args_info.seleoffset_arg, | 
| 394 | > | args_info.seleoffset2_arg, | 
| 395 | > | args_info.nbins_arg); | 
| 396 | > | } else { | 
| 397 | > | analyser  = new pAngle(info, dumpFileName, sele1, | 
| 398 | > | args_info.seleoffset_arg, | 
| 399 | > | args_info.nbins_arg); | 
| 400 | > | } | 
| 401 | > | } else | 
| 402 | > | analyser  = new pAngle(info, dumpFileName, sele1, | 
| 403 | > | args_info.nbins_arg); | 
| 404 | > | } else { | 
| 405 | > | sprintf( painCave.errMsg, | 
| 406 | > | "At least one selection script (--sele1) must be specified when " | 
| 407 | > | "calculating P(angle) distributions"); | 
| 408 | > | painCave.severity = OPENMD_ERROR; | 
| 409 | > | painCave.isFatal = 1; | 
| 410 | > | simError(); | 
| 411 | > | } | 
| 412 |  | #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H) | 
| 413 |  | }else if (args_info.hxy_given) { | 
| 414 |  | analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg, | 
| 426 |  | } | 
| 427 |  | } else if (args_info.hullvol_given) { | 
| 428 |  | analyser = new NanoVolume(info, dumpFileName, sele1); | 
| 429 | + | } else if (args_info.rodlength_given) { | 
| 430 | + | analyser = new NanoLength(info, dumpFileName, sele1); | 
| 431 |  | } else if (args_info.angle_r_given) { | 
| 432 |  | analyser = new AngleR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg); | 
| 433 |  | } | 
| 434 | < |  | 
| 434 | > |  | 
| 435 |  | if (args_info.output_given) { | 
| 436 |  | analyser->setOutputName(args_info.output_arg); | 
| 437 |  | } | 
| 443 |  |  | 
| 444 |  | delete analyser; | 
| 445 |  | delete info; | 
| 446 | < |  | 
| 446 | > |  | 
| 447 |  | return 0; | 
| 448 |  | } | 
| 338 | – |  |