33 void Foam::potential::setSiteIdList(
const dictionary& moleculePropertiesDict)
36 DynamicList<word> pairPotentialSiteIdList;
40 const word& id(idList_[i]);
42 if (!moleculePropertiesDict.found(
id))
45 <<
id <<
" molecule subDict not found" 49 const dictionary& molDict(moleculePropertiesDict.subDict(
id));
51 List<word> siteIdNames
53 molDict.lookup(
"siteIds")
58 const word& siteId = siteIdNames[sI];
66 List<word> pairPotSiteIds
68 molDict.lookup(
"pairPotentialSiteIds")
73 const word& siteId = pairPotSiteIds[sI];
75 if (!siteIdNames.found(siteId))
78 << siteId <<
" in pairPotentialSiteIds is not in siteIds: " 82 if (!pairPotentialSiteIdList.found(siteId))
84 pairPotentialSiteIdList.append(siteId);
89 nPairPotIds_ = pairPotentialSiteIdList.size();
95 if (!pairPotentialSiteIdList.found(siteId))
97 pairPotentialSiteIdList.
append(siteId);
101 siteIdList_.
transfer(pairPotentialSiteIdList);
105 void Foam::potential::potential::readPotentialDict()
107 Info<<
nl <<
"Reading potential dictionary:" <<
endl;
109 IOdictionary idListDict
114 mesh_.time().constant(),
129 "moleculeProperties",
130 mesh_.time().constant(),
139 List<word> pairPotentialSiteIdList
141 SubList<word>(siteIdList_, nPairPotIds_)
144 Info<<
nl <<
"Unique site ids found: " << siteIdList_
145 <<
nl <<
"Site Ids requiring a pair potential: " 146 << pairPotentialSiteIdList
149 List<word> tetherSiteIdList;
150 idListDict.
readIfPresent(
"tetherSiteIdList", tetherSiteIdList);
152 IOdictionary potentialDict
157 mesh_.time().system(),
164 potentialDict.readEntry(
"potentialEnergyLimit", potentialEnergyLimit_);
168 if (potentialDict.readIfPresent(
"removalOrder", remOrd))
170 removalOrder_.setSize(remOrd.size());
174 removalOrder_[rO] = idList_.find(remOrd[rO]);
176 if (removalOrder_[rO] == -1)
179 <<
"removalOrder entry: " << remOrd[rO]
180 <<
" not found in idList." 189 if (!potentialDict.found(
"pair"))
192 <<
"pair potential specification subDict not found" 196 const dictionary& pairDict = potentialDict.subDict(
"pair");
198 pairPotentials_.buildPotentials
200 pairPotentialSiteIdList,
208 if (tetherSiteIdList.size())
210 if (!potentialDict.found(
"tether"))
213 <<
"tether potential specification subDict not found" 217 const dictionary& tetherDict = potentialDict.subDict(
"tether");
219 tetherPotentials_.buildPotentials
232 if (potentialDict.found(
"external"))
234 Info<<
nl <<
"Reading external forces:" <<
endl;
236 const dictionary& externalDict = potentialDict.subDict(
"external");
239 externalDict.readIfPresent(
"gravity", gravity_);
246 void Foam::potential::potential::readMdInitialiseDict
248 const IOdictionary& mdInitialiseDict,
249 IOdictionary& idListDict
252 IOdictionary moleculePropertiesDict
256 "moleculeProperties",
257 mesh_.time().constant(),
265 DynamicList<word> idList;
267 DynamicList<word> tetherSiteIdList;
269 forAll(mdInitialiseDict.toc(), zone)
271 const dictionary& zoneDict = mdInitialiseDict.subDict
273 mdInitialiseDict.toc()[zone]
276 List<word> latticeIds
278 zoneDict.lookup(
"latticeIds")
283 const word&
id = latticeIds[i];
285 if (!moleculePropertiesDict.found(
id))
288 <<
"Molecule type " <<
id 289 <<
" not found in moleculeProperties dictionary." <<
nl 293 if (!idList.found(
id))
299 List<word> tetherSiteIds
301 zoneDict.lookup(
"tetherSiteIds")
306 const word& tetherSiteId = tetherSiteIds[t];
308 bool idFound =
false;
317 const word&
id = latticeIds[i];
321 moleculePropertiesDict.subDict(
id).lookup(
"siteIds")
324 if (siteIds.found(tetherSiteId))
332 tetherSiteIdList.append(tetherSiteId);
337 <<
" not found as a site of any molecule in zone." <<
nl 343 idList_.transfer(idList);
345 tetherSiteIdList.shrink();
347 idListDict.add(
"idList", idList_);
349 idListDict.add(
"tetherSiteIdList", tetherSiteIdList);
351 setSiteIdList(moleculePropertiesDict);
364 Foam::potential::potential
373 readMdInitialiseDict(mdInitialiseDict, idListDict);
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const T &val, label pos=0) const
Same as contains()
constexpr char tab
The tab '\t' character(0x09)
Ignore writing from objectRegistry::writeObject()
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
errorManip< error > abort(error &err)
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
Do not request registration (bool: false)
const List< word > & siteIdList() const
static constexpr const zero Zero
Global zero (0)