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

« back to all changes in this revision

Viewing changes to src/lib/libdpd/buf4_dot_self.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 DPD
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
#include <cstdio>
 
6
#include "dpd.h"
 
7
 
 
8
extern "C" {
 
9
        
 
10
/* dpd_buf4_dot_self(): Evaluates the sum of the squares of the elements of a
 
11
** given dpdbuf4.
 
12
**
 
13
** Arguments:
 
14
**   dpdbuf4 *BufX: A pointer to the dpdbuf4.
 
15
*/
 
16
 
 
17
double dpd_buf4_dot_self(dpdbuf4 *BufX)
 
18
{
 
19
  int h, nirreps, my_irrep;
 
20
  int row, col;
 
21
  double alpha=0.0;
 
22
 
 
23
  nirreps = BufX->params->nirreps;
 
24
  my_irrep = BufX->file.my_irrep;
 
25
 
 
26
  for(h=0; h < nirreps; h++) {
 
27
 
 
28
      dpd_buf4_mat_irrep_init(BufX, h);
 
29
      dpd_buf4_mat_irrep_rd(BufX, h);
 
30
 
 
31
      for(row=0; row < BufX->params->rowtot[h]; row++)
 
32
          for(col=0; col < BufX->params->coltot[h^my_irrep]; col++)
 
33
              alpha += BufX->matrix[h][row][col] * BufX->matrix[h][row][col];
 
34
 
 
35
      dpd_buf4_mat_irrep_close(BufX, h);
 
36
    }
 
37
 
 
38
  return alpha;
 
39
}
 
40
 
 
41
} /* extern "C" */
 
42