Beispiel #1
0
  bool BasisSet::calculateCubeDensity(Cube *cube)
  {
    // FIXME Still not working, committed so others could see current state.

    // Must be called before calculations begin
    initCalculation();

    // Set up the points we want to calculate the density at
    m_basisShells = new QVector<BasisShell>(cube->data()->size());

    for (int i = 0; i < m_basisShells->size(); ++i) {
      (*m_basisShells)[i].set = this;
      (*m_basisShells)[i].tCube = cube;
      (*m_basisShells)[i].pos = i;
    }

    // Lock the cube until we are done.
    cube->lock()->lockForWrite();

    // Watch for the future
    connect(&m_watcher, SIGNAL(finished()), this, SLOT(calculationComplete()));

    // The main part of the mapped reduced function...
    m_future = QtConcurrent::map(*m_basisShells, BasisSet::processDensity);
    // Connect our watcher to our future
    m_watcher.setFuture(m_future);

    return true;
  }
Beispiel #2
0
  bool BasisSet::calculateCubeMO(Cube *cube, int state)
  {
    // Set up the calculation and ideally use the new QtConcurrent code to
    // multithread the calculation...
    if (state < 1 || state > m_moMatrix.rows())
      return false;

    // Must be called before calculations begin
    initCalculation();

    // Set up the points we want to calculate the density at
    m_basisShells = new QVector<BasisShell>(cube->data()->size());

    for (int i = 0; i < m_basisShells->size(); ++i) {
      (*m_basisShells)[i].set = this;
      (*m_basisShells)[i].tCube = cube;
      (*m_basisShells)[i].pos = i;
      (*m_basisShells)[i].state = state;
    }

    // Lock the cube until we are done.
    cube->lock()->lockForWrite();

    // Watch for the future
    connect(&m_watcher, SIGNAL(finished()), this, SLOT(calculationComplete()));

    // The main part of the mapped reduced function...
    m_future = QtConcurrent::map(*m_basisShells, BasisSet::processPoint);
    // Connect our watcher to our future
    m_watcher.setFuture(m_future);

    return true;
  }
Beispiel #3
0
void GaussianSet::outputAll()
{
  // Can be called to print out a summary of the basis set as read in
  qDebug() << "\nGaussian Basis Set\nNumber of atoms:" << m_numAtoms;

  initCalculation();

  if (!isValid()) {
    qDebug() << "Basis set is marked as invalid.";
    return;
  }

  for (uint i = 0; i < m_symmetry.size(); ++i) {
    qDebug() << i
             << "\tAtom Index:" << m_atomIndices[i]
             << "\tSymmetry:" << m_symmetry[i]
             << "\tMO Index:" << m_moIndices[i]
             << "\tGTO Index:" << m_gtoIndices[i];
  }
  qDebug() << "Symmetry:" << m_symmetry.size()
           << "\tgtoIndices:" << m_gtoIndices.size()
           << "\tLast gtoIndex:" << m_gtoIndices[m_symmetry.size()]
           << "\ngto size:" << m_gtoA.size() << m_gtoC.size() << m_gtoCN.size();
  for (uint i = 0; i < m_symmetry.size(); ++i) {
    switch(m_symmetry[i]) {
    case S:
      qDebug() << "Shell" << i << "\tS\n  MO 1\t"
               << m_moMatrix(0, m_moIndices[i])
               << m_moMatrix(m_moIndices[i], 0);
      break;
    case P:
      qDebug() << "Shell" << i << "\tP\n  MO 1\t"
               << m_moMatrix(0, m_moIndices[i])
               << "\t" << m_moMatrix(0, m_moIndices[i] + 1)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 2);
      break;
    case D:
      qDebug() << "Shell" << i << "\tD\n  MO 1\t"
               << m_moMatrix(0, m_moIndices[i])
               << "\t" << m_moMatrix(0, m_moIndices[i] + 1)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 2)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 3)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 4)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 5);
      break;
    case D5:
      qDebug() << "Shell" << i << "\tD5\n  MO 1\t"
               << m_moMatrix(0, m_moIndices[i])
               << "\t" << m_moMatrix(0, m_moIndices[i] + 1)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 2)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 3)
               << "\t" << m_moMatrix(0, m_moIndices[i] + 4);
      break;
    case F:
      std::cout << "Shell " << i << "\tF\n  MO 1";
      for (short j = 0; j < 10; ++j)
        std::cout << "\t" << m_moMatrix(0, m_moIndices[i] + j);
      std::cout << std::endl;
      break;
    case F7:
      std::cout << "Shell " << i << "\tF7\n  MO 1";
      for (short j = 0; j < 7; ++j)
        std::cout << "\t" << m_moMatrix(0, m_moIndices[i] + j);
      std::cout << std::endl;
      break;
    default:
      qDebug() << "Error: unhandled type...";
    }
    unsigned int cIndex = m_gtoIndices[i];
    for (uint j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) {
      if (j >= m_gtoA.size()) {
        qDebug() << "Error, j is too large!" << j << m_gtoA.size();
        continue;
      }
      qDebug() << cIndex
               << "\tc:" << m_gtoC[cIndex]
               << "\ta:" << m_gtoA[cIndex];
      ++cIndex;
    }
  }
  qDebug() << "\nEnd of orbital data...\n";
}
Beispiel #4
0
void GaussianSet::outputAll(ElectronType type)
{
  size_t index(0);
  if (type == Beta)
    index = 1;

  // Can be called to print out a summary of the basis set as read in
  unsigned int numAtoms = static_cast<unsigned int>(m_molecule->atomCount());
  cout << "\nGaussian Basis Set\nNumber of atoms:" << numAtoms << endl;
  switch (m_scfType) {
  case Rhf:
    cout << "RHF orbitals" << endl;
    break;
  case Uhf:
    cout << "UHF orbitals" << endl;
    break;
  case Rohf:
    cout << "ROHF orbitals" << endl;
    break;
  default:
    cout << "Unknown orbitals" << endl;
  }

  initCalculation();

  cout << "Number of electrons = " << m_electrons[index] << endl;

  if (!isValid()) {
    cout << "Basis set is marked as invalid." << endl;
    return;
  }

  for (size_t i = 0; i < m_symmetry.size(); ++i) {
    cout << i
         << "\tAtom Index: " << m_atomIndices[i]
         << "\tSymmetry: " << m_symmetry[i]
         << "\tMO Index: " << m_moIndices[i]
         << "\tGTO Index: " << m_gtoIndices[i]
         << endl;
  }
  cout << "Symmetry: " << m_symmetry.size()
       << "\tgtoIndices: " << m_gtoIndices.size()
       << "\tLast gtoIndex: " << m_gtoIndices[m_symmetry.size()]
       << "\ngto size: " << m_gtoA.size() << " "
                         << m_gtoC.size() << " "
                         << m_gtoCN.size()
       << endl;
  for (size_t i = 0; i < m_symmetry.size(); ++i) {
    switch (m_symmetry[i]) {
    case S:
      cout << "Shell " << i << "\tS\n  MO 1\t"
           << m_moMatrix[index](0, m_moIndices[i]) << "\t"
           << m_moMatrix[index](m_moIndices[i], 0)
           << endl;
      break;
    case P:
      cout << "Shell " << i << "\tP\n  MO 1\t"
           << m_moMatrix[index](0, m_moIndices[i])
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 1)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 2)
           << endl;
      break;
    case D:
      cout << "Shell " << i << "\tD\n  MO 1\t"
           << m_moMatrix[index](0, m_moIndices[i])
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 1)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 2)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 3)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 4)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 5)
           << endl;
      break;
    case D5:
      cout << "Shell " << i << "\tD5\n  MO 1\t"
           << m_moMatrix[index](0, m_moIndices[i])
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 1)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 2)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 3)
           << "\t" << m_moMatrix[index](0, m_moIndices[i] + 4)
           << endl;
      break;
    case F:
      cout << "Shell " << i << "\tF\n  MO 1";
      for (short j = 0; j < 10; ++j)
        cout << "\t" << m_moMatrix[index](0, m_moIndices[i] + j);
      cout << endl;
      break;
    case F7:
      cout << "Shell " << i << "\tF7\n  MO 1";
      for (short j = 0; j < 7; ++j)
        cout << "\t" << m_moMatrix[index](0, m_moIndices[i] + j);
      cout << endl;
      break;
    default:
      cout << "Error: unhandled type...\n";
    }
    unsigned int cIndex = m_gtoIndices[i];
    for (size_t j = m_gtoIndices[i]; j < m_gtoIndices[i+1]; ++j) {
      if (j >= m_gtoA.size()) {
        cout << "Error, j is too large!" << j << m_gtoA.size() << endl;
        continue;
      }
      cout << cIndex
           << "\tc: " << m_gtoC[cIndex]
           << "\ta: " << m_gtoA[cIndex] << endl;
      ++cIndex;
    }
  }
  cout << "\nEnd of orbital data...\n";
}