| 1 | 
< | 
#ifndef __GLOBALS_H__ | 
| 2 | 
< | 
#define __GLOBALS_H__ | 
| 1 | 
> | 
/* | 
| 2 | 
> | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
> | 
 * | 
| 4 | 
> | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 5 | 
> | 
 * non-exclusive, royalty free, license to use, modify and | 
| 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 | 
| 19 | 
> | 
 *    notice, this list of conditions and the following disclaimer. | 
| 20 | 
> | 
 * | 
| 21 | 
> | 
 * 3. Redistributions in binary form must reproduce the above copyright | 
| 22 | 
> | 
 *    notice, this list of conditions and the following disclaimer in the | 
| 23 | 
> | 
 *    documentation and/or other materials provided with the | 
| 24 | 
> | 
 *    distribution. | 
| 25 | 
> | 
 * | 
| 26 | 
> | 
 * This software is provided "AS IS," without a warranty of any | 
| 27 | 
> | 
 * kind. All express or implied conditions, representations and | 
| 28 | 
> | 
 * warranties, including any implied warranty of merchantability, | 
| 29 | 
> | 
 * fitness for a particular purpose or non-infringement, are hereby | 
| 30 | 
> | 
 * excluded.  The University of Notre Dame and its licensors shall not | 
| 31 | 
> | 
 * be liable for any damages suffered by licensee as a result of | 
| 32 | 
> | 
 * using, modifying or distributing the software or its | 
| 33 | 
> | 
 * derivatives. In no event will the University of Notre Dame or its | 
| 34 | 
> | 
 * licensors be liable for any lost revenue, profit or data, or for | 
| 35 | 
> | 
 * direct, indirect, special, consequential, incidental or punitive | 
| 36 | 
> | 
 * damages, however caused and regardless of the theory of liability, | 
| 37 | 
> | 
 * arising out of the use of or inability to use software, even if the | 
| 38 | 
> | 
 * University of Notre Dame has been advised of the possibility of | 
| 39 | 
> | 
 * such damages. | 
| 40 | 
> | 
 */ | 
| 41 | 
> | 
  | 
| 42 | 
> | 
#ifndef IO_GLOBALS_HPP | 
| 43 | 
> | 
#define IO_GLOBALS_HPP | 
| 44 | 
  | 
 | 
| 45 | 
  | 
#include <iostream> | 
| 46 | 
  | 
 | 
| 47 | 
  | 
#include <stdlib.h> | 
| 48 | 
  | 
#include <vector> | 
| 49 | 
+ | 
#include <string> | 
| 50 | 
+ | 
#include <map> | 
| 51 | 
  | 
 | 
| 52 | 
  | 
#include "io/BASS_interface.h" | 
| 53 | 
  | 
#include "types/Component.hpp" | 
| 11 | 
– | 
#include "io/LinkedCommand.hpp" | 
| 54 | 
  | 
#include "types/MakeStamps.hpp" | 
| 55 | 
  | 
#include "types/ZconStamp.hpp" | 
| 56 | 
+ | 
#include "utils/CaseConversion.hpp" | 
| 57 | 
  | 
 | 
| 58 | 
< | 
using namespace std; | 
| 58 | 
> | 
template<typename T>  | 
| 59 | 
> | 
struct ParameterTraits; | 
| 60 | 
  | 
 | 
| 61 | 
< | 
class Globals{ | 
| 62 | 
< | 
   | 
| 63 | 
< | 
public: | 
| 64 | 
< | 
   | 
| 21 | 
< | 
  Globals(); | 
| 22 | 
< | 
  ~Globals(); | 
| 61 | 
> | 
//string | 
| 62 | 
> | 
template<>                      | 
| 63 | 
> | 
struct ParameterTraits<std::string>{ | 
| 64 | 
> | 
  typedef std::string RepType;       // Representation type of the value | 
| 65 | 
  | 
 | 
| 66 | 
< | 
  void initalize(); | 
| 67 | 
< | 
   | 
| 68 | 
< | 
  int newComponent( event* the_event ); | 
| 69 | 
< | 
  int componentAssign( event* the_event ); | 
| 70 | 
< | 
  int componentEnd( event* the_event ); | 
| 66 | 
> | 
template<typename T> static bool    convert(T v, RepType& r){return false;} // !NB everything is ok | 
| 67 | 
> | 
template<typename T> static RepType convert(T v)            {RepType tmp; convert(v,tmp);return tmp;}  | 
| 68 | 
> | 
  static bool convert(RepType v, RepType& r) { r = v; return true;} | 
| 69 | 
> | 
  static std::string getParamType() { return "string";}   | 
| 70 | 
> | 
};  | 
| 71 | 
> | 
//bool | 
| 72 | 
> | 
template<>                      | 
| 73 | 
> | 
struct ParameterTraits<bool>{ | 
| 74 | 
> | 
  typedef bool RepType; | 
| 75 | 
> | 
  template<typename T> static bool    convert(T, RepType&){return false;}  | 
| 76 | 
> | 
  template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}  | 
| 77 | 
> | 
  static bool convert(std::string v, RepType& r) {  | 
| 78 | 
> | 
    oopse::toLower(v);  | 
| 79 | 
> | 
    bool result = false; | 
| 80 | 
> | 
    if (v == "true") { | 
| 81 | 
> | 
        r = true; | 
| 82 | 
> | 
        result = true; | 
| 83 | 
> | 
    } else if (v == "false") { | 
| 84 | 
> | 
        r = false; | 
| 85 | 
> | 
        result = true; | 
| 86 | 
> | 
    } | 
| 87 | 
> | 
     | 
| 88 | 
> | 
     return result; | 
| 89 | 
> | 
  } | 
| 90 | 
> | 
  static std::string getParamType() { return "bool";}   | 
| 91 | 
> | 
}; | 
| 92 | 
  | 
 | 
| 93 | 
< | 
  int newZconstraint( event* the_event ); | 
| 94 | 
< | 
  int zConstraintAssign( event* the_event ); | 
| 95 | 
< | 
  int zConstraintEnd( event* the_event ); | 
| 96 | 
< | 
   | 
| 97 | 
< | 
  int globalAssign( event* the_event ); | 
| 98 | 
< | 
  int globalEnd( event* the_event ); | 
| 99 | 
< | 
  | 
| 100 | 
< | 
  char*  getForceField( void )      { return force_field; } | 
| 101 | 
< | 
  int    getNComponents( void )     { return n_components; } | 
| 39 | 
< | 
  double getTargetTemp( void )      { return target_temp; } | 
| 40 | 
< | 
  double getTargetPressure( void )  { return target_pressure; } | 
| 41 | 
< | 
  double getQmass( void )           { return q_mass; } | 
| 42 | 
< | 
  double getTauThermostat( void )   { return tau_thermostat; } | 
| 43 | 
< | 
  double getTauBarostat( void )     { return tau_barostat; } | 
| 44 | 
< | 
  char*  getEnsemble( void )        { return ensemble; } | 
| 45 | 
< | 
  double getDt( void )              { return dt; } | 
| 46 | 
< | 
  double getRunTime( void )         { return run_time; } | 
| 47 | 
< | 
  | 
| 48 | 
< | 
  int    getNzConstraints( void )   { return n_zConstraints; } | 
| 49 | 
< | 
  char*  getInitialConfig( void )   { return initial_config; } | 
| 50 | 
< | 
  char*  getFinalConfig( void )     { return final_config; } | 
| 51 | 
< | 
  int    getNMol( void )            { return n_mol; } | 
| 52 | 
< | 
  double getDensity( void )         { return density; } | 
| 53 | 
< | 
  double getBox( void )             { return box; } | 
| 54 | 
< | 
  double getBoxX( void )            { return box_x; } | 
| 55 | 
< | 
  double getBoxY( void )            { return box_y; } | 
| 56 | 
< | 
  double getBoxZ( void )            { return box_z; } | 
| 57 | 
< | 
  double getSampleTime( void )      { return sample_time; } | 
| 58 | 
< | 
  double getStatusTime( void )      { return status_time; } | 
| 59 | 
< | 
  double getResetTime( void )       { return resetTime; } | 
| 60 | 
< | 
  double getThermalTime( void )     { return thermal_time; } | 
| 61 | 
< | 
  double getDielectric( void )      { return dielectric; } | 
| 62 | 
< | 
  double getRcut( void )            { return rcut; } | 
| 63 | 
< | 
  double getRsw( void )             { return rsw; } | 
| 64 | 
< | 
  int    getTempSet( void )         { return tempSet; } | 
| 65 | 
< | 
  int    getUseInitTime( void )     { return useInitTime; } | 
| 66 | 
< | 
  int    getUseInitXSstate( void )  { return useInitXSstate; } | 
| 67 | 
< | 
  double getOrthoBoxTolerance(void) { return orthoBoxTolerance; } | 
| 68 | 
< | 
  int    getPBC( void )             { return usePBC; } | 
| 69 | 
< | 
  int    getUseRF( void )           { return useRF; } | 
| 70 | 
< | 
  char*  getMixingRule( void)       { return mixingRule; } | 
| 71 | 
< | 
  double getZconsTime(void)         { return zcons_time; } | 
| 72 | 
< | 
  double getZconsTol(void)          { return zcons_tol; } | 
| 73 | 
< | 
  char*  getZconsForcePolicy(void)  { return zconsForcePolicy; } | 
| 74 | 
< | 
  double getZconsGap(void)          { return zcons_gap; } | 
| 75 | 
< | 
  double getZconsFixtime(void)      { return zcons_fixtime; } | 
| 76 | 
< | 
  int    getZconsUsingSMD(void)     { return zcons_using_smd; } | 
| 77 | 
< | 
  int    getSeed(void)              { return seed; } | 
| 78 | 
< | 
  char*  getMinimizer(void)         { return minimizer_name; } | 
| 79 | 
< | 
  int    getMinMaxIter(void)        { return minimizer_maxiteration; } | 
| 80 | 
< | 
  int    getMinWriteFrq(void)       { return minimizer_writefrq; } | 
| 81 | 
< | 
  double getMinStepSize(void)       { return minimizer_stepsize; } | 
| 82 | 
< | 
  double getMinFTol(void)           { return minimizer_ftol; } | 
| 83 | 
< | 
  double getMinGTol(void)           { return minimizer_gtol; } | 
| 84 | 
< | 
  double getMinLSTol(void)          { return minimizer_ls_tol; } | 
| 85 | 
< | 
  int    getMinLSMaxIter(void)      { return minimizer_ls_maxiteration; } | 
| 86 | 
< | 
  int    getUseSolidThermInt(void)  { return useSolidThermInt; } | 
| 87 | 
< | 
  int    getUseLiquidThermInt(void) { return useLiquidThermInt; } | 
| 88 | 
< | 
  double getThermIntLambda(void)    { return thermodynamic_integration_lambda; } | 
| 89 | 
< | 
  double getThermIntK(void)         { return thermodynamic_integration_k; } | 
| 90 | 
< | 
  char*  getForceFieldVariant( void ) { return forcefield_variant; } | 
| 93 | 
> | 
//int    | 
| 94 | 
> | 
template<> | 
| 95 | 
> | 
struct ParameterTraits<int>{ | 
| 96 | 
> | 
    typedef int RepType; | 
| 97 | 
> | 
    template<typename T> static bool    convert(T, RepType&){return false;}  | 
| 98 | 
> | 
    template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}  | 
| 99 | 
> | 
    static bool convert(RepType v, RepType& r)            { r=v; return true;} | 
| 100 | 
> | 
    static std::string getParamType() { return "int";}   | 
| 101 | 
> | 
}; | 
| 102 | 
  | 
 | 
| 103 | 
< | 
  short int haveDt( void )            { return have_dt; } | 
| 104 | 
< | 
  short int haveRunTime( void )       { return have_run_time; } | 
| 105 | 
< | 
  short int haveEnsemble( void )      { return have_ensemble; } | 
| 106 | 
< | 
  short int haveTargetTemp( void )    { return have_target_temp; } | 
| 107 | 
< | 
  short int haveInitialConfig( void ) { return have_initial_config; } | 
| 108 | 
< | 
  short int haveFinalConfig( void )   { return have_final_config; } | 
| 109 | 
< | 
  short int haveNMol( void )          { return have_n_mol; } | 
| 110 | 
< | 
  short int haveDensity( void )       { return have_density; } | 
| 111 | 
< | 
  short int haveBox( void )           { return have_box; } | 
| 112 | 
< | 
  short int haveBoxX( void )          { return have_box_x; } | 
| 102 | 
< | 
  short int haveBoxY( void )          { return have_box_y; } | 
| 103 | 
< | 
  short int haveBoxZ( void )          { return have_box_z; } | 
| 104 | 
< | 
  short int haveSampleTime( void )    { return have_sample_time; } | 
| 105 | 
< | 
  short int haveResetTime( void )     { return have_reset_time; } | 
| 106 | 
< | 
  short int haveStatusTime( void )    { return have_status_time; } | 
| 107 | 
< | 
  short int haveThermalTime( void )   { return have_thermal_time; } | 
| 108 | 
< | 
  short int haveRcut( void )          { return have_rcut; } | 
| 109 | 
< | 
  short int haveRsw( void )           { return have_rsw; } | 
| 110 | 
< | 
  short int haveDielectric( void )    { return have_dielectric; } | 
| 111 | 
< | 
  short int haveTempSet( void )       { return have_tempSet; } | 
| 112 | 
< | 
  short int haveTargetPressure( void ){ return have_target_pressure; } | 
| 113 | 
< | 
  short int haveQmass( void )         { return have_q_mass; } | 
| 114 | 
< | 
  short int haveTauThermostat( void ) { return have_tau_thermostat; } | 
| 115 | 
< | 
  short int haveTauBarostat( void )   { return have_tau_barostat; } | 
| 116 | 
< | 
  short int haveZconstraintTime(void) { return have_zcons_time; } | 
| 117 | 
< | 
  short int haveZconstraints( void )  { return have_zConstraints; } | 
| 118 | 
< | 
  short int haveZconsTol(void)        { return have_zcons_tol; } | 
| 119 | 
< | 
  short int haveZconsForcePolicy(void){ return have_zcons_force_policy; } | 
| 120 | 
< | 
  short int haveZConsGap(void)        { return have_zcons_gap; } | 
| 121 | 
< | 
  short int haveZConsFixTime(void)    { return have_zcons_fixtime; } | 
| 122 | 
< | 
  short int haveZConsUsingSMD(void)   { return have_zcons_using_smd; }   | 
| 123 | 
< | 
  short int haveSeed(void)            { return have_seed; } | 
| 124 | 
< | 
  short int haveMinimizer(void)       { return have_minimizer; } | 
| 125 | 
< | 
  short int haveMinMaxIter(void)      { return have_minimizer_maxiteration; } | 
| 126 | 
< | 
  short int haveMinWriteFrq(void)     { return have_minimizer_writefrq; } | 
| 127 | 
< | 
  short int haveMinStepSize(void)     { return have_minimizer_stepsize; } | 
| 128 | 
< | 
  short int haveMinFTol(void)         { return have_minimizer_ftol; } | 
| 129 | 
< | 
  short int haveMinGTol(void)         { return have_minimizer_gtol; } | 
| 130 | 
< | 
  short int haveMinLSTol(void)        { return have_minimizer_ls_tol; } | 
| 131 | 
< | 
  short int haveMinLSMaxIter(void)    { return have_minimizer_ls_maxiteration;} | 
| 132 | 
< | 
  short int haveThermIntLambda(void)  { return have_thermodynamic_integration_lambda; } | 
| 133 | 
< | 
  short int haveThermIntK(void)       { return have_thermodynamic_integration_k; } | 
| 134 | 
< | 
  short int haveForceFieldVariant(void) { return have_forcefield_variant; } | 
| 103 | 
> | 
//double | 
| 104 | 
> | 
template<>                      | 
| 105 | 
> | 
struct ParameterTraits<double>{ | 
| 106 | 
> | 
    typedef double RepType; | 
| 107 | 
> | 
    template<typename T> static bool    convert(T, RepType&){return false;}  | 
| 108 | 
> | 
    template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}  | 
| 109 | 
> | 
    static bool convert(RepType v, RepType& r)            {r=v; return true;} | 
| 110 | 
> | 
    static bool convert(int v, RepType& r)                {r = static_cast<double>(v); return true;} | 
| 111 | 
> | 
    static std::string getParamType() { return "double";}     | 
| 112 | 
> | 
}; | 
| 113 | 
  | 
 | 
| 136 | 
– | 
  /* other accessors */ | 
| 137 | 
– | 
  Component** getComponents( void )   { return components; } | 
| 138 | 
– | 
  ZconStamp** getZconStamp( void )    { return zConstraints; } | 
| 139 | 
– | 
   | 
| 140 | 
– | 
private: | 
| 141 | 
– | 
   | 
| 142 | 
– | 
  int hash_size; | 
| 143 | 
– | 
  int hash_shift; | 
| 144 | 
– | 
  int hash( char* text ); | 
| 145 | 
– | 
  void addHash( char* text, int token ); | 
| 146 | 
– | 
  LinkedCommand** command_table; | 
| 147 | 
– | 
   | 
| 148 | 
– | 
  char* checkMe( void ); | 
| 149 | 
– | 
   | 
| 150 | 
– | 
  Component* current_component; | 
| 151 | 
– | 
  Component** components; // the array of components | 
| 114 | 
  | 
 | 
| 115 | 
< | 
  ZconStamp* current_zConstraint; | 
| 116 | 
< | 
  ZconStamp** zConstraints; // the array of zConstraints | 
| 115 | 
> | 
class ParameterBase { | 
| 116 | 
> | 
  public:     | 
| 117 | 
> | 
    ParameterBase() : keyword_(), optional_(false), defaultValue_(false), empty_(true) {} | 
| 118 | 
> | 
    bool isOptional() {return optional_;} | 
| 119 | 
> | 
    void setOptional(bool optional) {optional_ = optional;} | 
| 120 | 
> | 
    bool hasDefaultValue() {return defaultValue_;} | 
| 121 | 
> | 
    virtual bool isValid() { return true;} | 
| 122 | 
> | 
    const std::string& getKeyword() {return keyword_;} | 
| 123 | 
> | 
    void setKeyword(const std::string& keyword) { keyword_ = keyword;} | 
| 124 | 
> | 
    bool empty() {return empty_;} | 
| 125 | 
> | 
    virtual bool setData(std::string) = 0; | 
| 126 | 
> | 
    virtual bool setData(int) = 0; | 
| 127 | 
> | 
    virtual bool setData(double) = 0; | 
| 128 | 
> | 
    virtual std::string getParamType() = 0; | 
| 129 | 
> | 
  protected: | 
| 130 | 
> | 
    std::string keyword_; | 
| 131 | 
> | 
    bool optional_; | 
| 132 | 
> | 
    bool defaultValue_; | 
| 133 | 
> | 
    bool empty_; | 
| 134 | 
> | 
}; | 
| 135 | 
  | 
 | 
| 136 | 
< | 
  char force_field[100]; | 
| 137 | 
< | 
  int n_components; | 
| 138 | 
< | 
  int n_zConstraints; | 
| 139 | 
< | 
  double target_temp; | 
| 140 | 
< | 
  double target_pressure; | 
| 141 | 
< | 
  char ensemble[100]; | 
| 162 | 
< | 
  char mixingRule[100]; | 
| 163 | 
< | 
  double dt; | 
| 164 | 
< | 
  double run_time; | 
| 165 | 
< | 
  char initial_config[120]; | 
| 166 | 
< | 
  char final_config[120]; | 
| 167 | 
< | 
  int n_mol; | 
| 168 | 
< | 
  double density; | 
| 169 | 
< | 
  double box; | 
| 170 | 
< | 
  double box_x, box_y, box_z; | 
| 171 | 
< | 
  double sample_time; | 
| 172 | 
< | 
  double status_time; | 
| 173 | 
< | 
  double resetTime; | 
| 174 | 
< | 
  double orthoBoxTolerance; | 
| 175 | 
< | 
  double thermal_time; | 
| 176 | 
< | 
  double rcut; | 
| 177 | 
< | 
  double rsw; | 
| 178 | 
< | 
  double dielectric; | 
| 179 | 
< | 
  int tempSet; | 
| 180 | 
< | 
  int useInitTime; | 
| 181 | 
< | 
  int useInitXSstate; | 
| 182 | 
< | 
  int usePBC; | 
| 183 | 
< | 
  int useRF; | 
| 184 | 
< | 
  double q_mass; | 
| 185 | 
< | 
  double tau_thermostat; | 
| 186 | 
< | 
  double tau_barostat; | 
| 187 | 
< | 
  double zcons_time;     | 
| 188 | 
< | 
  double zcons_tol; | 
| 189 | 
< | 
  char zconsForcePolicy[100]; | 
| 190 | 
< | 
  double zcons_gap; | 
| 191 | 
< | 
  double zcons_fixtime; | 
| 192 | 
< | 
  int zcons_using_smd; | 
| 193 | 
< | 
   | 
| 194 | 
< | 
  int seed; | 
| 195 | 
< | 
  char minimizer_name[100]; | 
| 196 | 
< | 
  int minimizer_maxiteration; | 
| 197 | 
< | 
  int minimizer_writefrq; | 
| 198 | 
< | 
  double minimizer_stepsize; | 
| 199 | 
< | 
  double minimizer_ftol; | 
| 200 | 
< | 
  double minimizer_gtol; | 
| 201 | 
< | 
  double minimizer_ls_tol; | 
| 202 | 
< | 
  int minimizer_ls_maxiteration; | 
| 203 | 
< | 
  int useSolidThermInt; | 
| 204 | 
< | 
  int useLiquidThermInt; | 
| 205 | 
< | 
  double thermodynamic_integration_lambda; | 
| 206 | 
< | 
  double thermodynamic_integration_k; | 
| 207 | 
< | 
  char forcefield_variant[100]; | 
| 136 | 
> | 
template<class ParamType> | 
| 137 | 
> | 
class Parameter : public ParameterBase{ | 
| 138 | 
> | 
   public:     | 
| 139 | 
> | 
    typedef ParameterTraits<ParamType> ValueType; | 
| 140 | 
> | 
     void setDefaultValue(const ParamType& value) {data_ = value; defaultValue_ = true;} | 
| 141 | 
> | 
     ParamType getData() { return data_;} | 
| 142 | 
  | 
 | 
| 143 | 
< | 
  //required arguments | 
| 144 | 
< | 
  short int have_force_field, have_n_components, have_target_temp; | 
| 145 | 
< | 
  short int have_target_pressure, have_ensemble, have_dt, have_run_time; | 
| 146 | 
< | 
   | 
| 147 | 
< | 
  // optional arguments | 
| 148 | 
< | 
  short int have_initial_config, have_final_config, have_n_mol; | 
| 149 | 
< | 
  short int have_density, have_box, have_box_x, have_box_y, have_box_z; | 
| 150 | 
< | 
  short int have_sample_time, have_status_time, have_rcut, have_dielectric; | 
| 151 | 
< | 
  short int have_tempSet, have_thermal_time, have_rsw, have_q_mass; | 
| 152 | 
< | 
  short int have_tau_thermostat, have_tau_barostat; | 
| 153 | 
< | 
  short int have_zcons_time, have_zConstraints, have_n_zConstraints; | 
| 154 | 
< | 
  short int have_zcons_tol, have_seed; | 
| 155 | 
< | 
  short int have_zcons_force_policy, have_reset_time; | 
| 156 | 
< | 
  short int have_zcons_gap, have_zcons_fixtime; | 
| 157 | 
< | 
  short int have_zcons_using_smd; | 
| 158 | 
< | 
  short int have_minimizer, have_minimizer_maxiteration; | 
| 159 | 
< | 
  short int have_minimizer_writefrq, have_minimizer_stepsize; | 
| 160 | 
< | 
  short int have_minimizer_ftol, have_minimizer_gtol; | 
| 161 | 
< | 
  short int have_minimizer_ls_tol, have_minimizer_ls_maxiteration; | 
| 162 | 
< | 
  short int have_thermodynamic_integration_lambda; | 
| 163 | 
< | 
  short int have_thermodynamic_integration_k; | 
| 164 | 
< | 
  short int have_forcefield_variant; | 
| 143 | 
> | 
    virtual bool setData(std::string sval) { | 
| 144 | 
> | 
        return internalSetData<std::string>(sval); | 
| 145 | 
> | 
    } | 
| 146 | 
> | 
    virtual bool setData(int ival) { | 
| 147 | 
> | 
        return internalSetData<int>(ival); | 
| 148 | 
> | 
    } | 
| 149 | 
> | 
     | 
| 150 | 
> | 
    virtual bool setData(double dval) { | 
| 151 | 
> | 
        return internalSetData<double>(dval); | 
| 152 | 
> | 
    } | 
| 153 | 
> | 
 | 
| 154 | 
> | 
    virtual std::string getParamType() { return ParameterTraits<ParamType>::getParamType();} | 
| 155 | 
> | 
   private:  | 
| 156 | 
> | 
     template<class T> bool internalSetData(T data) { | 
| 157 | 
> | 
        ParamType tmp; | 
| 158 | 
> | 
        bool result = ValueType::convert(data, tmp); | 
| 159 | 
> | 
        if (result) { | 
| 160 | 
> | 
            empty_ = false; | 
| 161 | 
> | 
            data_ = tmp; | 
| 162 | 
> | 
        } | 
| 163 | 
> | 
        return result; | 
| 164 | 
> | 
     } | 
| 165 | 
> | 
      | 
| 166 | 
> | 
   private: | 
| 167 | 
> | 
     ParamType data_; | 
| 168 | 
> | 
       | 
| 169 | 
  | 
}; | 
| 170 | 
  | 
 | 
| 171 | 
+ | 
#define DeclareParameter(NAME, TYPE)         \ | 
| 172 | 
+ | 
    private:                                                   \ | 
| 173 | 
+ | 
      Parameter<TYPE> NAME;                                     \ | 
| 174 | 
+ | 
    public:                                                      \ | 
| 175 | 
+ | 
      bool have##NAME() { return !NAME.empty();}  \ | 
| 176 | 
+ | 
      TYPE get##NAME() { return NAME.getData();} | 
| 177 | 
+ | 
 | 
| 178 | 
+ | 
 | 
| 179 | 
+ | 
class Globals { | 
| 180 | 
+ | 
  public: | 
| 181 | 
+ | 
    Globals(); | 
| 182 | 
+ | 
     | 
| 183 | 
+ | 
  DeclareParameter(ForceField, std::string); | 
| 184 | 
+ | 
  DeclareParameter(NComponents, int);   | 
| 185 | 
+ | 
  DeclareParameter(TargetTemp, double); | 
| 186 | 
+ | 
  DeclareParameter(Ensemble, std::string); | 
| 187 | 
+ | 
  DeclareParameter(Dt, double); | 
| 188 | 
+ | 
  DeclareParameter(RunTime, double); | 
| 189 | 
+ | 
  DeclareParameter(InitialConfig, std::string); | 
| 190 | 
+ | 
  DeclareParameter(FinalConfig, std::string); | 
| 191 | 
+ | 
  DeclareParameter(NMol, int); | 
| 192 | 
+ | 
  DeclareParameter(Density, double); | 
| 193 | 
+ | 
  DeclareParameter(Box, double); | 
| 194 | 
+ | 
  DeclareParameter(BoxX, double); | 
| 195 | 
+ | 
  DeclareParameter(BoxY, double); | 
| 196 | 
+ | 
  DeclareParameter(BoxZ, double); | 
| 197 | 
+ | 
  DeclareParameter(SampleTime, double); | 
| 198 | 
+ | 
  DeclareParameter(ResetTime, double); | 
| 199 | 
+ | 
  DeclareParameter(StatusTime, double); | 
| 200 | 
+ | 
  DeclareParameter(CutoffRadius, double); | 
| 201 | 
+ | 
  DeclareParameter(SwitchingRadius, double); | 
| 202 | 
+ | 
  DeclareParameter(Dielectric, double); | 
| 203 | 
+ | 
  DeclareParameter(TempSet, bool); | 
| 204 | 
+ | 
  DeclareParameter(ThermalTime, double); | 
| 205 | 
+ | 
  DeclareParameter(MixingRule, std::string); | 
| 206 | 
+ | 
  DeclareParameter(UsePeriodicBoundaryConditions, bool); | 
| 207 | 
+ | 
  DeclareParameter(TargetPressure, double); | 
| 208 | 
+ | 
  DeclareParameter(TauThermostat, double); | 
| 209 | 
+ | 
  DeclareParameter(TauBarostat, double); | 
| 210 | 
+ | 
  DeclareParameter(ZconsTime, double); | 
| 211 | 
+ | 
  DeclareParameter(NZconstraints, int); | 
| 212 | 
+ | 
  DeclareParameter(ZconsTol, double); | 
| 213 | 
+ | 
  DeclareParameter(ZconsForcePolicy, std::string); | 
| 214 | 
+ | 
  DeclareParameter(Seed, int); | 
| 215 | 
+ | 
  DeclareParameter(UseInitalTime, bool); | 
| 216 | 
+ | 
  DeclareParameter(UseIntialExtendedSystemState, bool); | 
| 217 | 
+ | 
  DeclareParameter(OrthoBoxTolerance, double); | 
| 218 | 
+ | 
  DeclareParameter(Minimizer, std::string); | 
| 219 | 
+ | 
  DeclareParameter(MinimizerMaxIter, double); | 
| 220 | 
+ | 
  DeclareParameter(MinimizerWriteFrq, int); | 
| 221 | 
+ | 
  DeclareParameter(MinimizerStepSize, double); | 
| 222 | 
+ | 
  DeclareParameter(MinimizerFTol, double); | 
| 223 | 
+ | 
  DeclareParameter(MinimizerGTol, double); | 
| 224 | 
+ | 
  DeclareParameter(MinimizerLSTol, double); | 
| 225 | 
+ | 
  DeclareParameter(MinimizerLSMaxIter, int); | 
| 226 | 
+ | 
  DeclareParameter(ZconsGap, double); | 
| 227 | 
+ | 
  DeclareParameter(ZconsFixtime, double); | 
| 228 | 
+ | 
  DeclareParameter(ZconsUsingSMD, bool); | 
| 229 | 
+ | 
  DeclareParameter(UseSolidThermInt, bool); | 
| 230 | 
+ | 
  DeclareParameter(UseLiquidThermInt, bool); | 
| 231 | 
+ | 
  DeclareParameter(ThermodynamicIntegrationLambda, double); | 
| 232 | 
+ | 
  DeclareParameter(ThermodynamicIntegrationK, double); | 
| 233 | 
+ | 
  DeclareParameter(ForceFieldVariant, std::string); | 
| 234 | 
+ | 
  DeclareParameter(ForceFieldFileName, std::string); | 
| 235 | 
+ | 
  DeclareParameter(ThermIntDistSpringConst, double); | 
| 236 | 
+ | 
  DeclareParameter(ThermIntThetaSpringConst, double); | 
| 237 | 
+ | 
  DeclareParameter(ThermIntOmegaSpringConst, double); | 
| 238 | 
+ | 
  DeclareParameter(SurfaceTension, double); | 
| 239 | 
+ | 
  DeclareParameter(PrintPressureTensor, bool); | 
| 240 | 
+ | 
  DeclareParameter(ElectrostaticSummationMethod, std::string); | 
| 241 | 
+ | 
  DeclareParameter(DampingAlpha, double); | 
| 242 | 
+ | 
  DeclareParameter(CutoffPolicy, std::string); | 
| 243 | 
+ | 
  DeclareParameter(CompressDumpFile, bool); | 
| 244 | 
+ | 
  DeclareParameter(SkinThickness, double); | 
| 245 | 
+ | 
  DeclareParameter(StatFileFormat, std::string);     | 
| 246 | 
+ | 
 | 
| 247 | 
+ | 
  private: | 
| 248 | 
+ | 
    typedef std::map<std::string, ParameterBase*> ParamMap; | 
| 249 | 
+ | 
    ParamMap parameters_; | 
| 250 | 
+ | 
     | 
| 251 | 
+ | 
    Component* current_component; | 
| 252 | 
+ | 
    Component** components; // the array of components | 
| 253 | 
+ | 
 | 
| 254 | 
+ | 
    ZconStamp* current_zConstraint; | 
| 255 | 
+ | 
    ZconStamp** zConstraints; // the array of zConstraints | 
| 256 | 
+ | 
 | 
| 257 | 
+ | 
    char* checkMe(); | 
| 258 | 
+ | 
 | 
| 259 | 
+ | 
  public: | 
| 260 | 
+ | 
    int newComponent( event* the_event ); | 
| 261 | 
+ | 
    int componentAssign( event* the_event ); | 
| 262 | 
+ | 
    int componentEnd( event* the_event ); | 
| 263 | 
+ | 
 | 
| 264 | 
+ | 
    int newZconstraint( event* the_event ); | 
| 265 | 
+ | 
    int zConstraintAssign( event* the_event ); | 
| 266 | 
+ | 
    int zConstraintEnd( event* the_event ); | 
| 267 | 
+ | 
   | 
| 268 | 
+ | 
    int globalAssign( event* the_event ); | 
| 269 | 
+ | 
    int globalEnd( event* the_event );     | 
| 270 | 
+ | 
 | 
| 271 | 
+ | 
    ZconStamp** getZconStamp() {return zConstraints;} | 
| 272 | 
+ | 
    Component** getComponents() {return components;} | 
| 273 | 
+ | 
}; | 
| 274 | 
  | 
#endif | 
| 275 | 
+ | 
 |