--- trunk/src/applications/staticProps/StaticProps.cpp 2008/06/30 17:53:42 1267 +++ trunk/src/applications/staticProps/StaticProps.cpp 2010/10/19 18:40:54 1513 @@ -6,19 +6,10 @@ * redistribute this software in source and binary code form, provided * that the following conditions are met: * - * 1. Acknowledgement of the program authors must be made in any - * publication of scientific results based in part on use of the - * program. An acceptable form of acknowledgement is citation of - * the article in which the program was described (Matthew - * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher - * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented - * Parallel Simulation Engine for Molecular Dynamics," - * J. Comput. Chem. 26, pp. 252-271 (2005)) - * - * 2. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 3. Redistributions in binary form must reproduce the above copyright + * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. @@ -37,6 +28,15 @@ * arising out of the use of or inability to use software, even if the * University of Notre Dame has been advised of the possibility of * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [4] Vardeman & Gezelter, in progress (2009). */ #include @@ -53,16 +53,20 @@ #include "applications/staticProps/StaticAnalyser.hpp" #include "applications/staticProps/GofR.hpp" #include "applications/staticProps/GofZ.hpp" +#include "applications/staticProps/GofRZ.hpp" #include "applications/staticProps/GofRAngle.hpp" #include "applications/staticProps/GofAngle2.hpp" #include "applications/staticProps/GofXyz.hpp" +#include "applications/staticProps/TwoDGofR.hpp" #include "applications/staticProps/P2OrderParameter.hpp" #include "applications/staticProps/BondOrderParameter.hpp" #include "applications/staticProps/BOPofR.hpp" #include "applications/staticProps/RippleOP.hpp" #include "applications/staticProps/SCDOrderParameter.hpp" #include "applications/staticProps/DensityPlot.hpp" +#include "applications/staticProps/ObjectCount.hpp" #include "applications/staticProps/RhoZ.hpp" +#include "applications/staticProps/pAngle.hpp" #include "applications/staticProps/BondAngleDistribution.hpp" #include "applications/staticProps/NanoVolume.hpp" #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H) @@ -70,77 +74,77 @@ #endif #include "applications/staticProps/RhoR.hpp" -using namespace oopse; +using namespace OpenMD; int main(int argc, char* argv[]){ //register force fields registerForceFields(); - + gengetopt_args_info args_info; - + //parse the command line option if (cmdline_parser (argc, argv, &args_info) != 0) { exit(1) ; } - + //get the dumpfile name std::string dumpFileName = args_info.input_arg; std::string sele1; std::string sele2; bool userSpecifiedSelect1; bool userSpecifiedSelect2; - + // check the first selection argument, or set it to the environment // variable, or failing that, set it to "select all" - + if (args_info.sele1_given) { sele1 = args_info.sele1_arg; } else { - char* sele1Env= getenv("OOPSE_SELE1"); + char* sele1Env= getenv("SELECTION1"); if (sele1Env) { sele1 = sele1Env; } else { sele1 = "select all"; } } - + // check the second selection argument, or set it to the environment // variable, or failing that, set it to "select all" if (args_info.sele2_given) { sele2 = args_info.sele2_arg; } else { - char* sele2Env = getenv("OOPSE_SELE2"); + char* sele2Env = getenv("SELECTION1"); if (sele2Env) { sele2 = sele2Env; } else { sele2 = "select all"; } } - - + + // Problems if sele1 wasn't specified, but -// if (!args_info.scd_given) { -// sprintf( painCave.errMsg, -// "neither --sele1 option nor $OOPSE_SELE1 is set"); -// painCave.severity = OOPSE_ERROR; -// painCave.isFatal = 1; -// simError(); -// } -// } - + // if (!args_info.scd_given) { + // sprintf( painCave.errMsg, + // "neither --sele1 option nor $SELECTION1 is set"); + // painCave.severity = OPENMD_ERROR; + // painCave.isFatal = 1; + // simError(); + // } + // } + // Problems if sele1 wasn't specified - -// if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given) { -// sprintf( painCave.errMsg, -// "neither --sele2 option nor $OOPSE_SELE2 is set"); -// painCave.severity = OOPSE_ERROR; -// painCave.isFatal = 1; -// simError(); -// } -// } - + + // if(!args_info.scd_given && !args_info.density_given && !args_info.slab_density_given) { + // sprintf( painCave.errMsg, + // "neither --sele2 option nor $SELECTION1 is set"); + // painCave.severity = OPENMD_ERROR; + // painCave.isFatal = 1; + // simError(); + // } + // } + bool batchMode; if (args_info.scd_given){ if (args_info.sele1_given && args_info.sele2_given && args_info.sele3_given) { @@ -150,7 +154,7 @@ int main(int argc, char* argv[]){ sprintf( painCave.errMsg, "below conditions are not satisfied:\n" "0 <= begin && 0<= end && begin <= end-2\n"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } @@ -159,24 +163,29 @@ int main(int argc, char* argv[]){ sprintf( painCave.errMsg, "either --sele1, --sele2, --sele3 are specified," " or --molname, --begin, --end are specified\n"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); - + } } - + //parse md file and set up the system SimCreator creator; std::cout << "dumpFile = " << dumpFileName << "\n"; SimInfo* info = creator.createSim(dumpFileName); RealType maxLen; + RealType zmaxLen; if (args_info.length_given) { maxLen = args_info.length_arg; + if (args_info.zlength_given){ + zmaxLen = args_info.zlength_arg; + } } else { Mat3x3d hmat = info->getSnapshotManager()->getCurrentSnapshot()->getHmat(); - maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0; + maxLen = std::min(std::min(hmat(0, 0), hmat(1, 1)), hmat(2, 2)) /2.0; + zmaxLen = hmat(2,2); } StaticAnalyser* analyser; @@ -186,6 +195,9 @@ int main(int argc, char* argv[]){ } else if (args_info.gofz_given) { analyser= new GofZ(info, dumpFileName, sele1, sele2, maxLen, args_info.nbins_arg); + } else if (args_info.r_z_given) { + analyser = new GofRZ(info, dumpFileName, sele1, sele2, maxLen, zmaxLen, + args_info.nbins_arg, args_info.nbins_z_arg); } else if (args_info.r_theta_given) { analyser = new GofRTheta(info, dumpFileName, sele1, sele2, maxLen, args_info.nbins_arg, args_info.nanglebins_arg); @@ -202,10 +214,21 @@ int main(int argc, char* argv[]){ } else { sprintf( painCave.errMsg, "--refsele must set when --gxyz is used"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } + } else if (args_info.twodgofr_given){ + if (args_info.dz_given) { + analyser= new TwoDGofR(info, dumpFileName, sele1, sele2, maxLen, + args_info.dz_arg, args_info.nbins_arg); + } else { + sprintf( painCave.errMsg, + "A slab width (dz) must be specified when calculating TwoDGofR"); + painCave.severity = OPENMD_ERROR; + painCave.isFatal = 1; + simError(); + } } else if (args_info.p2_given) { analyser = new P2OrderParameter(info, dumpFileName, sele1, sele2); } else if (args_info.rp2_given){ @@ -218,29 +241,29 @@ int main(int argc, char* argv[]){ } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.bor_given){ if (args_info.rcut_given) { analyser = new BOPofR(info, dumpFileName, sele1, args_info.rcut_arg, - args_info.nbins_arg, maxLen); + args_info.nbins_arg, maxLen); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Order Parameters"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } } else if (args_info.bad_given){ if (args_info.rcut_given) { analyser = new BondAngleDistribution(info, dumpFileName, sele1, args_info.rcut_arg, - args_info.nbins_arg); + args_info.nbins_arg); } else { sprintf( painCave.errMsg, "A cutoff radius (rcut) must be specified when calculating Bond Angle Distributions"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } @@ -255,8 +278,12 @@ int main(int argc, char* argv[]){ }else if (args_info.density_given) { analyser= new DensityPlot(info, dumpFileName, sele1, sele2, maxLen, args_info.nbins_arg); + } else if (args_info.count_given) { + analyser = new ObjectCount(info, dumpFileName, sele1 ); } else if (args_info.slab_density_given) { analyser = new RhoZ(info, dumpFileName, sele1, args_info.nbins_arg); + } else if (args_info.p_angle_given) { + analyser = new pAngle(info, dumpFileName, sele1, args_info.nbins_arg); #if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H) }else if (args_info.hxy_given) { analyser = new Hxy(info, dumpFileName, sele1, args_info.nbins_x_arg, @@ -268,11 +295,11 @@ int main(int argc, char* argv[]){ }else{ sprintf( painCave.errMsg, "A particle radius (radius) must be specified when calculating Rho(r)"); - painCave.severity = OOPSE_ERROR; + painCave.severity = OPENMD_ERROR; painCave.isFatal = 1; simError(); } - }else if (args_info.hullvol_given) { + }else if (args_info.hullvol_given) { analyser = new NanoVolume(info, dumpFileName, sele1); }