本文整理汇总了C++中Species::atoms方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::atoms方法的具体用法?C++ Species::atoms怎么用?C++ Species::atoms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::atoms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeAtomType
// Remove AtomType definition
void DUQ::removeAtomType(AtomType* at)
{
// Nullify all Atoms using this AtomType
for (Species* sp = species_.first(); sp != NULL; sp = sp->next)
{
for (SpeciesAtom* i = sp->atoms(); i != NULL; i = i->next) if (i->atomType() == at) i->setAtomType(NULL);
}
atomTypes_.remove(at);
updateAtomTypes();
}
示例2: updateAtomTypes
// Update AtomTypes definitions
void DUQ::updateAtomTypes()
{
// Loop over Atoms in all Species - check AtomType availability and validity for each
AtomType* at;
for (Species* sp = species_.first(); sp != NULL; sp = sp->next)
{
for (SpeciesAtom* i = sp->atoms(); i != NULL; i = i->next)
{
// Is current AtomType definition valid?
if (i->atomType() != NULL)
{
// Check it exists...
if (!atomTypes_.contains(i->atomType())) i->setAtomType(NULL);
else
{
// Check elements
if (i->element() == i->atomType()->element()) continue;
else i->setAtomType(NULL);
}
}
// Either not valid, or nothing present.
// Does an AtomType definition exist for this element?
at = atomTypeForElement(i->element());
if (!at)
{
// Create a suitable AtomType
at = atomTypes_.add();
at->setElement(i->element());
at->setParameters(PeriodicTable::element(i->element()).parameters());
at->setName(uniqueAtomTypeName(PeriodicTable::element(i->element()).symbol(), at));
}
i->setAtomType(at);
}
}
// Step through AtomType definitions and make sure all have a valid set of Parameters
for (AtomType* at = atomTypes_.first(); at != NULL; at = at->next)
{
if (!at->parameters()) at->setParameters(PeriodicTable::element(at->element()).parameters());
}
}