Skip to content

Commit

Permalink
add UniqueID label type
Browse files Browse the repository at this point in the history
If UniqueID label type is chosen, atoms are numbered from zero,
in contrast to index, where atoms are human-numbered from unity.

UniqueID mode is needed e.g. for chemists working with Orca quantum chemistry software. It is common to specify atoms in Orca input file (e.g., for a forming bond in a TS search), and Orca counts from zero.

Signed-off-by: Ivan Mitrichev <[email protected]>
  • Loading branch information
imitrichev authored Dec 23, 2023
1 parent b45dcfd commit a22ede8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion avogadro/qtplugins/label/label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ struct LayerLabel : Core::LayerData
Index = 0x01,
Name = 0x02,
Custom = 0x04,
Ordinal = 0x08
Ordinal = 0x08,
UniqueID = 0x16
};
unsigned short atomOptions;
unsigned short residueOptions;
Expand Down Expand Up @@ -327,6 +328,9 @@ void Label::processAtom(const Core::Molecule& molecule,
std::string(Elements::symbol(atomicNumber) +
std::to_string(atomCount[atomicNumber]));
}
if (interface.atomOptions & LayerLabel::LabelOptions::UniqueID) {
text += (text == "" ? "" : " / ") + std::to_string(atom.index());
}
if (text != "") {
const Vector3f pos(atom.position3d().cast<float>());
Vector3ub color = interface.color;
Expand Down

0 comments on commit a22ede8

Please sign in to comment.