~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/dboc/hfwfn.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include <stdexcept>
 
3
#include <stdlib.h>
 
4
extern "C" {
 
5
  #include <psifiles.h>
 
6
  #include <libchkpt/chkpt.h>
 
7
  #include <libciomr/libciomr.h>
 
8
}
 
9
#include "hfwfn.h"
 
10
 
 
11
using namespace std;
 
12
 
 
13
HFWavefunction::HFWavefunction()
 
14
{
 
15
  int unit_opened = 1;
 
16
  if (!psio_open_check(PSIF_CHKPT)) {
 
17
    chkpt_init(PSIO_OPEN_OLD);
 
18
    unit_opened = 0;
 
19
  }
 
20
 
 
21
  num_mo_ = chkpt_rd_nmo();
 
22
  num_so_ = chkpt_rd_nso();
 
23
  num_ao_ = chkpt_rd_nao();
 
24
  
 
25
  refnum_ = (reftype) chkpt_rd_ref();
 
26
 
 
27
  nirreps_ = chkpt_rd_nirreps();
 
28
  clsdpi_ = chkpt_rd_clsdpi();
 
29
  openpi_ = chkpt_rd_openpi();
 
30
  orbspi_ = chkpt_rd_orbspi();
 
31
 
 
32
  ndocc_ = nsocc_ = 0;
 
33
  for(int i=0; i<nirreps_; i++) {
 
34
    ndocc_ += clsdpi_[i];
 
35
    nsocc_ += openpi_[i];
 
36
  }
 
37
  
 
38
  aotoso_ = chkpt_rd_usotao();
 
39
  rref_ = chkpt_rd_rref();
 
40
  if (refnum_ == ref_uhf || refnum_ == ref_uks) {
 
41
    alpha_evec_ = chkpt_rd_alpha_scf();
 
42
    beta_evec_ = chkpt_rd_beta_scf();
 
43
  }
 
44
  else {
 
45
    alpha_evec_ = chkpt_rd_scf();
 
46
    beta_evec_ = NULL;
 
47
  }
 
48
 
 
49
  if (!unit_opened)
 
50
    chkpt_close();
 
51
}
 
52
 
 
53
HFWavefunction::~HFWavefunction()
 
54
{
 
55
  free(clsdpi_);
 
56
  free(openpi_);
 
57
  free(orbspi_);
 
58
  free_block(aotoso_);
 
59
  free_block(rref_);
 
60
  free_block(alpha_evec_);
 
61
  if (beta_evec_ != NULL) free_block(beta_evec_);
 
62
}
 
63
 
 
64
int
 
65
HFWavefunction::num_mo() { return num_mo_; }
 
66
 
 
67
int
 
68
HFWavefunction::num_so() { return num_so_; }
 
69
 
 
70
int
 
71
HFWavefunction::ndocc() { return ndocc_; }
 
72
 
 
73
int
 
74
HFWavefunction::nsocc() { return nsocc_; }
 
75
 
 
76
int
 
77
HFWavefunction::nalpha() { return ndocc_ + nsocc_; }
 
78
 
 
79
int
 
80
HFWavefunction::nbeta() { return ndocc_; }
 
81
 
 
82
int
 
83
HFWavefunction::num_ao() { return num_ao_; }
 
84
 
 
85
int
 
86
HFWavefunction::nirreps() { return nirreps_; }
 
87
 
 
88
int*
 
89
HFWavefunction::clsdpi() { return clsdpi_; }
 
90
 
 
91
int*
 
92
HFWavefunction::openpi() { return openpi_; }
 
93
 
 
94
int*
 
95
HFWavefunction::orbspi() { return orbspi_; }
 
96
 
 
97
double**
 
98
HFWavefunction::alpha_evec() { return alpha_evec_; }
 
99
 
 
100
double**
 
101
HFWavefunction::beta_evec() {
 
102
  if (refnum_ == ref_uhf || refnum_ == ref_uks)
 
103
    return beta_evec_;
 
104
  else
 
105
    return alpha_evec_;
 
106
}
 
107
 
 
108
double**
 
109
HFWavefunction::aotoso() { return aotoso_; }
 
110
 
 
111
double**
 
112
HFWavefunction::rref() { return rref_; }
 
113
 
 
114
void
 
115
HFWavefunction::set_rref(double** rref)
 
116
{
 
117
  for(int i=0; i<3; i++)
 
118
    for(int j=0; j<3; j++)
 
119
      rref_[i][j] = rref[i][j];
 
120
}