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

« back to all changes in this revision

Viewing changes to src/bin/cceom/norm.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <math.h>
 
3
#define EXTERN
 
4
#include "globals.h"
 
5
 
 
6
double norm_C(dpdfile2 *CME, dpdfile2 *Cme,
 
7
    dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf)
 
8
{
 
9
  double norm = 0.0;
 
10
 
 
11
  norm += dpd_file2_dot_self(CME);
 
12
  norm += dpd_file2_dot_self(Cme);
 
13
  norm += dpd_buf4_dot_self(CMNEF);
 
14
  norm += dpd_buf4_dot_self(Cmnef);
 
15
  norm += dpd_buf4_dot_self(CMnEf);
 
16
 
 
17
  norm = sqrt(norm);
 
18
  return norm;
 
19
}
 
20
 
 
21
double norm_C_rhf(dpdfile2 *CME, dpdbuf4 *CMnEf, dpdbuf4 *CMnfE) {
 
22
  double norm = 0.0;
 
23
  norm = 2.0 * dpd_file2_dot_self(CME);
 
24
  norm += 2.0 * dpd_buf4_dot_self(CMnEf);
 
25
  norm -= dpd_buf4_dot(CMnEf, CMnfE);
 
26
  norm = sqrt(norm);
 
27
  return norm;
 
28
}
 
29
 
 
30
double norm_C1(dpdfile2 *CME, dpdfile2 *Cme)
 
31
{
 
32
  double norm = 0.0;
 
33
 
 
34
  norm += dpd_file2_dot_self(CME);
 
35
  norm += dpd_file2_dot_self(Cme);
 
36
  norm = sqrt(norm);
 
37
 
 
38
  return norm;
 
39
}
 
40
 
 
41
double norm_C1_rhf(dpdfile2 *CME)
 
42
{
 
43
  double norm = 0.0;
 
44
 
 
45
  norm = 2*dpd_file2_dot_self(CME);
 
46
  norm = sqrt(norm);
 
47
 
 
48
  return norm;
 
49
}
 
50
 
 
51
void scm_C(dpdfile2 *CME, dpdfile2 *Cme, dpdbuf4 *CMNEF,
 
52
    dpdbuf4 *Cmnef, dpdbuf4 *CMnEf, double a)
 
53
{
 
54
  dpd_file2_scm(CME,a);
 
55
  dpd_file2_scm(Cme,a);
 
56
  dpd_buf4_scm(CMNEF,a);
 
57
  dpd_buf4_scm(Cmnef,a);
 
58
  dpd_buf4_scm(CMnEf,a);
 
59
  return;
 
60
}
 
61
 
 
62
void scm_C2(dpdbuf4 *CMNEF, dpdbuf4 *Cmnef, dpdbuf4 *CMnEf, double a)
 
63
{
 
64
  dpd_buf4_scm(CMNEF,a);
 
65
  dpd_buf4_scm(Cmnef,a);
 
66
  dpd_buf4_scm(CMnEf,a);
 
67
  return;
 
68
}
 
69
 
 
70
void scm_C1(dpdfile2 *CME, dpdfile2 *Cme, double a)
 
71
{
 
72
  dpd_file2_scm(CME,a);
 
73
  dpd_file2_scm(Cme,a);
 
74
  return;
 
75
}
 
76