30 void Foam::potential::setSiteIdList(
const dictionary& moleculePropertiesDict)
33 DynamicList<word> pairPotentialSiteIdList;
37 const word& id(idList_[i]);
39 if (!moleculePropertiesDict.found(
id))
42 <<
id <<
" molecule subDict not found" 46 const dictionary& molDict(moleculePropertiesDict.subDict(
id));
48 List<word> siteIdNames = molDict.lookup(
"siteIds");
52 const word& siteId = siteIdNames[sI];
56 siteIdList.append(siteId);
60 List<word> pairPotSiteIds = molDict.lookup(
"pairPotentialSiteIds");
64 const word& siteId = pairPotSiteIds[sI];
69 << siteId <<
" in pairPotentialSiteIds is not in siteIds: " 73 if (
findIndex(pairPotentialSiteIdList, siteId) == -1)
75 pairPotentialSiteIdList.append(siteId);
80 nPairPotIds_ = pairPotentialSiteIdList.size();
84 const word& siteId = siteIdList[aSIN];
86 if (
findIndex(pairPotentialSiteIdList, siteId) == -1)
88 pairPotentialSiteIdList.append(siteId);
92 siteIdList_.
transfer(pairPotentialSiteIdList.shrink());
96 void Foam::potential::potential::readPotentialDict()
98 Info<<
nl <<
"Reading potential dictionary:" <<
endl;
100 IOdictionary idListDict
112 idList_ = List<word>(idListDict.
lookup(
"idList"));
120 "moleculeProperties",
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
159 potentialEnergyLimit_ =
160 potentialDict.lookup<scalar>(
"potentialEnergyLimit");
162 if (potentialDict.found(
"removalOrder"))
164 List<word> remOrd = potentialDict.lookup(
"removalOrder");
166 removalOrder_.
setSize(remOrd.size());
170 removalOrder_[rO] =
findIndex(idList_, remOrd[rO]);
172 if (removalOrder_[rO] == -1)
175 <<
"removalOrder entry: " << remOrd[rO]
176 <<
" not found in idList." 185 if (!potentialDict.found(
"pair"))
188 <<
"pair potential specification subDict not found" 192 const dictionary& pairDict = potentialDict.subDict(
"pair");
196 pairPotentialSiteIdList,
204 if (tetherSiteIdList.size())
206 if (!potentialDict.found(
"tether"))
209 <<
"tether potential specification subDict not found" 213 const dictionary& tetherDict = potentialDict.subDict(
"tether");
228 if (potentialDict.found(
"external"))
230 Info<<
nl <<
"Reading external forces:" <<
endl;
232 const dictionary& externalDict = potentialDict.subDict(
"external");
235 externalDict.readIfPresent(
"gravity", gravity_);
242 void Foam::potential::potential::readMdInitialiseDict
244 const IOdictionary& mdInitialiseDict,
245 IOdictionary& idListDict
248 IOdictionary moleculePropertiesDict
252 "moleculeProperties",
263 DynamicList<word> tetherSiteIdList;
265 forAll(mdInitialiseDict.toc(), zone)
267 const dictionary& zoneDict = mdInitialiseDict.subDict
269 mdInitialiseDict.toc()[zone]
272 List<word> latticeIds
274 zoneDict.lookup(
"latticeIds")
279 const word&
id = latticeIds[i];
281 if (!moleculePropertiesDict.found(
id))
284 <<
"Molecule type " <<
id 285 <<
" not found in moleculeProperties dictionary." <<
nl 295 List<word> tetherSiteIds
297 zoneDict.lookup(
"tetherSiteIds")
302 const word& tetherSiteId = tetherSiteIds[t];
304 bool idFound =
false;
313 const word&
id = latticeIds[i];
317 moleculePropertiesDict.subDict(
id).lookup(
"siteIds")
320 if (
findIndex(siteIds, tetherSiteId) != -1)
328 tetherSiteIdList.append(tetherSiteId);
333 <<
" not found as a site of any molecule in zone." <<
nl 341 tetherSiteIdList.shrink();
343 idListDict.add(
"idList", idList_);
345 idListDict.add(
"tetherSiteIdList", tetherSiteIdList);
347 setSiteIdList(moleculePropertiesDict);
369 readMdInitialiseDict(mdInitialiseDict, idListDict);
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const word & constant() const
Return constant name.
errorManip< error > abort(error &err)
const word & system() const
Return system name.
const List< word > & idList() const
const Time & time() const
Return time.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void buildPotentials(const List< word > &siteIdList, const dictionary &tetherPotentialDict, const List< word > &tetherSiteIdList)
potential(const polyMesh &mesh)
Construct from mesh reference.
void setSize(const label)
Reset size of List.
void buildPotentials(const List< word > &idList, const dictionary &pairPotentialDict, const polyMesh &mesh)
Mesh consisting of general polyhedral cells.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const List< word > & siteIdList() const