Skip to content

Commit

Permalink
Click to insert a fragment would leave dummy atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Nov 28, 2024
1 parent 7098118 commit 50cb77a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion avogadro/qtplugins/templatetool/templatetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ TemplateTool::TemplateTool(QObject* parent_)
"Select an element and coordination geometry,"
"then click to insert a fragment.\n\n"
"Select a ligand or functional group and click"
"on a hydrogen atom to attach it.").arg(shortcut));
"on a hydrogen atom to attach it.")
.arg(shortcut));
setIcon();
reset();
}
Expand Down Expand Up @@ -352,6 +353,14 @@ void TemplateTool::emptyLeftClick(QMouseEvent* e)
return;

center = templateMolecule.centerOfGeometry();
// change the dummy atom(s) to hydrogen
for (size_t i = 0; i < templateMolecule.atomCount(); i++) {
if (templateMolecule.atomicNumber(i) == 0) {
templateMolecule.setAtomicNumber(i, 1);
templateMolecule.setFormalCharge(i, 0);
}
}

// done with clipboard ligands
} else { // a ligand file
QString path;
Expand All @@ -372,6 +381,14 @@ void TemplateTool::emptyLeftClick(QMouseEvent* e)
return;

center = templateMolecule.centerOfGeometry();
// change the dummy atom(s) to hydrogen
for (size_t i = 0; i < templateMolecule.atomCount(); i++) {
if (templateMolecule.atomicNumber(i) == 0) {
templateMolecule.setAtomicNumber(i, 1);
templateMolecule.setFormalCharge(i, 0);
}
}

// done with ligand
}
}
Expand Down

0 comments on commit 50cb77a

Please sign in to comment.