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

« back to all changes in this revision

Viewing changes to src/bin/transqt2/idx_permute_presort.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 TRANSQT2
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include <cstdlib>
 
7
#include <libiwl/iwl.h>
 
8
#include <libdpd/dpd.h>
 
9
 
 
10
namespace psi {
 
11
  namespace transqt2 {
 
12
 
 
13
void idx_error(const char *message, int p, int q, int r, int s, int pq, int rs,
 
14
               int pq_sym, int rs_sym, FILE *outfile);
 
15
void idx_permute_presort(dpdfile4 *File, int this_bucket, int **bucket_map, 
 
16
                         int **bucket_offset, int p, int q, int r, int s, 
 
17
                         double value, FILE *outfile)
 
18
{
 
19
  int p_sym, q_sym, r_sym, s_sym;
 
20
  int pq_sym, rs_sym, rq_sym, ps_sym, qp_sym, sp_sym, sr_sym, qr_sym;
 
21
  int pq, rs, rq, ps, qp, sr, qr, sp;
 
22
  int perm_pq, perm_rs;
 
23
  dpdparams4 *Params;
 
24
  int offset;
 
25
 
 
26
  Params = File->params;
 
27
  perm_pq = Params->perm_pq;
 
28
  perm_rs = Params->perm_rs;
 
29
  
 
30
  /* Get the orbital symmetries */
 
31
  p_sym = Params->psym[p]; q_sym = Params->qsym[q];
 
32
  r_sym = Params->rsym[r]; s_sym = Params->ssym[s];
 
33
  pq_sym = p_sym^q_sym;
 
34
  rs_sym = r_sym^s_sym;
 
35
 
 
36
  /* The allowed (Mulliken) permutations are very simple in this case */
 
37
 
 
38
  if(bucket_map[p][q] == this_bucket) {
 
39
 
 
40
    /* Get the row and column indices and assign the value */
 
41
    pq = Params->rowidx[p][q];
 
42
    rs = Params->colidx[r][s];
 
43
    if((pq >= Params->rowtot[pq_sym]) || (rs >= Params->coltot[rs_sym]))
 
44
      idx_error("MP Params_make: pq, rs", p,q,r,s,pq,rs,pq_sym,rs_sym,outfile);
 
45
 
 
46
    offset = bucket_offset[this_bucket][pq_sym];
 
47
    File->matrix[pq_sym][pq-offset][rs] = value;
 
48
  }
 
49
 
 
50
  if(bucket_map[r][s] == this_bucket) {
 
51
 
 
52
    rs = Params->rowidx[r][s];
 
53
    pq = Params->colidx[p][q];
 
54
    if((rs >= Params->rowtot[rs_sym])||(pq >= Params->coltot[pq_sym]))
 
55
      idx_error("MP Params_make: rs, pq", p,q,r,s,rs,pq,rs_sym,pq_sym,
 
56
                outfile);
 
57
 
 
58
    offset = bucket_offset[this_bucket][rs_sym];
 
59
    File->matrix[rs_sym][rs-offset][pq] = value;
 
60
  }
 
61
}
 
62
 
 
63
  } // namespace transqt2
 
64
} // namespace psi