Changeset debc65 for src


Ignore:
Timestamp:
Oct 5, 2012, 10:58:05 AM (13 years ago)
Author:
Frederik Heber <heber@…>
Children:
b88be2
Parents:
cd2e34
Message:

FIX: Major bug in sampling the electronic density as window around basis functions was wrong.

  • z part did check bmax.y() and not bmax.z().
  • added check whether both no electrons and integral_value is zero. This bug came up because integral_value came up as zero, causing arithmetic exception. We rather keep it this way: If integral_value is zero, this is always strange and should be inspected. It is only acceptable when there truely are no electrons present.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/bin/mpqc/mpqc.cc

    rcd2e34 rdebc65  
    16961696       max.z() = min.z() + data.sampled_grid.size/AtomicLengthToAngstroem;
    16971697       const int gridpoints = pow(2,data.sampled_grid.level);
     1698       // due to periodic boundary conditions, we don't need gridpoints-1 here
     1699       // TODO: in case of open boundary conditions, we need data on the right
     1700       // hand side boundary as well
    16981701       delta = (data.sampled_grid.size/AtomicLengthToAngstroem) / (double) gridpoints;
    16991702       std::cout << "Grid starts at " << min
     
    17141717         for (size_t y=0; y< gridpoints; ++y, r.y() += delta) {
    17151718           for (size_t z=0; z< gridpoints; ++z, r.z() += delta) {
    1716              if (((r.x() < bmin.x()-boundary) || (r.x() > bmax.x()+boundary))
    1717                || ((r.y() < bmin.y()-boundary) || (r.y() > bmax.y()+boundary))
    1718                || ((r.z() < bmin.z()-boundary) || (r.z() > bmax.y()+boundary))) {
     1719             if (((r.x() < (bmin.x()-boundary)) || (r.x() > (bmax.x()+boundary)))
     1720               || ((r.y() < (bmin.y()-boundary)) || (r.y() > (bmax.y()+boundary)))
     1721               || ((r.z() < (bmin.z()-boundary)) || (r.z() > (bmax.z()+boundary)))) {
    17191722               data.sampled_grid.sampled_grid.push_back(0.);
    17201723             } else {
     
    17371740             integral_value += *diter;
    17381741         integral_value *= pow(delta*AtomicLengthToAngstroem,3);
    1739          const double normalization = scf->nelectron()/integral_value;
     1742         const double normalization =
     1743             ((integral_value == 0) && (scf->nelectron() == 0)) ?
     1744                 1. : scf->nelectron()/integral_value;
    17401745         std::cout << "Created " << data.sampled_grid.sampled_grid.size() << " grid points "
    17411746             << " with integral value of " << integral_value
Note: See TracChangeset for help on using the changeset viewer.