35 void 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
127 mesh.time().path()/pairPotentialName
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
173 mesh.time().path()/
"electrostatic"
177 if (!electrostaticPotential_->writeEnergyAndForceTables(ppTabFile()))
180 <<
"Failed writing to "
181 << ppTabFile().name() <<
nl
186 rCutMaxSqr_ = rCutMax_*rCutMax_;
207 buildPotentials(idList, pairPotentialDict,
mesh);
226 setSize(((idList.size()*(idList.size() + 1))/2));
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);