本文整理汇总了C++中Pattern::nMolecules方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::nMolecules方法的具体用法?C++ Pattern::nMolecules怎么用?C++ Pattern::nMolecules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::nMolecules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPattern
// Add Pattern Node
Pattern* Model::addPattern(QString patternName, int nMols, int nAtomsPerMol)
{
Messenger::enter("Model::addPattern");
// Determine starting atom...
Pattern* lastp = patterns_.last();
int start = (lastp == NULL ? 0 : lastp->startAtom() + lastp->nMolecules() * lastp->nAtoms());
Pattern* newpnode = patterns_.add();
newpnode->setParent(this);
newpnode->setName(patternName);
newpnode->initialise(patterns_.nItems()-1, start, nMols, nAtomsPerMol);
Messenger::print("New pattern '%s' added - startatom %i, %i mols, %i atoms per mol.", qPrintable(patternName) , start+1, nMols, nAtomsPerMol);
if ((start + nMols*nAtomsPerMol) == atoms_.nItems())
{
Messenger::print("Pattern description completed (spans %i atoms).", atoms_.nItems());
energy.resize(patterns_.nItems());
Messenger::print("Done.");
// Patterns depend only on the properties / relation of the atoms, and not the positions..
patternsPoint_ = log(Log::Structure);
}
else if ((start + nMols*nAtomsPerMol) > atoms_.nItems())
{
Messenger::print("New pattern '%s' extends %i atoms past number of atoms in owner model.", qPrintable(patternName), (start + nMols*nAtomsPerMol) - atoms_.nItems());
Messenger::print("Not added.");
patterns_.remove(newpnode);
newpnode = NULL;
}
Messenger::exit("Model::addPattern");
return newpnode;
}
示例2: ownPattern
// Own pattern
void Model::ownPattern(Pattern* source, bool own)
{
Messenger::enter("Model::ownPattern");
// Set the starting atom from the last pattern in the model's list
Pattern* p = patterns_.last();
int start = (p == NULL ? 0 : p->startAtom() + p->nMolecules() * p->nAtoms());
// Add the pattern onto the end of the current list
patterns_.own(source);
energy.resize(patterns_.nItems());
// Set startatom and endatom to be coherent with the models current list
source->setContents(start,-1,-1);
source->setId(patterns_.nItems()-1);
//source->set_id(patterns_.nItems()-1);
if (own) source->setParent(this);
Messenger::exit("Model::ownPattern");
}
示例3: printPatterns
// Print patterns
void Model::printPatterns() const
{
Messenger::enter("Model::printPatterns");
Pattern* p = patterns_.first();
if (p == NULL) Messenger::print("No patterns defined for model '%s'.", qPrintable(name_));
else
{
Messenger::print("Pattern info for model '%s':", qPrintable(name_));
Messenger::print(" ID NMols StartId EndId Name Forcefield");
while (p != NULL)
{
Messenger::print(" %2i %-5i %-6i %-6i %-16s %s", p->id(), p->nMolecules(), p->startAtom()+1, p->endAtom()+1, qPrintable(p->name()), p->forcefield() ? qPrintable(p->forcefield()->name()) : "< Inherited >");
p = p->next;
}
}
Messenger::exit("Model::printPatterns");
}