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

« back to all changes in this revision

Viewing changes to src/bin/ccsort/idx_permute_multipass.c

  • 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
 
#include <stdio.h>
2
 
#include <stdlib.h>
3
 
#include <libiwl/iwl.h>
4
 
#include <libdpd/dpd.h>
5
 
 
6
 
void idx_error(char *message, int p, int q, int r, int s, int pq, int rs,
7
 
               int pq_sym, int rs_sym, FILE *outfile);
8
 
void idx_permute_multipass(dpdfile4 *File, int this_bucket, int **bucket_map, 
9
 
                           int **bucket_offset, int p, int q, int r, int s, 
10
 
                           int perm_pr, int perm_qs, int perm_prqs,
11
 
                           double value, FILE *outfile)
12
 
{
13
 
  int p_sym, q_sym, r_sym, s_sym;
14
 
  int pq_sym, rs_sym, rq_sym, ps_sym, qp_sym, sp_sym, sr_sym, qr_sym;
15
 
  int pq, rs, rq, ps, qp, sr, qr, sp;
16
 
  int perm_pq, perm_rs;
17
 
  dpdparams4 *Params;
18
 
  int offset;
19
 
 
20
 
  Params = File->params;
21
 
  perm_pq = Params->perm_pq;
22
 
  perm_rs = Params->perm_rs;
23
 
  
24
 
  /* Get the orbital symmetries */
25
 
  p_sym = Params->psym[p]; q_sym = Params->qsym[q];
26
 
  r_sym = Params->rsym[r]; s_sym = Params->ssym[s];
27
 
 
28
 
  /* Go through the allowed permutations --- NB these are Dirac permutations */
29
 
 
30
 
  if(bucket_map[p][q] == this_bucket) {
31
 
 
32
 
    /* Get the left and right symmetry blocks */
33
 
    pq_sym = p_sym^q_sym;
34
 
    rs_sym = r_sym^s_sym;
35
 
 
36
 
    /* Get the row and column indices and assign the value */
37
 
    pq = Params->rowidx[p][q];
38
 
    rs = Params->colidx[r][s];
39
 
    if((pq >= Params->rowtot[pq_sym]) || (rs >= Params->coltot[rs_sym]))
40
 
      idx_error("MP Params_make: pq, rs", p,q,r,s,pq,rs,pq_sym,rs_sym,outfile);
41
 
 
42
 
    offset = bucket_offset[this_bucket][pq_sym];
43
 
    File->matrix[pq_sym][pq-offset][rs] = value;
44
 
  }
45
 
 
46
 
  if(perm_pr) {
47
 
    if(bucket_map[r][q] == this_bucket) {
48
 
      rq_sym = r_sym^q_sym;
49
 
      ps_sym = p_sym^s_sym;
50
 
      rq = Params->rowidx[r][q];
51
 
      ps = Params->colidx[p][s];
52
 
      if((rq >= Params->rowtot[rq_sym]) || (ps >= Params->coltot[ps_sym]))
53
 
        idx_error("MP Params_make: rq, ps", p,q,r,s,rq,ps,rq_sym,ps_sym,outfile);
54
 
 
55
 
      offset = bucket_offset[this_bucket][rq_sym];
56
 
      File->matrix[rq_sym][rq-offset][ps] = value;
57
 
    }
58
 
  }
59
 
 
60
 
  if(perm_qs) {
61
 
    if(bucket_map[p][s] == this_bucket) {
62
 
      ps_sym = p_sym^s_sym;
63
 
      rq_sym = r_sym^q_sym;
64
 
      ps = Params->rowidx[p][s];
65
 
      rq = Params->colidx[r][q];
66
 
      if((ps >= Params->rowtot[ps_sym]) || (rq >= Params->coltot[rq_sym]))
67
 
        idx_error("MP Params_make: ps, rq", p,q,r,s,ps,rq,ps_sym,rq_sym,outfile);
68
 
 
69
 
      offset = bucket_offset[this_bucket][ps_sym];
70
 
      File->matrix[ps_sym][ps-offset][rq] = value;
71
 
    }
72
 
  }
73
 
 
74
 
  if(perm_pr && perm_qs) {
75
 
    if(bucket_map[r][s] == this_bucket) {
76
 
      rs_sym = r_sym^s_sym;
77
 
      pq_sym = p_sym^q_sym;
78
 
      rs = Params->rowidx[r][s];
79
 
      pq = Params->colidx[p][q];
80
 
      if((rs >= Params->rowtot[rs_sym]) || (pq >= Params->coltot[pq_sym]))
81
 
        idx_error("MP Params_make: rs, pq", p,q,r,s,rs,pq,rs_sym,pq_sym,outfile);
82
 
 
83
 
      offset = bucket_offset[this_bucket][rs_sym];
84
 
      File->matrix[rs_sym][rs-offset][pq] = value;
85
 
    }
86
 
  }
87
 
 
88
 
  if(perm_prqs) {
89
 
    if(bucket_map[q][p] == this_bucket) {
90
 
      qp_sym = q_sym^p_sym;
91
 
      sr_sym = s_sym^r_sym;
92
 
      qp = Params->rowidx[q][p];
93
 
      sr = Params->colidx[s][r];
94
 
      if((qp >= Params->rowtot[qp_sym]) || (sr >= Params->coltot[sr_sym]))
95
 
        idx_error("MP Params_make: qp, sr", p,q,r,s,qp,sr,qp_sym,sr_sym,outfile);
96
 
 
97
 
      offset = bucket_offset[this_bucket][qp_sym];
98
 
      File->matrix[qp_sym][qp-offset][sr] = value;
99
 
    }
100
 
 
101
 
    if(perm_pr) {
102
 
      if(bucket_map[q][r] == this_bucket) {
103
 
        qr_sym = q_sym^r_sym;
104
 
        sp_sym = s_sym^p_sym;
105
 
        qr = Params->rowidx[q][r];
106
 
        sp = Params->colidx[s][p];
107
 
        if((qr >= Params->rowtot[qr_sym])||(sp >= Params->coltot[sp_sym]))
108
 
          idx_error("MP Params_make: qr, sp", p,q,r,s,qr,sp,qr_sym,sp_sym,
109
 
                    outfile);
110
 
 
111
 
        offset = bucket_offset[this_bucket][qr_sym];
112
 
        File->matrix[qr_sym][qr-offset][sp] = value;
113
 
      }
114
 
    }
115
 
 
116
 
    if(perm_qs) {
117
 
      if(bucket_map[s][p] == this_bucket) {
118
 
        sp_sym = s_sym^p_sym;
119
 
        qr_sym = q_sym^r_sym;
120
 
        sp = Params->rowidx[s][p];
121
 
        qr = Params->colidx[q][r];
122
 
        if((sp >= Params->rowtot[sp_sym])||(qr >= Params->coltot[qr_sym]))
123
 
          idx_error("MP Params_make: sp, qr", p,q,r,s,sp,qr,sp_sym,qr_sym,
124
 
                    outfile);
125
 
 
126
 
        offset = bucket_offset[this_bucket][sp_sym];
127
 
        File->matrix[sp_sym][sp-offset][qr] = value;
128
 
      }
129
 
    }
130
 
      
131
 
    if(perm_pr && perm_qs) {
132
 
      if(bucket_map[s][r] == this_bucket) {
133
 
        sr_sym = s_sym^r_sym;
134
 
        qp_sym = q_sym^p_sym;
135
 
        sr = Params->rowidx[s][r];
136
 
        qp = Params->colidx[q][p];
137
 
        if((sr >= Params->rowtot[sr_sym])||(qp >= Params->coltot[qp_sym]))
138
 
          idx_error("MP Params_make: sr, qp", p,q,r,s,sr,qp,sr_sym,qp_sym,
139
 
                    outfile);
140
 
 
141
 
        offset = bucket_offset[this_bucket][sr_sym];
142
 
        File->matrix[sr_sym][sr-offset][qp] = value;
143
 
      }
144
 
    }
145
 
  }
146
 
}