コード例 #1
0
ファイル: ff.cpp プロジェクト: alinelena/aten
// Dereference forcefield
void Aten::dereferenceForcefield(Forcefield* xff)
{
	// Remove references to the forcefield in the models
	Messenger::enter("Aten::dereferenceForcefield");
	for (Model* m = models_.first(); m != NULL; m = m->next)
	{
		if (m->forcefield() == xff)
		{
			m->removeTyping();
			m->setForcefield(NULL);
			m->invalidateExpression();
		}
		if (m->patterns() != NULL)
		{
			for (Pattern* p = m->patterns(); p != NULL; p = p->next)
			{
				if (p->forcefield() == xff)
				{
					Atom* i = p->firstAtom();
					for (int n=0; n<p->totalAtoms(); n++)
					{
						i->setType(NULL);
						i = i->next;
					}
					p->setForcefield(NULL);
					m->invalidateExpression();
				}
			}
		}
		else
		{
			int count = 0;
			for (Atom* i = m->atoms(); i != NULL; i = i->next) if (xff->containsType(i->type()))
			{
				++count;
				i->setType(NULL);
			}
			if (count != 0) m->invalidateExpression();
		}
	}
	Messenger::exit("Aten::dereferenceForcefield");
}
コード例 #2
0
ファイル: pattern.cpp プロジェクト: alinelena/aten
// 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");
}