Skip to content

Commit

Permalink
Fix ticket #1912 - inconsistent number of canonical/localized orbitals
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjunkie committed May 14, 2019
1 parent 9b8641d commit 3520df6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
9 changes: 5 additions & 4 deletions src/Data/LocalizedOrbitals.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ namespace Data {

QString label(unsigned index, bool alpha = true) const
{
QString s(QString::number(index+1));
unsigned n(alpha ? m_nAlpha : m_nBeta);
if (index < n) s += " (occ)";
return s;
unsigned n(alpha ? m_nAlpha : m_nBeta);
QString s(alpha ? "Alpha " : "Beta ");
s += QString::number(index+1);
if (index < n) s += " (occ)";
return s;
}

unsigned labelIndex(bool const alpha) const
Expand Down
7 changes: 4 additions & 3 deletions src/Layer/CanonicalOrbitalsLayer.C
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ QString CanonicalOrbitals::description(Data::SurfaceInfo const& info,

if (type.isOrbital()) {
unsigned index(type.index());
label = m_canonicalOrbitals.label(index);
bool isAlpha(type.kind() == Data::SurfaceType::AlphaOrbital);

label = m_canonicalOrbitals.label(index, isAlpha);

if (tooltip) {
double orbitalEnergy(0.0);
Data::SurfaceType::Kind kind(type.kind());
if (kind == Data::SurfaceType::AlphaOrbital) {
if (isAlpha) {
orbitalEnergy = m_canonicalOrbitals.alphaOrbitalEnergy(index);
}else {
orbitalEnergy = m_canonicalOrbitals.betaOrbitalEnergy(index);
Expand Down
10 changes: 3 additions & 7 deletions src/Layer/OrbitalsLayer.C
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,13 @@ QList<Data::GridData const*> Orbitals::findGrids(Data::SurfaceType::Kind const&
QString Orbitals::description(Data::SurfaceInfo const& info, bool const tooltip)
{
Data::SurfaceType const& type(info.type());
QString label(type.toString());
QString label;

if (type.isOrbital()) {
Data::SurfaceType::Kind kind(type.kind());

unsigned nElectrons = kind == Data::SurfaceType::AlphaOrbital ? nAlpha() : nBeta();
unsigned index(type.index());
bool isAlpha(type.kind() == Data::SurfaceType::AlphaOrbital);

if (index <= nElectrons) {
label += " (occ)";
}
label = m_orbitals.label(index, isAlpha);
}

if (tooltip) label += "\nIsovalue = " + QString::number(info.isovalue(), 'f', 3);
Expand Down

0 comments on commit 3520df6

Please sign in to comment.