Skip to content

Commit

Permalink
Fix off-by-one error between user orbital numbers and internal idx
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Oct 18, 2023
1 parent ccebc56 commit f6b2ff6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions avogadro/qtplugins/surfaces/surfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ bool Surfaces::handleCommand(const QString& command, const QVariantMap& options)
if (ok)
cubeResolution = res;
}
if (options.contains("isovalue") &&
options["isovalue"].canConvert<float>()) {
if (options.contains("isovalue") && options["isovalue"].canConvert<float>()) {
bool ok;
float iso = options["isovalue"].toFloat(&ok);
if (ok)
Expand Down Expand Up @@ -181,9 +180,11 @@ bool Surfaces::handleCommand(const QString& command, const QVariantMap& options)
if (ok)
index = index + n;
}

} else
index = options.value("index").toInt();
index = index - 1; // start from zero
} else {
// internally, we count orbitals from zero
index = options.value("index").toInt() - 1;
}
}
bool beta = false;
if (options.contains("spin")) {
Expand Down

0 comments on commit f6b2ff6

Please sign in to comment.