~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/bin/cceom/norm.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 CCEOM
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <cmath>
 
7
#include "MOInfo.h"
 
8
#include "Params.h"
 
9
#include "Local.h"
 
10
#define EXTERN
 
11
#include "globals.h"
 
12
 
 
13
namespace psi { namespace cceom {
 
14
 
 
15
double norm_C(dpdfile2 *CME, dpdfile2 *Cme,
 
16
    dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf)
 
17
{
 
18
  double norm = 0.0;
 
19
  norm += dpd_file2_dot_self(CME);
 
20
  norm += dpd_file2_dot_self(Cme);
 
21
  norm += dpd_buf4_dot_self(CMNEF);
 
22
  norm += dpd_buf4_dot_self(Cmnef);
 
23
  norm += dpd_buf4_dot_self(CMnEf);
 
24
  norm = sqrt(norm);
 
25
  return norm;
 
26
}
 
27
 
 
28
double norm_C_full(double C0, dpdfile2 *CME, dpdfile2 *Cme,
 
29
    dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf)
 
30
{
 
31
  double norm = 0.0;
 
32
  norm += C0 * C0;
 
33
  norm += dpd_file2_dot_self(CME);
 
34
  norm += dpd_file2_dot_self(Cme);
 
35
  norm += dpd_buf4_dot_self(CMNEF);
 
36
  norm += dpd_buf4_dot_self(Cmnef);
 
37
  norm += dpd_buf4_dot_self(CMnEf);
 
38
  norm = sqrt(norm);
 
39
  return norm;
 
40
}
 
41
 
 
42
 
 
43
double dot_C(dpdfile2 *CME, dpdfile2 *Cme,
 
44
    dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf)
 
45
{
 
46
  double norm = 0.0;
 
47
  norm += dpd_file2_dot_self(CME);
 
48
  norm += dpd_file2_dot_self(Cme);
 
49
  norm += dpd_buf4_dot_self(CMNEF);
 
50
  norm += dpd_buf4_dot_self(Cmnef);
 
51
  norm += dpd_buf4_dot_self(CMnEf);
 
52
  return norm;
 
53
}
 
54
 
 
55
double dot_C_full(double C0, dpdfile2 *CME, dpdfile2 *Cme,
 
56
    dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf)
 
57
{
 
58
  double norm = 0.0;
 
59
  norm += C0 * C0;
 
60
  norm += dpd_file2_dot_self(CME);
 
61
  norm += dpd_file2_dot_self(Cme);
 
62
  norm += dpd_buf4_dot_self(CMNEF);
 
63
  norm += dpd_buf4_dot_self(Cmnef);
 
64
  norm += dpd_buf4_dot_self(CMnEf);
 
65
  return norm;
 
66
}
 
67
 
 
68
double norm_C_rhf(dpdfile2 *CME, dpdbuf4 *CMnEf, dpdbuf4 *CMnfE) {
 
69
  double norm = 0.0;
 
70
  norm = 2.0 * dpd_file2_dot_self(CME);
 
71
  norm += 2.0 * dpd_buf4_dot_self(CMnEf);
 
72
  norm -= dpd_buf4_dot(CMnEf, CMnfE);
 
73
  norm = sqrt(norm);
 
74
  return norm;
 
75
}
 
76
 
 
77
double norm_C_rhf_full(double C0, dpdfile2 *CME, dpdbuf4 *CMnEf, dpdbuf4 *CMnfE) {
 
78
  double norm = 0.0;
 
79
  norm = C0 * C0;
 
80
  norm += 2.0 * dpd_file2_dot_self(CME);
 
81
  norm += 2.0 * dpd_buf4_dot_self(CMnEf);
 
82
  norm -= dpd_buf4_dot(CMnEf, CMnfE);
 
83
  norm = sqrt(norm);
 
84
  return norm;
 
85
}
 
86
 
 
87
double norm_C1(dpdfile2 *CME, dpdfile2 *Cme)
 
88
{
 
89
  double norm = 0.0;
 
90
  norm += dpd_file2_dot_self(CME);
 
91
  norm += dpd_file2_dot_self(Cme);
 
92
  norm = sqrt(norm);
 
93
  return norm;
 
94
}
 
95
 
 
96
double norm_C1_full(double C0, dpdfile2 *CME, dpdfile2 *Cme)
 
97
{
 
98
  double norm = 0.0;
 
99
  norm += C0 * C0;
 
100
  norm += dpd_file2_dot_self(CME);
 
101
  norm += dpd_file2_dot_self(Cme);
 
102
  norm = sqrt(norm);
 
103
  return norm;
 
104
}
 
105
 
 
106
double norm_C1_rhf(dpdfile2 *CME)
 
107
{
 
108
  double norm = 0.0;
 
109
  norm = 2*dpd_file2_dot_self(CME);
 
110
  norm = sqrt(norm);
 
111
  return norm;
 
112
}
 
113
 
 
114
double norm_C1_rhf_full(double C0, dpdfile2 *CME)
 
115
{
 
116
  double norm = 0.0;
 
117
  norm += C0 * C0;
 
118
  norm += 2*dpd_file2_dot_self(CME);
 
119
  norm = sqrt(norm);
 
120
  return norm;
 
121
}
 
122
 
 
123
 
 
124
void scm_C(dpdfile2 *CME, dpdfile2 *Cme, dpdbuf4 *CMNEF,
 
125
    dpdbuf4 *Cmnef, dpdbuf4 *CMnEf, double a)
 
126
{
 
127
  dpd_file2_scm(CME,a);
 
128
  dpd_file2_scm(Cme,a);
 
129
  dpd_buf4_scm(CMNEF,a);
 
130
  dpd_buf4_scm(Cmnef,a);
 
131
  dpd_buf4_scm(CMnEf,a);
 
132
  return;
 
133
}
 
134
 
 
135
void scm_C_full(double *C0, dpdfile2 *CME, dpdfile2 *Cme, dpdbuf4 *CMNEF,
 
136
    dpdbuf4 *Cmnef, dpdbuf4 *CMnEf, double a)
 
137
{
 
138
  (*C0) *= a;
 
139
  dpd_file2_scm(CME,a);
 
140
  dpd_file2_scm(Cme,a);
 
141
  dpd_buf4_scm(CMNEF,a);
 
142
  dpd_buf4_scm(Cmnef,a);
 
143
  dpd_buf4_scm(CMnEf,a);
 
144
  return;
 
145
}
 
146
 
 
147
void scm_C2(dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf, double a)
 
148
{
 
149
  dpd_buf4_scm(CMNEF,a);
 
150
  dpd_buf4_scm(Cmnef,a);
 
151
  dpd_buf4_scm(CMnEf,a);
 
152
  return;
 
153
}
 
154
 
 
155
void scm_C1(dpdfile2 *CME, dpdfile2 *Cme, double a)
 
156
{
 
157
  dpd_file2_scm(CME,a);
 
158
  dpd_file2_scm(Cme,a);
 
159
  return;
 
160
}
 
161
 
 
162
void scm_C1_full(double *C0, dpdfile2 *CME, dpdfile2 *Cme, double a)
 
163
{
 
164
  (*C0) *= a; 
 
165
  dpd_file2_scm(CME,a);
 
166
  dpd_file2_scm(Cme,a);
 
167
  return;
 
168
}
 
169
 
 
170
 
 
171
}} // namespace psi::cceom