Skip to content

Instantly share code, notes, and snippets.

@ghutchis
Created February 11, 2020 20:44
Show Gist options
  • Save ghutchis/bf8d61337d70bf7845fa8c40d4f9ceff to your computer and use it in GitHub Desktop.
Save ghutchis/bf8d61337d70bf7845fa8c40d4f9ceff to your computer and use it in GitHub Desktop.
Diff for selected atoms
diff --git a/avogadro/qtgui/interfacescript.cpp b/avogadro/qtgui/interfacescript.cpp
index f0ad088..c0c2141 100644
--- a/avogadro/qtgui/interfacescript.cpp
+++ b/avogadro/qtgui/interfacescript.cpp
@@ -458,6 +458,14 @@ bool InterfaceScript::insertMolecule(QJsonObject& json,
if (m_moleculeExtension == QLatin1String("None"))
return true;
+ // insert the selected atoms
+ QJsonArray selectedList;
+ for (Index i = 0; i < mol.atomCount(); ++i) {
+ if (molecule.atomSelected(i))
+ selectedlist.append(i);
+ }
+ json.insert("selectedatoms", selectedList;
+
Io::FileFormatManager& formats = Io::FileFormatManager::instance();
QScopedPointer<Io::FileFormat> format(
formats.newFormatFromFileExtension(m_moleculeExtension.toStdString()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment