Params.h

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