--- trunk/src/UseTheForce/ForceField.hpp 2005/04/15 22:04:00 507 +++ branches/development/src/UseTheForce/ForceField.hpp 2011/09/13 22:05:04 1627 @@ -6,19 +6,10 @@ * redistribute this software in source and binary code form, provided * that the following conditions are met: * - * 1. Acknowledgement of the program authors must be made in any - * publication of scientific results based in part on use of the - * program. An acceptable form of acknowledgement is citation of - * the article in which the program was described (Matthew - * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher - * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented - * Parallel Simulation Engine for Molecular Dynamics," - * J. Comput. Chem. 26, pp. 252-271 (2005)) - * - * 2. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 3. Redistributions in binary form must reproduce the above copyright + * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. @@ -37,6 +28,15 @@ * arising out of the use of or inability to use software, even if the * University of Notre Dame has been advised of the possibility of * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [4] Vardeman & Gezelter, in progress (2009). */ /** @@ -50,21 +50,23 @@ #ifndef USETHEFORCE_FORCEFIELD_HPP #define USETHEFORCE_FORCEFIELD_HPP -#define MK_STR(s) # s -#define STR_DEFINE(t, s) t = MK_STR(s) - +#include "config.h" #include #include +#include -#include "io/basic_ifstrstream.hpp" +#include "io/ifstrstream.hpp" +#include "io/ForceFieldOptions.hpp" #include "utils/TypeContainer.hpp" +#include "utils/Tuple.hpp" #include "types/AtomType.hpp" #include "types/BondType.hpp" #include "types/BendType.hpp" #include "types/TorsionType.hpp" +#include "types/InversionType.hpp" +#include "types/NonBondedInteractionType.hpp" +namespace OpenMD { -namespace oopse { - /** * @class ForceField ForceField.hpp ''UseTheForce/ForceField.hpp" * @brief @@ -77,11 +79,13 @@ namespace oopse { typedef TypeContainer BondTypeContainer; typedef TypeContainer BendTypeContainer; typedef TypeContainer TorsionTypeContainer; - - ForceField(); + typedef TypeContainer InversionTypeContainer; + typedef TypeContainer NonBondedInteractionTypeContainer; + + ForceField(); + + virtual ~ForceField() {}; - virtual ~ForceField(); - std::string getForceFieldFileName() { return forceFieldFileName_; } @@ -93,47 +97,81 @@ namespace oopse { virtual void parse(const std::string& filename) = 0; AtomType* getAtomType(const std::string &at); + AtomType* getAtomType(int ident); BondType* getBondType(const std::string &at1, const std::string &at2); BendType* getBendType(const std::string &at1, const std::string &at2, - const std::string &at3); + const std::string &at3); TorsionType* getTorsionType(const std::string &at1, const std::string &at2, - const std::string &at3, const std::string &at4); - + const std::string &at3, const std::string &at4); + InversionType* getInversionType(const std::string &at1, + const std::string &at2, + const std::string &at3, + const std::string &at4); + NonBondedInteractionType* getNonBondedInteractionType(const std::string &at1, const std::string &at2); + BondType* getExactBondType(const std::string &at1, const std::string &at2); BendType* getExactBendType(const std::string &at1, const std::string &at2, - const std::string &at3); - TorsionType* getExactTorsionType(const std::string &at1, const std::string &at2, - const std::string &at3, const std::string &at4); - - + const std::string &at3); + TorsionType* getExactTorsionType(const std::string &at1, + const std::string &at2, + const std::string &at3, + const std::string &at4); + InversionType* getExactInversionType(const std::string &at1, + const std::string &at2, + const std::string &at3, + const std::string &at4); + NonBondedInteractionType* getExactNonBondedInteractionType(const std::string &at1, const std::string &at2); + + //avoid make virtual function public //Herb Sutter and Andrei Alexandrescu, C++ coding Standards, Addision-Wesley - virtual double getRcutFromAtomType(AtomType* at); - + virtual RealType getRcutFromAtomType(AtomType* at); + std::string getWildCard() { return wildCardAtomTypeName_; } - + void setWildCard(const std::string& wildCard) { wildCardAtomTypeName_ = wildCard; } - - + unsigned int getNAtomType() { return atomTypeCont_.size(); } + + AtomTypeContainer* getAtomTypes() { + return &atomTypeCont_; + } + + NonBondedInteractionTypeContainer* getNonBondedInteractionTypes() { + return &nonBondedInteractionTypeCont_; + } bool addAtomType(const std::string &at, AtomType* atomType); - bool addBondType(const std::string &at1, const std::string &at2, BondType* bondType); + bool replaceAtomType(const std::string &at, AtomType* atomType); + bool addBondType(const std::string &at1, const std::string &at2, + BondType* bondType); + bool addBendType(const std::string &at1, const std::string &at2, const std::string &at3, BendType* bendType); bool addTorsionType(const std::string &at1, const std::string &at2, - const std::string &at3, const std::string &at4, TorsionType* torsionType); + const std::string &at3, const std::string &at4, + TorsionType* torsionType); + bool addInversionType(const std::string &at1, const std::string &at2, + const std::string &at3, const std::string &at4, + InversionType* inversionType); + + bool addNonBondedInteractionType(const std::string &at1, + const std::string &at2, + NonBondedInteractionType* nbiType); + ifstrstream* openForceFieldFile(const std::string& filename); + + ForceFieldOptions& getForceFieldOptions() {return forceFieldOptions_;} protected: @@ -141,16 +179,17 @@ namespace oopse { BondTypeContainer bondTypeCont_; BendTypeContainer bendTypeCont_; TorsionTypeContainer torsionTypeCont_; - + InversionTypeContainer inversionTypeCont_; + NonBondedInteractionTypeContainer nonBondedInteractionTypeCont_; + ForceFieldOptions forceFieldOptions_; + std::map atypeIdentToName; + private: - std::string ffPath_; - - std::string wildCardAtomTypeName_; - - std::string forceFieldFileName_; + std::string ffPath_; + std::string wildCardAtomTypeName_; + std::string forceFieldFileName_; + }; - - -}//end namespace oopse +}//end namespace OpenMD #endif