Skip to content

Commit

Permalink
Add support for MBIS variant of Hirshfeld charges in Orca
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Nov 26, 2024
1 parent 7b8da75 commit 6b051ff
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions avogadro/quantumio/orca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,28 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
getline(in, key); //------------
} else if (Core::contains(key, "HIRSHFELD ANALYSIS")) {
m_currentMode = HirshfeldCharges;
m_chargeType = "Hirshfeld";
for (unsigned int i = 0; i < 6; ++i) {
getline(in, key); // skip header
}
} else if (Core::contains(key, "MBIS ANALYSIS")) {
// MBIS analysis is similar to Hirshfeld, but with different headers
m_currentMode = HirshfeldCharges;
m_chargeType = "MBIS";
for (unsigned int i = 0; i < 9; ++i) {
getline(in, key); // skip header
}
} else if (Core::contains(key, "ATOMIC CHARGES")) {
m_currentMode = Charges;
// figure out what type of charges we have
list = Core::split(key, ' ');
if (list.size() > 2) {
m_chargeType = Core::trimmed(list[0]); // e.g. MULLIKEN or LOEWDIN
}
// lowercase everything except the first letter
for (unsigned int i = 1; i < m_chargeType.size(); ++i) {
m_chargeType[i] = tolower(m_chargeType[i]);
}
getline(in, key); // skip ------------
} else if (Core::contains(key, "VIBRATIONAL FREQUENCIES")) {
m_currentMode = Frequencies;
Expand Down Expand Up @@ -370,7 +382,7 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)

list = Core::split(key, ' ');
while (!key.empty()) {
if (list.size() != 4) {
if (list.size() < 4) {
break;
}
// e.g. index atom charge spin
Expand All @@ -384,7 +396,7 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
list = Core::split(key, ' ');
}

m_partialCharges["Hirshfeld"] = charges;
m_partialCharges[m_chargeType] = charges;
m_currentMode = NotParsing;
break;
}
Expand Down

0 comments on commit 6b051ff

Please sign in to comment.