| 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/RNEMDStats.hpp" | 
| 81 | 
  | 
 | 
| 82 | 
  | 
using namespace OpenMD; | 
| 83 | 
  | 
 | 
| 84 | 
  | 
int main(int argc, char* argv[]){ | 
| 85 | 
  | 
   | 
| 84 | 
– | 
  //register force fields | 
| 85 | 
– | 
  registerForceFields(); | 
| 86 | 
  | 
   | 
| 87 | 
  | 
  gengetopt_args_info args_info; | 
| 88 | 
  | 
   | 
| 95 | 
  | 
  std::string dumpFileName = args_info.input_arg; | 
| 96 | 
  | 
  std::string sele1; | 
| 97 | 
  | 
  std::string sele2; | 
| 98 | 
– | 
  bool userSpecifiedSelect1; | 
| 99 | 
– | 
  bool userSpecifiedSelect2; | 
| 98 | 
  | 
   | 
| 99 | 
  | 
  // check the first selection argument, or set it to the environment | 
| 100 | 
  | 
  // variable, or failing that, set it to "select all" | 
| 111 | 
  | 
  } | 
| 112 | 
  | 
   | 
| 113 | 
  | 
  // check the second selection argument, or set it to the environment | 
| 114 | 
< | 
  // variable, or failing that, set it to "select all" | 
| 114 | 
> | 
  // variable, or failing that, set it to the first selection | 
| 115 | 
  | 
   | 
| 116 | 
  | 
  if (args_info.sele2_given) { | 
| 117 | 
  | 
    sele2 = args_info.sele2_arg; | 
| 118 | 
  | 
  } else { | 
| 119 | 
< | 
    char* sele2Env = getenv("SELECTION1"); | 
| 119 | 
> | 
    char* sele2Env = getenv("SELECTION2"); | 
| 120 | 
  | 
    if (sele2Env) { | 
| 121 | 
  | 
      sele2 = sele2Env;             | 
| 122 | 
  | 
    } else {  | 
| 123 | 
< | 
      sele2 = "select all"; | 
| 123 | 
> | 
      //If sele2 is not specified, then the default behavior | 
| 124 | 
> | 
      //should be what is already intended for sele1 | 
| 125 | 
> | 
      sele2 = sele1; | 
| 126 | 
  | 
    } | 
| 127 | 
  | 
  } | 
| 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 $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 | 
< | 
   | 
| 128 | 
> | 
 | 
| 129 | 
  | 
  bool batchMode; | 
| 130 | 
  | 
  if (args_info.scd_given){ | 
| 131 | 
< | 
    if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) { | 
| 131 | 
> | 
    if (args_info.sele1_given &&  | 
| 132 | 
> | 
        args_info.sele2_given && args_info.sele3_given) { | 
| 133 | 
  | 
      batchMode = false; | 
| 134 | 
< | 
    } else if (args_info.molname_given && args_info.begin_given && args_info.end_given) { | 
| 135 | 
< | 
      if (args_info.begin_arg < 0 || args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) { | 
| 134 | 
> | 
    } else if (args_info.molname_given &&  | 
| 135 | 
> | 
               args_info.begin_given && args_info.end_given) { | 
| 136 | 
> | 
      if (args_info.begin_arg < 0 ||  | 
| 137 | 
> | 
          args_info.end_arg < 0 || args_info.begin_arg > args_info.end_arg-2) { | 
| 138 | 
  | 
        sprintf( painCave.errMsg, | 
| 139 | 
  | 
                 "below conditions are not satisfied:\n" | 
| 140 | 
  | 
                 "0 <= begin && 0<= end && begin <= end-2\n"); | 
| 149 | 
  | 
               " or --molname, --begin, --end are specified\n"); | 
| 150 | 
  | 
      painCave.severity = OPENMD_ERROR; | 
| 151 | 
  | 
      painCave.isFatal = 1; | 
| 152 | 
< | 
      simError();         | 
| 172 | 
< | 
       | 
| 152 | 
> | 
      simError(); | 
| 153 | 
  | 
    } | 
| 154 | 
  | 
  } | 
| 155 | 
  | 
   | 
| 156 | 
  | 
  //parse md file and set up the system | 
| 157 | 
  | 
  SimCreator creator; | 
| 178 | 
– | 
  std::cout << "dumpFile = " << dumpFileName << "\n"; | 
| 158 | 
  | 
  SimInfo* info = creator.createSim(dumpFileName); | 
| 159 | 
  | 
 | 
| 160 | 
  | 
  RealType maxLen; | 
| 191 | 
  | 
                              args_info.nanglebins_arg); | 
| 192 | 
  | 
  } else if (args_info.gxyz_given) { | 
| 193 | 
  | 
    if (args_info.refsele_given) { | 
| 194 | 
< | 
      analyser= new GofXyz(info, dumpFileName, sele1, sele2,args_info.refsele_arg,  | 
| 195 | 
< | 
                           maxLen, args_info.nbins_arg);         | 
| 194 | 
> | 
      analyser= new GofXyz(info, dumpFileName, sele1, sele2, | 
| 195 | 
> | 
                           args_info.refsele_arg, maxLen, args_info.nbins_arg); | 
| 196 | 
  | 
    } else { | 
| 197 | 
  | 
      sprintf( painCave.errMsg, | 
| 198 | 
  | 
               "--refsele must set when --gxyz is used"); | 
| 216 | 
  | 
      if (args_info.sele2_given)  | 
| 217 | 
  | 
        analyser  = new P2OrderParameter(info, dumpFileName, sele1, sele2); | 
| 218 | 
  | 
      else  | 
| 219 | 
< | 
        analyser  = new P2OrderParameter(info, dumpFileName, sele1); | 
| 219 | 
> | 
        if (args_info.seleoffset_given)  | 
| 220 | 
> | 
          analyser  = new P2OrderParameter(info, dumpFileName, sele1,  | 
| 221 | 
> | 
                                           args_info.seleoffset_arg); | 
| 222 | 
> | 
        else  | 
| 223 | 
> | 
          analyser  = new P2OrderParameter(info, dumpFileName, sele1); | 
| 224 | 
  | 
    } else { | 
| 225 | 
  | 
      sprintf( painCave.errMsg, | 
| 226 | 
  | 
               "At least one selection script (--sele1) must be specified when calculating P2 order parameters"); | 
| 255 | 
  | 
      painCave.isFatal = 1; | 
| 256 | 
  | 
      simError(); | 
| 257 | 
  | 
    } | 
| 258 | 
+ | 
  } else if (args_info.tet_param_z_given) { | 
| 259 | 
+ | 
    if (args_info.rcut_given) {    | 
| 260 | 
+ | 
      analyser = new TetrahedralityParamZ(info, dumpFileName, sele1, sele2, | 
| 261 | 
+ | 
                                          args_info.rcut_arg,  | 
| 262 | 
+ | 
                                          args_info.nbins_arg); | 
| 263 | 
+ | 
    } else { | 
| 264 | 
+ | 
      sprintf( painCave.errMsg, | 
| 265 | 
+ | 
               "A cutoff radius (rcut) must be specified when calculating Tetrahedrality Parameters"); | 
| 266 | 
+ | 
      painCave.severity = OPENMD_ERROR; | 
| 267 | 
+ | 
      painCave.isFatal = 1; | 
| 268 | 
+ | 
      simError(); | 
| 269 | 
+ | 
    } | 
| 270 | 
  | 
  } else if (args_info.bor_given){ | 
| 271 | 
  | 
    if (args_info.rcut_given) { | 
| 272 | 
  | 
      analyser = new BOPofR(info, dumpFileName, sele1, args_info.rcut_arg, | 
| 280 | 
  | 
    } | 
| 281 | 
  | 
  } else if (args_info.bad_given){ | 
| 282 | 
  | 
    if (args_info.rcut_given) { | 
| 283 | 
< | 
      analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg, | 
| 283 | 
> | 
      analyser = new BondAngleDistribution(info, dumpFileName, sele1,  | 
| 284 | 
> | 
                                           args_info.rcut_arg, | 
| 285 | 
  | 
                                           args_info.nbins_arg); | 
| 286 | 
  | 
    } else { | 
| 287 | 
  | 
      sprintf( painCave.errMsg, | 
| 289 | 
  | 
      painCave.severity = OPENMD_ERROR; | 
| 290 | 
  | 
      painCave.isFatal = 1; | 
| 291 | 
  | 
      simError(); | 
| 292 | 
< | 
      } | 
| 292 | 
> | 
    } | 
| 293 | 
  | 
  } else if (args_info.scd_given) { | 
| 294 | 
  | 
    if (batchMode) { | 
| 295 | 
< | 
      analyser  = new SCDOrderParameter(info, dumpFileName, args_info.molname_arg,  | 
| 295 | 
> | 
      analyser  = new SCDOrderParameter(info, dumpFileName,  | 
| 296 | 
> | 
                                        args_info.molname_arg,  | 
| 297 | 
  | 
                                        args_info.begin_arg, args_info.end_arg); | 
| 298 | 
  | 
    } else{ | 
| 299 | 
  | 
      std::string sele3 = args_info.sele3_arg; | 
| 300 | 
< | 
      analyser  = new SCDOrderParameter(info, dumpFileName, sele1, sele2, sele3); | 
| 300 | 
> | 
      analyser  = new SCDOrderParameter(info, dumpFileName,  | 
| 301 | 
> | 
                                        sele1, sele2, sele3); | 
| 302 | 
  | 
    } | 
| 303 | 
  | 
  }else if (args_info.density_given) { | 
| 304 | 
  | 
    analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, | 
| 307 | 
  | 
    analyser = new ObjectCount(info, dumpFileName, sele1 ); | 
| 308 | 
  | 
  } else if (args_info.slab_density_given) { | 
| 309 | 
  | 
    analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 310 | 
+ | 
  } else if (args_info.rnemdz_given) { | 
| 311 | 
+ | 
    analyser = new RNEMDZ(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 312 | 
+ | 
  } else if (args_info.rnemdr_given) { | 
| 313 | 
+ | 
    analyser = new RNEMDR(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 314 | 
+ | 
  } else if (args_info.rnemdrt_given) { | 
| 315 | 
+ | 
    analyser = new RNEMDRTheta(info, dumpFileName, sele1, | 
| 316 | 
+ | 
                               args_info.nbins_arg, args_info.nanglebins_arg); | 
| 317 | 
  | 
  } else if (args_info.p_angle_given) { | 
| 318 | 
  | 
    analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg); | 
| 319 | 
  | 
#if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H) | 
| 333 | 
  | 
    } | 
| 334 | 
  | 
  } else if (args_info.hullvol_given) { | 
| 335 | 
  | 
    analyser = new NanoVolume(info, dumpFileName, sele1); | 
| 336 | 
+ | 
  } else if (args_info.rodlength_given) { | 
| 337 | 
+ | 
    analyser = new NanoLength(info, dumpFileName, sele1); | 
| 338 | 
  | 
  } else if (args_info.angle_r_given) { | 
| 339 | 
  | 
    analyser = new AngleR(info, dumpFileName, sele1, maxLen,args_info.nbins_arg); | 
| 340 | 
  | 
  } | 
| 341 | 
< | 
     | 
| 341 | 
> | 
   | 
| 342 | 
  | 
  if (args_info.output_given) { | 
| 343 | 
  | 
    analyser->setOutputName(args_info.output_arg); | 
| 344 | 
  | 
  } | 
| 350 | 
  | 
   | 
| 351 | 
  | 
  delete analyser;     | 
| 352 | 
  | 
  delete info; | 
| 353 | 
< | 
 | 
| 353 | 
> | 
   | 
| 354 | 
  | 
  return 0;    | 
| 355 | 
  | 
} | 
| 349 | 
– | 
 |