Ejemplo n.º 1
0
  void FileImportExtension::processLine(QTextStream *in, Molecule *mol)
  {
    // First truncate the line, remove trailing white space and check
    QString line = in->readLine();
    QString key = line;
    key = key.trimmed();

    if (key == "%FLAG BONDS_WITHOUT_HYDROGEN") {
      qDebug() << "Reading in bonds...";
      line = in->readLine(); // Throw away this line
      line = "";

      QStringList list;
      while (line[0] != '%') {
        line = in->readLine();
        list += line.split(' ', QString::SkipEmptyParts);
        if (list.size() == 30) {
          for (int i = 0; i <= 27; i += 3) {
            Bond *bond = mol->addBond();
            bond->setAtoms(list.at(i).toInt()/3, list.at(i+1).toInt()/3);
            //bond->setOrder(list.at(i+2).toInt());
          }
          list.clear();
        }
      }
    }

  }