-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I implemented display of equivalent sets of atoms in Avogadro v2:

In the process, I realized that once you get the sets, there's no way to relate the atoms in the group back to the original molecule, except by element and coordinates.
Right now, I'm doing that, but it would be great to have an atom id (index) that travels through the context. Is there an easy way to do that?
const msym_equivalence_set_t* smes = &m_es[group];
const msym_element_t* a = smes->elements[atomInGroup];
if (a == NULL)
return;
unsigned int length = m_molecule->atomCount();
for (Index i = 0; i < length; ++i) {
qDebug() << "checking atom" << i << " for " << a->n;
m_molecule->setAtomSelected(i, false);
if (m_molecule->atomicNumbers()[i] != a->n)
continue;
Vector3 ipos = m_molecule->atomPositions3d()[i];
if (fabs(a->v[0] - (ipos[0] - m_cm[0])) < 0.05 &&
fabs(a->v[0] - (ipos[0] - m_cm[0])) < 0.05 &&
fabs(a->v[0] - (ipos[0] - m_cm[0])) < 0.05) {
m_molecule->setAtomSelected(i, true);
qDebug() << " got one!";
}
}
In other words, what I'd really like to do is:
const msym_equivalence_set_t* smes = &m_es[group];
const msym_element_t* a = smes->elements[atomInGroup];
const int index = a->id;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels