35void Foam::pairPotentialList::readPairPotentialDict
37 const List<word>& idList,
38 const dictionary& pairPotentialDict,
42 Info<<
nl <<
"Building pair potentials." <<
endl;
46 for (label a = 0; a < nIds_; ++a)
50 for (label
b = a;
b < nIds_; ++
b)
54 word pairPotentialName;
58 if (pairPotentialDict.found(idA +
"-" + idB))
60 pairPotentialName = idA +
"-" + idB;
65 <<
"Pair pairPotential specification subDict "
66 << idA <<
"-" << idB <<
" not found"
72 if (pairPotentialDict.found(idA +
"-" + idB))
74 pairPotentialName = idA +
"-" + idB;
77 else if (pairPotentialDict.found(idB +
"-" + idA))
79 pairPotentialName = idB +
"-" + idA;
85 <<
"Pair pairPotential specification subDict "
86 << idA <<
"-" << idB <<
" or "
87 << idB <<
"-" << idA <<
" not found"
93 pairPotentialDict.found(idA+
"-"+idB)
94 && pairPotentialDict.found(idB+
"-"+idA)
98 <<
"Pair pairPotential specification subDict "
99 << idA <<
"-" << idB <<
" and "
100 << idB <<
"-" << idA <<
" found multiple definition"
107 pairPotentialIndex(a,
b),
111 pairPotentialDict.subDict(pairPotentialName)
115 if ((*
this)[pairPotentialIndex(a,
b)].
rCut() > rCutMax_)
117 rCutMax_ = (*this)[pairPotentialIndex(a,
b)].rCut();
120 if ((*
this)[pairPotentialIndex(a,
b)].writeTables())
123 autoPtr<OSstream> ppTabFile
133 !(*
this)[pairPotentialIndex(a,
b)].writeEnergyAndForceTables
140 <<
"Failed writing to "
141 << ppTabFile().name() <<
nl
148 if (!pairPotentialDict.found(
"electrostatic"))
151 <<
"Pair pairPotential specification subDict electrostatic"
158 pairPotentialDict.subDict(
"electrostatic")
161 if (electrostaticPotential_->rCut() > rCutMax_)
163 rCutMax_ = electrostaticPotential_->rCut();
166 if (electrostaticPotential_->writeTables())
169 autoPtr<OSstream> ppTabFile
177 if (!electrostaticPotential_->writeEnergyAndForceTables(ppTabFile()))
180 <<
"Failed writing to "
181 << ppTabFile().name() <<
nl
186 rCutMaxSqr_ = rCutMax_*rCutMax_;
228 nIds_ = idList.
size();
230 readPairPotentialDict(idList, pairPotentialDict,
mesh);
240 return (*
this)[pairPotentialIndex(a,
b)];
246 if (rIJMagSqr < rCutMaxSqr_)
259 const scalar rIJMagSqr
262 if (rIJMagSqr < rCutSqr(a,
b))
277 return (*
this)[pairPotentialIndex(a,
b)].rMin();
287 return (*
this)[pairPotentialIndex(a,
b)].dr();
297 return (*
this)[pairPotentialIndex(a,
b)].rCutSqr();
307 return (*
this)[pairPotentialIndex(a,
b)].rCut();
318 scalar
f = (*this)[pairPotentialIndex(a,
b)].force(rIJMag);
331 scalar
e = (*this)[pairPotentialIndex(a,
b)].energy(rIJMag);
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
fileName path() const
Return path.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool mkDir(const fileName &, mode_t=0777) const =0
Make directory.
const Time & time() const
Return the top-level database.
scalar energy(const label a, const label b, const scalar rIJMag) const
scalar rCut(const label a, const label b) const
scalar rCutMaxSqr() const
~pairPotentialList()
Destructor.
void buildPotentials(const List< word > &idList, const dictionary &pairPotentialDict, const polyMesh &mesh)
const pairPotential & pairPotentialFunction(const label a, const label b) const
Mesh consisting of general polyhedral cells.
Base class for film (stress-based) force models.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fileOperation & fileHandler()
Get current file handler.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
constexpr char nl
The newline '\n' character (0x0a)
points setSize(newPointi)