bool UVSpectra::checkForData(Molecule * mol) { OpenBabel::OBMol obmol = mol->OBMol(); OpenBabel::OBElectronicTransitionData *etd = static_cast<OpenBabel::OBElectronicTransitionData*>(obmol.GetData("ElectronicTransitionData")); if (!etd) return false; if (etd->GetEDipole().size() == 0) return false; // OK, we have valid data, so store them for later std::vector<double> wavelengths = etd->GetWavelengths(); std::vector<double> edipole= etd->GetEDipole(); // Store in member vars m_xList.clear(); m_yList.clear(); for (uint i = 0; i < wavelengths.size(); i++){ m_xList.append(wavelengths.at(i)); m_yList.append(edipole.at(i)); } return true; }
bool CDSpectra::checkForData(Molecule * mol) { OpenBabel::OBMol obmol = mol->OBMol(); OpenBabel::OBElectronicTransitionData *etd = static_cast<OpenBabel::OBElectronicTransitionData*>(obmol.GetData("ElectronicTransitionData")); if (!etd) return false; if ( etd->GetRotatoryStrengthsVelocity().size() == 0 && etd->GetRotatoryStrengthsLength().size() == 0 ) return false; // OK, we have valid data, so store them for later std::vector<double> wavelengths = etd->GetWavelengths(); std::vector<double> rotl = etd->GetRotatoryStrengthsLength(); std::vector<double> rotv = etd->GetRotatoryStrengthsVelocity(); ui.combo_rotatoryType->clear(); if (rotl.size() != 0) ui.combo_rotatoryType->addItem("Length"); if (rotv.size() != 0) ui.combo_rotatoryType->addItem("Velocity"); // Store in member vars m_xList.clear(); m_yList.clear(); for (uint i = 0; i < wavelengths.size(); i++) m_xList.append(wavelengths.at(i)); for (uint i = 0; i < rotl.size(); i++) m_yListLength->append(rotl.at(i)); for (uint i = 0; i < rotv.size(); i++) m_yListVelocity->append(rotv.at(i)); rotatoryTypeChanged(ui.combo_rotatoryType->currentText()); return true; }