Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / lagrangian / molecularDynamics / potential / pairPotential / basic / pairPotential.H
blobe89736e0352251fcdf897dceb8ef28abe4725554
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::pairPotential
27 Description
29 SourceFiles
30     pairPotential.C
31     pairPotentialNew.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef pairPotential_H
36 #define pairPotential_H
38 #include "IOdictionary.H"
39 #include "typeInfo.H"
40 #include "runTimeSelectionTables.H"
41 #include "autoPtr.H"
42 #include "List.H"
43 #include "Pair.H"
44 #include "Switch.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // Forward declaration of classes
52 class energyScalingFunction;
54 /*---------------------------------------------------------------------------*\
55                         Class pairPotential Declaration
56 \*---------------------------------------------------------------------------*/
58 class pairPotential
61 protected:
63     // Protected data
65         word name_;
66         dictionary pairPotentialProperties_;
68         scalar rCut_;
69         scalar rCutSqr_;
71         scalar rMin_;
72         scalar dr_;
74         List<scalar> forceLookup_;
75         List<scalar> energyLookup_;
77         mutable energyScalingFunction* esfPtr_;
79         bool writeTables_;
82     // Private Member Functions
84         void scaleEnergy(scalar& e, const scalar r) const;
86         //- Disallow copy construct
87         pairPotential(const pairPotential&);
89         //- Disallow default bitwise assignment
90         void operator=(const pairPotential&);
93 public:
95     //- Runtime type information
96         TypeName("pairPotential");
99     // Declare run-time constructor selection table
101         declareRunTimeSelectionTable
102         (
103             autoPtr,
104             pairPotential,
105             dictionary,
106             (
107                 const word& name,
108                 const dictionary& pairPotentialProperties
109             ),
110             (name, pairPotentialProperties)
111         );
114     // Selectors
116         //- Return a reference to the selected viscosity model
117         static autoPtr<pairPotential> New
118         (
119             const word& name,
120             const dictionary& pairPotentialProperties
121         );
124     // Constructors
126         //- Construct from components
127         pairPotential
128         (
129             const word& name,
130             const dictionary& pairPotentialProperties
131         );
134     //- Destructor
135     virtual ~pairPotential()
136     {}
139     // Member Functions
141         void setLookupTables();
143         inline scalar rMin() const;
145         inline scalar dr() const;
147         inline scalar rCut() const;
149         inline scalar rCutSqr() const;
151         scalar energy (const scalar r) const;
153         scalar force (const scalar r) const;
155         List<Pair<scalar> > energyTable() const;
157         List<Pair<scalar> > forceTable() const;
159         inline bool writeTables() const;
161         virtual scalar unscaledEnergy(const scalar r) const = 0;
163         scalar scaledEnergy(const scalar r) const;
165         scalar energyDerivative
166         (
167             const scalar r,
168             const bool scaledEnergyDerivative = true
169         ) const;
171         const dictionary& pairPotentialProperties() const
172         {
173             return pairPotentialProperties_;
174         }
176         bool writeEnergyAndForceTables(Ostream& os) const;
178         //- Read pairPotential dictionary
179         virtual bool read(const dictionary& pairPotentialProperties) = 0;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #include "pairPotentialI.H"
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 #endif
195 // ************************************************************************* //