~ubuntu-branches/ubuntu/oneiric/mpqc/oneiric

« back to all changes in this revision

Viewing changes to src/lib/chemistry/qc/scf/scfgradient.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2005-11-27 11:41:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127114149-zgz9r3gk50w8ww2q
Tags: 2.3.0-1
* New upstream release.
* debian/rules (SONAME): Activate awk snippet for automatic so-name
  detection again, resulting in a bump to `7' and making a `c2a' for
  the C++ allocator change unnecessary; closes: #339232.
* debian/patches/00list (08_gcc-4.0_fixes): Removed, no longer needed.
* debian/rules (test): Remove workarounds, do not abort build if tests
  fail.
* debian/ref: Removed.
* debian/control.in (libsc): Added Conflict against libsc6c2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include <iostream>
29
29
 
 
30
#include <stdexcept>
 
31
 
30
32
#include <util/misc/timer.h>
31
33
#include <util/misc/formio.h>
32
34
 
43
45
//////////////////////////////////////////////////////////////////////////////
44
46
 
45
47
static void
46
 
nuc_repulsion(double * g, const Ref<Molecule>& m)
47
 
{
48
 
  // handy things
49
 
  Molecule& mol = *m.pointer();
50
 
 
51
 
  for (int x=0; x < mol.natom(); x++) {
52
 
    double xyz[3];
53
 
    mol.nuclear_repulsion_1der(x, xyz);
54
 
    for (int x1=0, x3=x*3; x1 < 3; x1++,x3++)
55
 
      g[x3] += xyz[x1];
56
 
  }
57
 
}
58
 
 
59
 
static void
60
48
ob_gradient(const Ref<OneBodyDerivInt>& derint, double * gradient,
61
49
            const RefSymmSCMatrix& density, const Ref<GaussianBasisSet>& gbs_,
62
50
            const Ref<MessageGrp>& grp)
150
138
  init_gradient();
151
139
 
152
140
  int n3=gradient.n();
153
 
  
154
 
  double *g = new double[n3];
155
 
  memset(g,0,sizeof(double)*gradient.n());
 
141
 
 
142
  if (atom_basis().nonnull()) {
 
143
    throw std::runtime_error("SCF::compute_gradient: atom_basis not supported");
 
144
  }
156
145
 
157
146
  // do the nuclear contribution
158
147
  tim_enter("nuc rep");
159
 
  nuc_repulsion(g, molecule());
 
148
  
 
149
  double *g = new double[n3];
 
150
  nuclear_repulsion_energy_gradient(g);
160
151
 
161
152
  if (debug_) {
162
153
    gradient.assign(g);