RDCode: Params.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# Params.h

Go to the documentation of this file.

    00001 //
    00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
    00003 //
    00004 //   @@ All Rights Reserved  @@
    00005 //
    00006 #ifndef __RD_PARAMS_H__
    00007 #define __RD_PARAMS_H__
    00008
    00009 #include <string>
    00010 #include <map>
    00011
    00012 namespace ForceFields {
    00013   namespace UFF {
    00014
    00015     //! class to store atomic parameters for the Universal Force Field
    00016     class AtomicParams {
    00017     public:
    00018       double r1;     //!<  valence bond radius
    00019       double theta0; //!< valence angle
    00020       double x1;     //!< vdW characteristic length
    00021       double D1;     //!< vdW atomic energy
    00022       double zeta;   //!< vdW scaling term
    00023       double Z1;     //!< effective charge
    00024       double V1;     //!< sp3 torsional barrier parameter
    00025       double U1;     //!< torsional contribution for sp2-sp3 bonds
    00026       double GMP_Xi; //!< GMP Electronegativity;
    00027       double GMP_Hardness; //!< GMP Hardness
    00028       double GMP_Radius;   //!< GMP Radius value
    00029     };
    00030
    00031
    00032     namespace Params {
    00033       const double lambda=0.1332;       //!< scaling factor for rBO correction
    00034       const double G=332.06;            //!< bond force constant prefactor
    00035       const double amideBondOrder=1.41; //!< special case bond order for amide C-N bonds.
    00036     };
    00037
    00038     //! singleton class for retrieving UFF AtomParams
    00039     /*!
    00040       Use the singleton like this:
    00041
    00042       \verbatim
    00043       ParamCollection *params=ParamCollection::getParams();
    00044       const AtomParams *ap=params("C_3");
    00045       \endverbatim
    00046
    00047       If you have your own parameter data, it can be supplied as a string:
    00048       \verbatim
    00049       ParamCollection *params=ParamCollection::getParams(myParamData);
    00050       const AtomParams *ap=params("C_3");
    00051       \endverbatim
    00052       You are responsible for making sure that the data is in the correct
    00053       format (see Params.cpp for an example).
    00054
    00055     */
    00056     class ParamCollection {
    00057     public:
    00058       //! gets a pointer to the singleton ParamCollection
    00059       /*!
    00060         \param paramData (optional) a string with parameter data. See
    00061          below for more information about this argument
    00062
    00063         \return a pointer to the singleton ParamCollection
    00064
    00065         <b>Notes:</b>
    00066           - do <b>not</b> delete the pointer returned here
    00067           - if the singleton ParamCollection has already been instantiated and
    00068             \c paramData is empty, the singleton will be returned.
    00069           - if \c paramData is empty and the singleton ParamCollection has
    00070             not yet been instantiated, the default UFF parameters (from Params.cpp)
    00071             will be used.
    00072           - if \c paramData is supplied, a new singleton will be instantiated.
    00073             The current instantiation (if there is one) will be deleted.
    00074       */
    00075       static ParamCollection *getParams(const std::string &paramData="");
    00076       //! Looks up the parameters for a particular UFF key and returns them.
    00077       /*!
    00078         \return a pointer to the AtomicParams object, NULL on failure.
    00079       */
    00080       const AtomicParams *operator()(const std::string &symbol) const {
    00081         std::map<std::string,AtomicParams>::const_iterator res;
    00082         res=d_params.find(symbol);
    00083         if(res!=d_params.end()){
    00084           return &((*res).second);
    00085         }
    00086         return 0;
    00087       }
    00088     private:
    00089       //! to force this to be a singleton, the constructor must be private
    00090       ParamCollection(std::string paramData);
    00091       static class ParamCollection *ds_instance;    //!< the singleton
    00092       std::map<std::string,AtomicParams> d_params;  //!< the parameter map
    00093     };
    00094
    00095   }
    00096 }
    00097 #endif