Skip to content

Commit

Permalink
Allow for reading imaginary vibrational frequencies in ORCA outputs.
Browse files Browse the repository at this point in the history
They are marked by ***imaginary mode*** after the frequency.
Also, abort reading normal modes, the IR or the Raman spectrum if an
invalid index was found.
  • Loading branch information
dtelsing committed Oct 23, 2023
1 parent fd88346 commit f7a0062
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions avogadro/quantumio/orca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
break;
list = Core::split(key, ' ');
while (!key.empty()) {
if (list.size() != 3) {
// imaginary frequencies can have an additional comment:
// ***imaginary mode***
if (list.size() != 3 &&
(list.size() != 5 || list[3] != "***imaginary" ||
list[4] != "mode***")) {
break;
}
// e.g. 0: 0.00 cm**-1
Expand Down Expand Up @@ -332,13 +336,23 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
break;
list = Core::split(key, ' ');
vector<int> modeIndex;
bool invalid_index = false;
while (!key.empty()) {
// first we get a set of column numbers
// e.g. 1 2 3 4 5 6 7 8 9 10
modeIndex.clear();
for (unsigned int i = 0; i < list.size(); i++) {
modeIndex.push_back(Core::lexicalCast<int>(list[i]));
int index = Core::lexicalCast<int>(list[i]);
if (static_cast<std::size_t>(index) >= m_frequencies.size()) {
invalid_index = true;
break;
}
modeIndex.push_back(index);
}
// Invalid column index
if (invalid_index)
break;

// now we read the displacements .. there should be 3N lines
// x,y,z for each atom
getline(in, key);
Expand Down Expand Up @@ -374,6 +388,10 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
// the first entry might be 5 or 6 because of removed rotations /
// translations
int index = Core::lexicalCast<int>(list[0]);
// invalid index
if (static_cast<std::size_t>(index) >= m_frequencies.size())
break;

double intensity = Core::lexicalCast<double>(list[3]);
m_IRintensities[index] = intensity;

Expand All @@ -397,6 +415,9 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
// the first entry might be 5 or 6 because of removed rotations /
// translations
int index = Core::lexicalCast<int>(list[0]);
// invalid index
if (static_cast<std::size_t>(index) >= m_frequencies.size())
break;
if (m_RamanIntensities.size() == 0 && index > 0) {
while (m_RamanIntensities.size() < index) {
m_RamanIntensities.push_back(0.0);
Expand Down

0 comments on commit f7a0062

Please sign in to comment.