コード例 #1
0
Pattern::Pattern(Pattern & p)
{
	this->mid = p.id();
	int size = strlen(p.name);
	strcpy_s(this->name, size, p.name);
	this->mwidth = p.width();
	this->mcenter = p.center();
	this->visible = p.visible;
	this->colliding = p.colliding;
	this->marker = new Marker();
	(*(this->marker)) = (*(p.marker));
}
コード例 #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");
}
コード例 #3
0
ファイル: pattern.cpp プロジェクト: alinelena/aten
// Determine the locality of the supplied atom
AtomAddress Model::locateAtom(Atom* i)
{
	Messenger::enter("Model::locateAtom");
	int patternno, molno, atomno, id;
	Pattern* p;
	AtomAddress result;
	if (!createPatterns())
	{
		Messenger::print("Model::locateAtom : No valid pattern available for model.");
		Messenger::exit("Model::locateAtom");
		return result;
	}
	id = i->id();
	// First, find the pattern the atom is covered by
	patternno = -1;
	p = patterns_.first();
	while (p != NULL)
	{
		if ((id >= p->startAtom()) && (id <= p->endAtom()))
		{
			patternno = p->id();
			break;
		}
		p = p->next;
	}
	if (patternno == -1)
	{
		printf("Fatal error - could not find owner pattern for atom!\n");
		Messenger::exit("Model::locateAtom");
		return result;
	}
	// Next, find its molecule id
	id -= p->startAtom();
	molno = id / p->nAtoms();
	// Finally, get the atom offset
	atomno = id % p->nAtoms();
	// Store values, and return
	result.setPattern(p);
	result.setMolecule(molno);
	result.setOffset(atomno);
	Messenger::exit("Model::locateAtom");
	return result;
}