30 void Foam::potential::setSiteIdList(
const IOdictionary& moleculePropertiesDict)
34 DynamicList<word> pairPotentialSiteIdList;
38 const word& id(idList_[i]);
40 if (!moleculePropertiesDict.found(
id))
43 <<
id <<
" molecule subDict not found"
47 const dictionary& molDict(moleculePropertiesDict.subDict(
id));
49 List<word> siteIdNames = molDict.lookup(
"siteIds");
53 const word& siteId = siteIdNames[sI];
57 siteIdList.append(siteId);
61 List<word> pairPotSiteIds = molDict.lookup(
"pairPotentialSiteIds");
65 const word& siteId = pairPotSiteIds[sI];
70 << siteId <<
" in pairPotentialSiteIds is not in siteIds: "
74 if(
findIndex(pairPotentialSiteIdList, siteId) == -1)
76 pairPotentialSiteIdList.append(siteId);
81 nPairPotIds_ = pairPotentialSiteIdList.size();
85 const word& siteId = siteIdList[aSIN];
87 if(
findIndex(pairPotentialSiteIdList, siteId) == -1)
89 pairPotentialSiteIdList.append(siteId);
93 siteIdList_.
transfer(pairPotentialSiteIdList.shrink());
97 void Foam::potential::potential::readPotentialDict()
99 Info<<
nl <<
"Reading potential dictionary:" <<
endl;
101 IOdictionary idListDict
106 mesh_.time().constant(),
113 idList_ = List<word>(idListDict.lookup(
"idList"));
115 IOdictionary moleculePropertiesDict
119 "moleculeProperties",
120 mesh_.time().constant(),
128 setSiteIdList(moleculePropertiesDict);
130 List<word> pairPotentialSiteIdList
132 SubList<word>(siteIdList_, nPairPotIds_)
135 Info<<
nl <<
"Unique site ids found: " << siteIdList_
136 <<
nl <<
"Site Ids requiring a pair potential: "
137 << pairPotentialSiteIdList
140 List<word> tetherSiteIdList(0);
142 if (idListDict.found(
"tetherSiteIdList"))
144 tetherSiteIdList = List<word>(idListDict.lookup(
"tetherSiteIdList"));
147 IOdictionary potentialDict
152 mesh_.time().system(),
161 potentialDict.lookup(
"potentialEnergyLimit")
164 if (potentialDict.found(
"removalOrder"))
166 List<word> remOrd = potentialDict.lookup(
"removalOrder");
168 removalOrder_.setSize(remOrd.size());
172 removalOrder_[rO] =
findIndex(idList_, remOrd[rO]);
174 if (removalOrder_[rO] == -1)
177 <<
"removalOrder entry: " << remOrd[rO]
178 <<
" not found in idList."
187 if (!potentialDict.found(
"pair"))
190 <<
"pair potential specification subDict not found"
194 const dictionary& pairDict = potentialDict.subDict(
"pair");
196 pairPotentials_.buildPotentials
198 pairPotentialSiteIdList,
206 if (tetherSiteIdList.size())
208 if (!potentialDict.found(
"tether"))
211 <<
"tether potential specification subDict not found"
215 const dictionary& tetherDict = potentialDict.subDict(
"tether");
217 tetherPotentials_.buildPotentials
230 if (potentialDict.found(
"external"))
233 Info <<
nl <<
"Reading external forces:" <<
endl;
235 const dictionary& externalDict = potentialDict.subDict(
"external");
240 if (externalDict.found(
"gravity"))
242 gravity_ = externalDict.lookup(
"gravity");
250 void Foam::potential::potential::readMdInitialiseDict
252 const IOdictionary& mdInitialiseDict,
253 IOdictionary& idListDict
256 IOdictionary moleculePropertiesDict
260 "moleculeProperties",
261 mesh_.time().constant(),
269 DynamicList<word> idList;
271 DynamicList<word> tetherSiteIdList;
273 forAll(mdInitialiseDict.toc(), zone)
275 const dictionary& zoneDict = mdInitialiseDict.subDict
277 mdInitialiseDict.toc()[zone]
280 List<word> latticeIds
282 zoneDict.lookup(
"latticeIds")
287 const word&
id = latticeIds[i];
289 if(!moleculePropertiesDict.found(
id))
294 <<
" not found in moleculeProperties dictionary."
305 List<word> tetherSiteIds
307 zoneDict.lookup(
"tetherSiteIds")
312 const word& tetherSiteId = tetherSiteIds[t];
314 bool idFound =
false;
323 const word&
id = latticeIds[i];
327 moleculePropertiesDict.subDict(
id).lookup(
"siteIds")
330 if (
findIndex(siteIds, tetherSiteId) != -1)
338 tetherSiteIdList.append(tetherSiteId);
345 <<
" not found as a site of any molecule in zone."
352 idList_.transfer(idList);
354 tetherSiteIdList.shrink();
356 idListDict.add(
"idList", idList_);
358 idListDict.add(
"tetherSiteIdList", tetherSiteIdList);
360 setSiteIdList(moleculePropertiesDict);
373 Foam::potential::potential
382 readMdInitialiseDict(mdInitialiseDict, idListDict);