当前位置: 首页>>代码示例>>C++>>正文


C++ openbabel::OBMol类代码示例

本文整理汇总了C++中openbabel::OBMol的典型用法代码示例。如果您正苦于以下问题:C++ OBMol类的具体用法?C++ OBMol怎么用?C++ OBMol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OBMol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Validate

//
// Validate a single molecule.
//
bool Validator::Validate(OpenBabel::OBMol& validationMol)
{
    std::vector<unsigned int> validationFP;
    bool returnval = false;

    if (g_debug_output)
    {
        std::cerr << "Atoms: " << validationMol.NumAtoms() << std::endl;
        std::cerr << "Bonds: " << validationMol.NumBonds() << std::endl;
    }

    // Create the fingerprint for the validation molecule
    OpenBabel::OBFingerprint* fpType = OpenBabel::OBFingerprint::FindFingerprint("");

    // Acquire the fingerprint of the validation molecule so we can use it for
    // Tanimoto comparison.
    fpType->GetFingerprint(&validationMol, validationFP);

    if (g_debug_output)
    {
        std::cerr << "Validation: " << std::endl;
        foreach_uints(u_it, validationFP)
        {
            std::cerr << *u_it << "|";
        }
        std::cerr << std::endl;
    }
开发者ID:rapodaca,项目名称:Graph-Based-Molecular-Synthesis,代码行数:30,代码来源:Validator.cpp

示例2: main

int main(int argc,char **argv)
{
   // Create a test molecule
   OpenBabel::OBMol mol;
   OpenBabel::OBAtom* a[5];
   a[0] = mol.NewAtom(); a[0]->SetAtomicNum(6);  a[0]->SetVector(-0.013,  1.086,  0.008);
   a[1] = mol.NewAtom(); a[1]->SetAtomicNum(1);  a[1]->SetVector( 0.002, -0.004,  0.002);
   a[2] = mol.NewAtom(); a[2]->SetAtomicNum(9);  a[2]->SetVector( 1.300,  1.570, -0.002);
   a[3] = mol.NewAtom(); a[3]->SetAtomicNum(35); a[3]->SetVector(-0.964,  1.737, -1.585);
   a[4] = mol.NewAtom(); a[4]->SetAtomicNum(17); a[4]->SetVector(-0.857,  1.667,  1.491);
   OpenBabel::OBBond* b;
   for (int i(1); i < 5; ++i)
   {
      b = mol.NewBond();
      b->SetBegin(a[0]); b->SetEnd(a[i]); b->SetBondOrder(1);
   }
   
   // Run the tests
   test01(&mol);
   test02(&mol);
   test03(&mol);
   test04(&mol);
   test05(&mol);
   test06(&mol);
   test07(&mol);
   test08(&mol);
   test09(&mol);
   
   // End
   return 0;
}
开发者ID:RitaDo,项目名称:pgchem,代码行数:31,代码来源:spectrophoretest.cpp

示例3: ofs

extern "C" int write_output_(char *out_filename, double *A, int *n)
{
  std::ofstream ofs(out_filename);
  OpenBabel::OBConversion ob(NULL, &ofs);
  OpenBabel::OBAtom atom;
  OpenBabel::OBMol mol;
  int i;

  ob.SetOutFormat("CML");

  /* Atom is Iridium */
  atom.SetAtomicNum(77);

  for (i = 0; i < *n; i++)
  {
    atom.SetVector(A[i*3], A[i*3+1], A[i*3+2]);
    mol.AddAtom(atom);
  }

  //for (i=0; i < *n; i++)
  //{
    //for (int j=i; j < *n; j++)
    //{
      //mol.AddBond(i+1, j+1, 0);
    //}
  //}

  ob.Write(&mol);
  ob.CloseOutFile();
}
开发者ID:enikulenkov,项目名称:magistracy-proj,代码行数:30,代码来源:ga_utils_f.cpp

示例4: selectSMARTS

  // Helper function -- handle SMARTS selections
  // Called by performAction()
  void SelectExtension::selectSMARTS(GLWidget *widget)
  {
    bool ok;
    QString pattern = QInputDialog::getText(qobject_cast<QWidget*>(parent()),
        tr("SMARTS Selection"),
        tr("SMARTS pattern to select"),
        QLineEdit::Normal,
        "", &ok);
    if (ok && !pattern.isEmpty()) {
      OBSmartsPattern smarts;
      smarts.Init(pattern.toStdString());
      OpenBabel::OBMol obmol = m_molecule->OBMol();
      smarts.Match(obmol);

      // if we have matches, select them
      if(smarts.NumMatches() != 0) {
        QList<Primitive *> matchedAtoms;

        vector< vector <int> > mapList = smarts.GetUMapList();
        vector< vector <int> >::iterator i; // a set of matching atoms
        vector<int>::iterator j; // atom ids in each match
        for (i = mapList.begin(); i != mapList.end(); ++i) {
          for (j = i->begin(); j != i->end(); ++j) {
            matchedAtoms.append(m_molecule->atom(obmol.GetAtom(*j)->GetIdx()-1));
          }
        }

        widget->clearSelected();
        widget->setSelected(matchedAtoms, true);
        widget->update();
      } // end matches
    }
    return;
  }
开发者ID:ChrisWilliams,项目名称:avogadro,代码行数:36,代码来源:selectextension.cpp

示例5: spectrophoretest

int spectrophoretest(int argc, char* argv[])
{
  int defaultchoice = 1;
  
  int choice = defaultchoice;

  if (argc > 1) {
    if(sscanf(argv[1], "%d", &choice) != 1) {
      printf("Couldn't parse that input as a number\n");
      return -1;
    }
  }

   // Create a test molecule
   OpenBabel::OBMol mol;
   OpenBabel::OBAtom* a[5];
   a[0] = mol.NewAtom(); a[0]->SetAtomicNum(6);  a[0]->SetVector(-0.013,  1.086,  0.008);
   a[1] = mol.NewAtom(); a[1]->SetAtomicNum(1);  a[1]->SetVector( 0.002, -0.004,  0.002);
   a[2] = mol.NewAtom(); a[2]->SetAtomicNum(9);  a[2]->SetVector( 1.300,  1.570, -0.002);
   a[3] = mol.NewAtom(); a[3]->SetAtomicNum(35); a[3]->SetVector(-0.964,  1.737, -1.585);
   a[4] = mol.NewAtom(); a[4]->SetAtomicNum(17); a[4]->SetVector(-0.857,  1.667,  1.491);
   OpenBabel::OBBond* b;
   for (int i(1); i < 5; ++i)
   {
      b = mol.NewBond();
      b->SetBegin(a[0]); b->SetEnd(a[i]); b->SetBondOrder(1);
   }
   
  switch(choice) {
  case 1:
    test01(&mol);
    test02(&mol);
    break;
  case 2:
    test03(&mol);
    test04(&mol);
    break;
  case 3:
    test05(&mol);
    test06(&mol);
    break;
  case 4:
    test07(&mol);
    test08(&mol);
    break;
  case 5:
    test09(&mol);
    break;
  default:
    std::cout << "Test number " << choice << " does not exist!\n";
    return -1;
  }

  return 0;
}
开发者ID:Acpharis,项目名称:openbabel,代码行数:55,代码来源:spectrophoretest.cpp

示例6: main

int main(int argc, char *argv[])
{
  if (argc != 2) {
    // Exit - we expect the name of an input file and output to the standard out
    std::cerr << "Error: expect one argument - path of input file." << std::endl;
    return 1;
  }

  OpenBabel::OBFormat *inFormat = NULL;
  OpenBabel::OBConversion conv(&std::cin, &std::cout);
  OpenBabel::OBMol mol;
  inFormat = conv.FormatFromExt(argv[1]);
  conv.SetInFormat(inFormat);
  std::ifstream in;
  in.open(argv[1]);
  conv.Read(&mol, &in);
  in.close();

  // Write out a few parameters.
  std::cout << "[Formula]\n" << mol.GetSpacedFormula() << std::endl;
  std::cout << "[Molecular weight]\n" << mol.GetMolWt() << std::endl;

  // Write out our file formats.
  std::cout << "[smiles]\n";
  conv.SetOutFormat("smi");
  conv.Write(&mol);
  std::cout << "[canonical smiles]\n";
  conv.SetOutFormat("can");
  conv.Write(&mol);
  std::cout << "[inchi]\n";
  conv.SetOutFormat("inchi");
  conv.Write(&mol);
  std::cout << "[inchikey]\n";
  conv.SetOptions("K", conv.OUTOPTIONS);
  conv.Write(&mol);
  std::cout << "[XYZ]\n";
  conv.SetOutFormat("xyz");
  conv.Write(&mol);
  std::cout << "[end]\n";
  std::cout << "[CML]\n";
  conv.SetOutFormat("cml");
  conv.Write(&mol);
  std::cout << "[end]\n";
  //std::cout << "[SVG]\n";
  //conv.SetOutFormat("svg");
  //conv.Write(&mol);
  //std::cout << "[end]\n";

  // Let them know we are finished, should be done after all output is complete.
  std::cout << "[complete]" << std::endl;

  return 0;
}
开发者ID:OpenChemistry,项目名称:mongochem,代码行数:53,代码来源:descriptors.cpp

示例7: detectConformers

void ReadFileThread::detectConformers(unsigned int c,
                                      const OpenBabel::OBMol &first,
                                      const OpenBabel::OBMol &current)
{
  if (!c) {
    // this is the first molecule read
    m_moleculeFile->setConformerFile(true);
    addConformer(current);
    return;
  }

  if (!m_moleculeFile->isConformerFile())
    return;

  // as long as we are not sure if this really is a
  // conformer/trajectory file, add the conformers
  addConformer(current);

  // performance: check only certain molecule 1-10,20,50
  switch (c) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  case 7:
  case 8:
  case 9:
  case 10:
  case 20:
  case 50:
    break;
  default:
    return;
  }

  if (first.NumAtoms() != current.NumAtoms()) {
    m_moleculeFile->setConformerFile(false);
    m_moleculeFile->m_conformers.clear();
    return;
  }

  for (unsigned int i = 0; i < first.NumAtoms(); ++i) {
    OpenBabel::OBAtom *firstAtom = first.GetAtom(i+1);
    OpenBabel::OBAtom *currentAtom = current.GetAtom(i+1);
    if (firstAtom->GetAtomicNum() != currentAtom->GetAtomicNum()) {
      m_moleculeFile->setConformerFile(false);
      m_moleculeFile->m_conformers.clear();
      return;
    }
  }
}
开发者ID:AlbertDeFusco,项目名称:avogadro,代码行数:53,代码来源:readfilethread_p.cpp

示例8: paint

  void StereoCenterItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
  {
    Molecule *mol = molecule();
    
    painter->save();
    painter->setPen(Qt::green);

    if (!mol) {
      // not connected: default behaviour (draw connectable box)
      MolInputItem::paint(painter, option, widget);
      painter->restore();
      return;
    }

    const QList<Atom*> &atoms = mol->atoms();
    OpenBabel::OBMol *obmol = mol->OBMol();
    QPointF offset(-5.0, 5.0);

#ifdef OPENBABEL2_TRUNK
    // need to calculate symmetry first
    std::vector<unsigned int> symmetry_classes;
    OpenBabel::OBGraphSym graphsym(obmol);
    graphsym.GetSymmetry(symmetry_classes);

    //std::vector<unsigned long> atomIds = FindTetrahedralAtoms(obmol, symmetry_classes);
    std::vector<OpenBabel::StereogenicUnit> units = FindStereogenicUnits(obmol, symmetry_classes);
    
    for (unsigned int i = 0; i < units.size(); ++i) {
      if (units.at(i).type == OpenBabel::OBStereo::Tetrahedral) {
        OpenBabel::OBAtom *obatom = obmol->GetAtomById(units.at(i).id);
        painter->drawEllipse(mapFromItem(mol, atoms[obatom->GetIndex()]->pos()), 10, 10);
      } else 
      if (units.at(i).type == OpenBabel::OBStereo::CisTrans) {
        OpenBabel::OBBond *obbond = obmol->GetBondById(units.at(i).id);
        OpenBabel::OBAtom *obatom1 = obbond->GetBeginAtom();
        OpenBabel::OBAtom *obatom2 = obbond->GetEndAtom();
        painter->drawEllipse(mapFromItem(mol, atoms[obatom1->GetIndex()]->pos()), 10, 10);
        painter->drawEllipse(mapFromItem(mol, atoms[obatom2->GetIndex()]->pos()), 10, 10);
      } 
 
    }
#else
    using OpenBabel::OBMolAtomIter;
    FOR_ATOMS_OF_MOL(atom, obmol)
      if (atom->IsChiral())
        painter->drawEllipse(mapFromItem(mol, atoms[atom->GetIdx()-1]->pos()), 10, 10);
#endif

    // default behavious (draw the label())
    MolInputItem::paint(painter, option, widget);
    painter->restore();
  }
开发者ID:timvdm,项目名称:Molsketch,代码行数:52,代码来源:stereocenteritem.cpp

示例9: checkForData

  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;
  }
开发者ID:Algerien1970,项目名称:avogadro,代码行数:32,代码来源:cd.cpp

示例10: newMol

OpenBabel::OBMol
Schuffenhauer::Rule_1(OpenBabel::OBMol& oldMol)
{
   	if (oldMol.GetSSSR().size() <= _ringsToBeRetained)
	{
		return oldMol;
	}
   
   	OpenBabel::OBMol newMol(oldMol);
   	std::vector<OpenBabel::OBAtom*>::iterator avi;
   	OpenBabel::OBBondIterator bi;
   	OpenBabel::OBAtom* atom;
   	OpenBabel::OBAtom* nbrAtom[2];
   	for (atom = newMol.BeginAtom(avi); atom; atom = newMol.NextAtom(avi))
   	{
      	if ((atom->MemberOfRingSize() == 3) &&
          	(atom->IsNitrogen() || atom->IsOxygen()) &&
          	(atom->MemberOfRingCount() == 1) &&
          	(atom->GetHvyValence() == 2))
      	{
         	nbrAtom[0] = atom->BeginNbrAtom(bi);
         	nbrAtom[1] = atom->NextNbrAtom(bi);
			if (nbrAtom[0] && nbrAtom[1])
			{
         		newMol.DeleteAtom(atom);
         		newMol.GetBond(nbrAtom[0], nbrAtom[1])->SetBondOrder(2);
			}
      	}
   	}
   	return newMol;
}
开发者ID:UnixJunkie,项目名称:stripper,代码行数:31,代码来源:schuffenhauer.cpp

示例11: checkForData

bool IRSpectra::checkForData(Molecule * mol) {
    OpenBabel::OBMol obmol = mol->OBMol();
    OpenBabel::OBVibrationData *vibrations = static_cast<OpenBabel::OBVibrationData*>(obmol.GetData(OpenBabel::OBGenericDataType::VibrationData));
    if (!vibrations) return false;

    // Setup signals/slots
    connect(this, SIGNAL(plotDataChanged()),
            m_dialog, SLOT(regenerateCalculatedSpectra()));
    connect(ui.cb_labelPeaks, SIGNAL(toggled(bool)),
            m_dialog, SLOT(regenerateCalculatedSpectra()));
    connect(ui.spin_scale, SIGNAL(valueChanged(double)),
            this, SLOT(setScale(double)));
    connect(ui.spin_FWHM, SIGNAL(valueChanged(double)),
            m_dialog, SLOT(regenerateCalculatedSpectra()));
    connect(ui.combo_yaxis, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(updateYAxis(QString)));

    // OK, we have valid vibrations, so store them for later
    vector<double> wavenumbers = vibrations->GetFrequencies();
    vector<double> intensities = vibrations->GetIntensities();

    // Case where there are no intensities, set all intensities to an arbitrary value, i.e. 1.0
    if (wavenumbers.size() > 0 && intensities.size() == 0) {
        // Warn user
        QMessageBox::information(m_dialog, tr("No intensities"), tr("The vibration data in the molecule you have loaded does not have any intensity data. Intensities have been set to an arbitrary value for visualization."));
        for (uint i = 0; i < wavenumbers.size(); i++) {
            intensities.push_back(1.0);
        }
    }

    // Normalize intensities into transmittances
    double maxIntensity=0;
    for (unsigned int i = 0; i < intensities.size(); i++) {
        if (intensities.at(i) >= maxIntensity) {
            maxIntensity = intensities.at(i);
        }
    }

    vector<double> transmittances;

    for (unsigned int i = 0; i < intensities.size(); i++) {
        double t = intensities.at(i);
        t = t / maxIntensity; 	// Normalize
        t = 0.97 * t;		// Keeps the peaks from extending to the limits of the plot
        t = 1.0 - t; 		// Simulate transmittance
        t *= 100.0;		// Convert to percent
        transmittances.push_back(t);
    }

    // Store in member vars
    m_xList->clear();
    m_yList->clear();
    for (uint i = 0; i < wavenumbers.size(); i++) {
        m_xList->append(wavenumbers.at(i));
        m_yList->append(transmittances.at(i));
    }

    return true;
}
开发者ID:foeroyingur,项目名称:avogadro,代码行数:59,代码来源:spectratype_ir.cpp

示例12: computeGasteigerCharges

void Geometry::computeGasteigerCharges()
{
// This is returning zero charges for some reason
return;
    qDebug() << "Geometry::computeGasteigerCharges() not working correctly";
    OpenBabel::OBAtom* obAtom(0);
    OpenBabel::OBMol obMol;

    obMol.BeginModify();
    obMol.UnsetPartialChargesPerceived();
    for (int i = 0; i < m_atoms.size(); ++i) {
        obAtom = obMol.NewAtom();
        obAtom->SetAtomicNum(m_atoms[i]->atomicNumber());
        obAtom->SetVector(m_coordinates[i].x, m_coordinates[i].y, m_coordinates[i].z);
    }
    obMol.SetTotalCharge(m_charge);
    obMol.SetTotalSpinMultiplicity(m_multiplicity);
    obMol.EndModify();
    
    OpenBabel::OBMolAtomIter iter(&obMol);
    for (int i = 0; i < m_atoms.size(); ++i, ++iter) {
        int index(iter->GetIdx());
        qDebug() << "Setting Gasteiger Charge for" << index << "to" << iter->GetPartialCharge();
        GasteigerCharge& charge(m_atoms[i]->getProperty<GasteigerCharge>());
        charge.setValue(iter->GetPartialCharge());
    }
}
开发者ID:gechen,项目名称:IQmol,代码行数:27,代码来源:Geometry.C

示例13: rings

void
FilterCores::Calculate(OpenBabel::OBMol* mol)
{
   // Any rings?
   OpenBabel::OBAtom* atom;
   std::vector<OpenBabel::OBAtom*>::iterator i;
   bool rings(false);
   for (atom = mol->BeginAtom(i); atom; atom = mol->NextAtom(i))
   {
      if (atom->IsInRing())
      {
         rings = true;
         break;
      }
   }
   
   if (rings)
   {
      // Make workcopy of original mol
      OpenBabel::OBMol m = *mol; m.DeleteHydrogens();
   
      // Iteratively remove all endstanding atoms until none are left
      OpenBabel::OBAtom* atom;
      std::vector<OpenBabel::OBAtom*>::iterator i;
      bool endstanding(true);
      while (endstanding && m.NumAtoms())
      {
         endstanding = false;
         for (atom = m.BeginAtom(i); atom; atom = m.NextAtom(i))
         {
            if (atom->GetValence() < 2)
            {
               if (m.DeleteAtom(atom))
               {
                  endstanding = true;
                  break;
               }
            }
         }
      }

      if (m.NumAtoms()) _result = 1;
      else _result = 0;
   }
   else
   {
      _result = 0;
   }
   
   if ((_minLimit && (_result < _min)) || (_maxLimit && (_result > _max)))
   {
      _passed = false;
   }
   else
   {
      _passed = true;
   }  
}
开发者ID:UnixJunkie,项目名称:sieve,代码行数:58,代码来源:filterCores.cpp

示例14: checkForData

  bool DOSSpectra::checkForData(Molecule * mol)
  {
    OpenBabel::OBMol obmol = mol->OBMol();
    //OpenBabel::OBDOSData *dos = static_cast<OpenBabel::OBDOSData*>(obmol.GetData(OpenBabel::OBGenericDataType::DOSData));
    OpenBabel::OBDOSData *dos = static_cast<OpenBabel::OBDOSData*>(obmol.GetData("DOSData"));
    if (!dos) return false;

    // OK, we have valid DOS, so store them for later
    std::vector<double> energies = dos->GetEnergies();
    std::vector<double> densities= dos->GetDensities();
    if (m_intDOS) delete m_intDOS;
    m_intDOS = new std::vector<double> (dos->GetIntegration());

    if (energies.size() == 0 || energies.size() != densities.size())
      return false;

    // Store in member vars
    m_numAtoms = mol->numAtoms();
    m_fermi = dos->GetFermiEnergy();
    ui.label_fermi->setText(QString::number(m_fermi));
    m_xList.clear();
    m_yList.clear();
    bool generateInt = false;
    if (m_intDOS->size() == 0) generateInt = true;
    for (uint i = 0; i < energies.size(); i++){
      m_xList.append(energies.at(i));
      double d = densities.at(i);
      m_yList.append(d);
      if (generateInt) {
        if (i == 0)
          m_intDOS->push_back(d);
        else
          m_intDOS->push_back(m_intDOS->at(i-1) + d);
      }
    }

    setImportedData(m_xList,
                    QList<double>::fromVector(QVector<double>::fromStdVector(*m_intDOS)));

    return true;
  }
开发者ID:AlbertDeFusco,项目名称:avogadro,代码行数:41,代码来源:dos.cpp

示例15: checkForData

  bool NMRSpectra::checkForData(Molecule * mol)
  {
    OpenBabel::OBMol obmol = mol->OBMol();
    qDeleteAll(*m_NMRdata);
    m_NMRdata->clear();
    // Test for "NMR Isotropic Shift" in first atom
    bool hasNMR = false;
    if (obmol.NumAtoms() > 0)
      if (obmol.GetFirstAtom()->HasData("NMR Isotropic Shift"))
        hasNMR = true;

    if (!hasNMR) return false;
    // Setup signals/slots
    connect(this, SIGNAL(plotDataChanged()),
            m_dialog, SLOT(regenerateCalculatedSpectra()));
    connect(ui.combo_type, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(setAtom(QString)));
    connect(ui.spin_ref, SIGNAL(valueChanged(double)),
            this, SLOT(setReference(double)));
    connect(ui.push_resetAxes, SIGNAL(clicked()),
            this, SLOT(updatePlotAxes()));
    connect(ui.spin_FWHM, SIGNAL(valueChanged(double)),
            m_dialog, SLOT(regenerateCalculatedSpectra()));
    connect(ui.cb_labelPeaks, SIGNAL(toggled(bool)),
            m_dialog, SLOT(regenerateCalculatedSpectra()));

    // Extract data from obmol
    FOR_ATOMS_OF_MOL(atom,obmol) {
      QString symbol = QString(OpenBabel::etab.GetSymbol(atom->GetAtomicNum()));
      double shift   = QString(atom->GetData("NMR Isotropic Shift")->GetValue().c_str()).toFloat();
      QList<double> *list = new QList<double>;
      if (m_NMRdata->contains(symbol)) {
        list	= m_NMRdata->value(symbol);
      }
      else {
        // Dump symbol into NMR Type list
        ui.combo_type->addItem(symbol);
      }
      list->append(shift);
      m_NMRdata->insert(symbol, list);
    }
开发者ID:foeroyingur,项目名称:avogadro,代码行数:41,代码来源:spectratype_nmr.cpp


注:本文中的openbabel::OBMol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。