Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for reading imaginary vibrational frequencies in ORCA outputs. #1398

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 28 additions & 7 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 @@ -331,14 +335,24 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
if (key.empty())
break;
list = Core::split(key, ' ');
vector<int> modeIndex;
vector<std::size_t> 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]));
for (const auto& index_str : list) {
auto index = Core::lexicalCast<std::size_t>(index_str);
if (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 @@ -373,7 +387,11 @@ 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]);
auto index = Core::lexicalCast<std::size_t>(list[0]);
// invalid index
dtelsing marked this conversation as resolved.
Show resolved Hide resolved
if (index >= m_frequencies.size())
break;

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

Expand All @@ -396,8 +414,11 @@ 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]);
if (m_RamanIntensities.size() == 0 && index > 0) {
auto index = Core::lexicalCast<std::size_t>(list[0]);
// invalid index
dtelsing marked this conversation as resolved.
Show resolved Hide resolved
if (index >= m_frequencies.size())
break;
if (m_RamanIntensities.empty()) {
while (m_RamanIntensities.size() < index) {
m_RamanIntensities.push_back(0.0);
}
Expand Down