Skip to content

Commit

Permalink
Merge pull request #1379 from ghutchis/fixup-surface-scripting
Browse files Browse the repository at this point in the history
Fixup surface scripting
  • Loading branch information
ghutchis authored Oct 18, 2023
2 parents 3cb9696 + f6b2ff6 commit c9a5066
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 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["isolvalue"].canConvert<float>()) {
if (options.contains("isovalue") && options["isovalue"].canConvert<float>()) {
bool ok;
float iso = options["isovalue"].toFloat(&ok);
if (ok)
Expand All @@ -165,7 +164,7 @@ bool Surfaces::handleCommand(const QString& command, const QVariantMap& options)
expression = name.remove("homo", Qt::CaseInsensitive);
} else if (name.contains("lumo", Qt::CaseInsensitive)) {
index = homo + 1; // again modified by the expression
expression = name.remove("homo", Qt::CaseInsensitive);
expression = name.remove("lumo", Qt::CaseInsensitive);
}
// modify HOMO / LUMO based on "+ number" or "- number"
if (expression.contains('-')) {
Expand All @@ -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 c9a5066

Please sign in to comment.