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

Fix parsing "Gaussian" vibration output from xtb program #2653

Merged
merged 2 commits into from
Dec 6, 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
27 changes: 23 additions & 4 deletions src/formats/gaussformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace OpenBabel

//Vibrational data
std::vector< std::vector< vector3 > > Lx;
std::vector<double> Frequencies, Intensities;
std::vector<double> Frequencies, Intensities, RamanActivities;
//Rotational data
std::vector<double> RotConsts(3);
int RotSymNum=1;
Expand Down Expand Up @@ -978,9 +978,13 @@ namespace OpenBabel

ifs.getline(buffer, BUFF_SIZE); // column labels or Raman intensity
if(strstr(buffer, "Raman Activ")) {
tokenize(vs, buffer);
for(unsigned int i=3; i<vs.size(); ++i)
RamanActivities.push_back(atof(vs[i].c_str()));
ifs.getline(buffer, BUFF_SIZE); // Depolar (P)
ifs.getline(buffer, BUFF_SIZE); // Depolar (U)
ifs.getline(buffer, BUFF_SIZE); // column labels

while (strstr(buffer, "Atom") == nullptr)
ifs.getline(buffer, BUFF_SIZE); // eventually column labels
}
ifs.getline(buffer, BUFF_SIZE); // actual displacement data
tokenize(vs, buffer);
Expand Down Expand Up @@ -1325,7 +1329,22 @@ namespace OpenBabel
if(Frequencies.size()>0)
{
OBVibrationData* vd = new OBVibrationData;
vd->SetData(Lx, Frequencies, Intensities);
if (RamanActivities.size() != 0) {
// check to see if they're all zero
bool allZero = true;
for (auto &i : RamanActivities) {
if (i != 0.0) {
allZero = false;
break;
}
}
if (!allZero) {
vd->SetData(Lx, Frequencies, Intensities, RamanActivities);
} else { // zero Raman
vd->SetData(Lx, Frequencies, Intensities);
}
} else // no Raman
vd->SetData(Lx, Frequencies, Intensities);
vd->SetOrigin(fileformatInput);
mol.SetData(vd);
}
Expand Down