--- branches/new_design/OOPSE-4/src/UseTheForce/ForceField.hpp 2004/11/05 21:04:13 1716 +++ branches/new_design/OOPSE-4/src/UseTheForce/ForceField.hpp 2004/11/06 05:21:55 1720 @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project + * + * Contact: oopse@oopse.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * All we ask is that proper credit is given for our work, which includes + * - but is not limited to - adding the above copyright notice to the beginning + * of your source code files, and to any copyright notice that you may distribute + * with programs based on this work. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + /** + * @file ForceField.hpp + * @author tlin + * @date 11/04/2004 + * @time 22:51am + * @version 1.0 + */ + #ifndef USETHEFORCE_FORCEFIELD_HPP #define USETHEFORCE_FORCEFIELD_HPP @@ -9,50 +42,75 @@ #include "utils/Tuple.hpp" #include "types/ShapeAtomType.hpp" #include "io/basic_ifstrstream.hpp" +#include "utils/TypeContainer.hpp" -using namespace std; -using namespace oopse; +namespace oopse { +/** + * @class ForceFiled ForceField.hpp ''UseTheForce/ForceField.hpp" + * @brief + */ class ForceField{ -public: + public: - ForceField(){ - hasVariant=false; - ffPath = getenv("FORCE_PARAM_PATH"); - if( ffPath.empty() ) { - STR_DEFINE(ffPath, FRC_PATH ); - } - } + ForceField(); - virtual ~ForceFields(){} + virtual ~ForceFields(){} - void setVariant(const string &variant) { hasVariant = true; theVariant = variant; } - virtual void readParams( void ) = 0; - - AtomType* getMatchingAtomType(const string &at); - BondType* getMatchingBondType(const string &at1, const string &at2); - BendType* getMatchingBendType(const string &at1, const string &at2, - const string &at3); - TorsionType* getMatchingTorsionType(const string &at1, const string &at2, - const string &at3, const string &at4); + void setVariant(const std::string &variant) { + hasVariant_ = true; + variant_ = variant; + } + virtual void readParams() = 0; - double getRcutForAtomType(AtomType* at); - -protected: - - string ffPath; - ifstrstream forceFile; - bool hasVariant; - string variant; - map atomTypeMap; - map, BondType*> bondTypeMap; - map, BendType*> bendTypeMap; - map, TorsionType*> torsionTypeMap; - string wildCardAtomTypeName; + AtomType* getAtomType(const std::string &at); + BondType* getBondType(const std::string &at1, const std::string &at2); + BendType* getBendType(const std::string &at1, const std::string &at2, + const std::string &at3); + TorsionType* getTorsionType(const std::string &at1, const std::string &at2, + const std::string &at3, const std::string &at4); -}; + double getRcutForAtomType(AtomType* at); + std::string getWildCard() { + return wildCardAtomTypeName_; + } + void setWildCard(const std::string& wildCard) { + wildCardAtomTypeName_ = wildCard; + } + + protected: + + void addAtomType(const std::string &at, AtomType* atomType); + void addBondType(const std::string &at1, const std::string &at2, BondType* bondType); + void addBendType(const std::string &at1, const std::string &at2, + const std::string &at3, BendType* bendType); + void addTorsionType(const std::string &at1, const std::string &at2, + const std::string &at3, const std::string &at4, TorsionType* torsionType); + + private: + std::string ffPath_; + ifstrstream forceFile_; + bool hasVariant_; + std::string variant_; + + std::string wildCardAtomTypeName_; + + typedef TypeContainer AtomTypeContainer; + typedef TypeContainer BondTypeContainer; + typedef TypeContainer BendTypeContainer; + typedef TypeContainer TorsionTypeContainer; + + AtomTypeContainer atomTypeCont_; + BondTypeContainer bondTypeCont_; + BendTypeContainer bendTypeCont_; + TorsionTypeContainer torsionTypeCont_; +}; + + typedef GenericFactory ForceFieldFactory; + +}//end namespace oopse #endif