Biotype.h

Go to the documentation of this file.
00001 #ifndef SimTK_MOLMODEL_BIOTYPE_H_
00002 #define SimTK_MOLMODEL_BIOTYPE_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                      SimTK Core: SimTK SIMBODY                            *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK Core biosimulation toolkit originating from      *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org.               *
00011  *                                                                            *
00012  * Portions copyright (c) 2007 Stanford University and the Authors.           *
00013  * Authors: Michael Sherman, Christopher Bruns                                *
00014  * Contributors:                                                              *
00015  *                                                                            *
00016  * Permission is hereby granted, free of charge, to any person obtaining a    *
00017  * copy of this software and associated documentation files (the "Software"), *
00018  * to deal in the Software without restriction, including without limitation  *
00019  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
00020  * and/or sell copies of the Software, and to permit persons to whom the      *
00021  * Software is furnished to do so, subject to the following conditions:       *
00022  *                                                                            *
00023  * The above copyright notice and this permission notice shall be included in *
00024  * all copies or substantial portions of the Software.                        *
00025  *                                                                            *
00026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
00027  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
00028  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
00029  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
00030  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
00031  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
00032  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
00033  * -------------------------------------------------------------------------- */
00034 
00035 
00036 #include "molmodel/internal/common.h"
00037 #include "molmodel/internal/Element.h"
00038 #include "molmodel/internal/GrinPointer.h"
00039 
00040 namespace SimTK {
00041 
00042 namespace Ordinality {
00044     enum Residue {
00045         Any = 1, 
00046         Initial = 2, 
00047         Final = 3}; 
00048 }
00049 
00050 // Biotype is a hook that will be used to look up molecular
00051 // force field specific parameters for an atom type
00052 SimTK_DEFINE_AND_EXPORT_UNIQUE_INDEX_TYPE(SimTK_MOLMODEL_EXPORT,BiotypeIndex);
00053 SimTK_DEFINE_AND_EXPORT_UNIQUE_INDEX_TYPE(SimTK_MOLMODEL_EXPORT,TinkerBiotypeIndex);
00054 
00055 // class Biotype;
00056 // class BiotypeRep;
00057 
00058 // Avoid instantiating template class except in one particular library compilation unit
00059 // #ifndef DO_INSTANTIATE_BIOTYPE_PIMPL_HANDLE
00060 //     extern template class SimTK_MOLMODEL_EXPORT PIMPLHandle<Biotype, BiotypeRep>;
00061 // #endif
00062 
00063 class SimTK_MOLMODEL_EXPORT Biotype // : public PIMPLHandle<SimTK_MOLMODEL_EXPORT Biotype,BiotypeRep> 
00064 {
00065 public:
00066 
00067     // Noble gases
00068     static const Biotype& Argon();
00069 
00070     static const Biotype& MethaneH();
00071     static const Biotype& MethaneC();
00072 
00073     static const Biotype& EthaneH();
00074     static const Biotype& EthaneC();
00075 
00076     static const Biotype& SerineN();
00077     static const Biotype& SerineHN();
00078     static const Biotype& SerineCA();
00079     static const Biotype& SerineHA();
00080 
00081     static const Biotype& SerineC();
00082     static const Biotype& SerineO();
00083     static const Biotype& SerineCB();
00084     static const Biotype& SerineHB();
00085     static const Biotype& SerineOG();
00086     static const Biotype& SerineHG();
00087 
00088     const Element&  getElement() const;
00089     int             getValence() const;
00090     BiotypeIndex       getIndex() const;
00091     TinkerBiotypeIndex getTinkerBiotypeIfAny() const;
00092 
00093     Biotype& setTinkerBiotypeIndex(TinkerBiotypeIndex tIx);
00094 
00095     static void initializePopularBiotypes();
00096 
00097     static const Biotype& get(BiotypeIndex biotypeIndex);
00098     static const Biotype& get(TinkerBiotypeIndex tinkerBiotypeIndex);
00099     static const Biotype& get(const char* residueName, 
00100                               const char* atomName, 
00101                               Ordinality::Residue ordinality = Ordinality::Any);
00102 
00103     static Biotype& upd(BiotypeIndex biotypeIndex);
00104     static Biotype& upd(TinkerBiotypeIndex tinkerBiotypeIndex);
00105     static Biotype& upd(const char* residueName, 
00106                               const char* atomName, 
00107                               Ordinality::Residue ordinality = Ordinality::Any);
00108 
00109     static bool exists(const char* residueName, 
00110                        const char* atomName, 
00111                        Ordinality::Residue ordinality = Ordinality::Any);
00112 
00113     static bool exists(BiotypeIndex biotypeIndex);
00114 
00115     static BiotypeIndex defineBiotype(const Element& element,
00116                                    int valence,
00117                                    const char* residueName, 
00118                                    const char* atomName, 
00119                                    Ordinality::Residue ordinality = Ordinality::Any)
00120     {
00121         return defineTinkerBiotype(InvalidTinkerBiotypeIndex, 
00122                                    element,
00123                                    valence,
00124                                    residueName, 
00125                                    atomName, 
00126                                    ordinality);
00127     }
00128 
00129     static BiotypeIndex defineTinkerBiotype(TinkerBiotypeIndex tinkerBiotypeIndex, 
00130                                          const Element& element,
00131                                          int valence,
00132                                          const char* residueName, 
00133                                          const char* atomName, 
00134                                          Ordinality::Residue ordinality = Ordinality::Any); 
00135 
00136     static std::ostream& generateAllBiotypeCode(std::ostream& os); 
00137 
00138     Biotype();
00139 
00140     const String& getAtomName() const;
00141     const String& getResidueName() const;
00142     Ordinality::Residue getOrdinality() const;
00143 
00144 // TODO make generateSelfCode protected:
00145     
00146     // emit C++ source code that can repopulate biotype data corresponding to this biotype
00147     std::ostream& generateSelfCode(std::ostream& os) const;
00148 
00149 private:
00150 
00151     Biotype( BiotypeIndex biotypeIndex, 
00152              TinkerBiotypeIndex tinkerBiotypeIndex, 
00153              const Element& element,
00154              int valence,
00155              const char* residueName, 
00156              const char* atomName, 
00157              Ordinality::Residue ordinality);
00158 
00159 // No, Microsoft Visual Studio, private data do not need to be exported
00160 #if defined(_MSC_VER)
00161 #pragma warning(push)
00162 #pragma warning(disable:4251)
00163 #endif
00164 
00165     class Impl;
00166     GrinPointer<Impl> impl;
00167 
00168 #if defined(_MSC_VER)
00169 #pragma warning(pop)
00170 #endif
00171 
00172 };
00173 
00174 } // namespace SimTK
00175 
00176 #endif // SimTK_MOLMODEL_BIOTYPE_H_

Generated on Fri Sep 26 07:44:08 2008 for SimTKcore by  doxygen 1.5.6