~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/bin/cints/Default_Deriv1/deriv1.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*! \file
 
2
    \ingroup CINTS
 
3
    \brief Driver for the computation of first derivatives.
 
4
*/
 
5
#include<cstdio>
 
6
#include<cstring>
 
7
#include<cstdlib>
 
8
 
 
9
#include<pthread.h>
 
10
#include<libipv1/ip_lib.h>
 
11
#include<cmath>
 
12
#include<libciomr/libciomr.h>
 
13
#include<libint/libint.h>
 
14
#include<libchkpt/chkpt.h>
 
15
 
 
16
#include"defines.h"
 
17
#define EXTERN
 
18
#include"global.h"
 
19
#include <stdexcept>
 
20
#include"moinfo.h"
 
21
#include"compute_scf_opdm.h"
 
22
#include"read_gen_opdm.h"
 
23
#include"enuc_deriv1.h"
 
24
#include"oe_deriv1.h"
 
25
#include"oe_deriv1_ints.h"
 
26
#include"te_deriv1_scf.h"
 
27
#include"te_deriv1_corr.h"
 
28
#include"te_deriv1_ints.h"
 
29
#include"symmetrize_deriv1.h"
 
30
#include"rot_inv.h"
 
31
#include"file11.h"
 
32
 
 
33
 
 
34
namespace psi {
 
35
  namespace CINTS {
 
36
pthread_mutex_t deriv1_mutex;
 
37
double **grad_te;
 
38
 
 
39
void deriv1()
 
40
{
 
41
  /* Either contract integrals with the densities ... */
 
42
  if (UserOptions.symm_ints == 0) {
 
43
    /*--- Gradient in the canonical frame ---*/
 
44
    Grad = block_matrix(Molecule.num_atoms,3);
 
45
    
 
46
    if (UserOptions.empirical_dispersion) {
 
47
      double *oldgrad = chkpt_rd_grad();
 
48
      for (int i=0,j=0; i<Molecule.num_atoms; i++) {
 
49
        Grad[i][0] = oldgrad[j++];
 
50
        Grad[i][1] = oldgrad[j++];
 
51
        Grad[i][2] = oldgrad[j++];
 
52
      }
 
53
      free(oldgrad);
 
54
    }
 
55
 
 
56
    if (Molecule.num_atoms != 0) {
 
57
      if ((!strcmp(UserOptions.wfn,"SCF")) || 
 
58
          (!strcmp(UserOptions.wfn,"SCF_MVD"))) {
 
59
        init_moinfo();
 
60
        compute_scf_opdm();
 
61
      }
 
62
      else
 
63
        read_gen_opdm();
 
64
      enuc_deriv1();
 
65
      oe_deriv1();
 
66
      if (!strcmp(UserOptions.wfn,"SCF_MVD")) {
 
67
        oe_deriv1_darwin1();
 
68
        oe_deriv1_mvc();
 
69
      }
 
70
      if ((!strcmp(UserOptions.wfn,"SCF")) || 
 
71
          (!strcmp(UserOptions.wfn,"SCF_MVD")))
 
72
        te_deriv1_scf();
 
73
      else
 
74
        te_deriv1_corr();
 
75
      symmetrize_deriv1();
 
76
      check_rot_inv();
 
77
      if ((!strcmp(UserOptions.wfn,"SCF")) || 
 
78
          (!strcmp(UserOptions.wfn,"SCF_MVD")))
 
79
        cleanup_moinfo();
 
80
    }
 
81
    
 
82
    
 
83
    file11();
 
84
    chkpt_wt_grad(Grad[0]);
 
85
    free_block(Grad);
 
86
  }
 
87
  /* ... or compute integrals alone */
 
88
  else {
 
89
    oe_deriv1_ints();
 
90
    te_deriv1_ints();
 
91
  }
 
92
 
 
93
  return;
 
94
}
 
95
 
 
96
};
 
97
}