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

« back to all changes in this revision

Viewing changes to src/lib/libdpd/file4_mat_irrep_wrt_block.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 <libciomr/libciomr.h>
3
 
#include "dpd.h"
4
 
 
5
 
int dpd_file4_mat_irrep_wrt_block(dpdfile4 *File, int irrep, int start_pq,
6
 
                                 int num_pq)
7
 
{
8
 
  int rowtot, coltot, my_irrep;
9
 
  int seek_block;
10
 
  psio_address irrep_ptr, next_address;
11
 
  long int size;
12
 
 
13
 
  if(File->incore) {
14
 
      dpd_file4_cache_dirty(File);  /* Flag this cache entry for writing */
15
 
      return 0;  /* We're keeping this data in core */
16
 
    }
17
 
 
18
 
  my_irrep = File->my_irrep;
19
 
  irrep_ptr = File->lfiles[irrep];
20
 
  rowtot = num_pq;
21
 
  coltot = File->params->coltot[irrep^my_irrep];
22
 
  size = ((long) rowtot) * ((long) coltot);
23
 
 
24
 
  /* Advance file pointer to current row */
25
 
  if(coltot) {
26
 
    seek_block = DPD_BIGNUM/(coltot * sizeof(double)); /* no. of rows for which we can compute the address */
27
 
    if(seek_block < 1) {
28
 
      fprintf(stderr, "\nLIBDPD Error: each row of %s is too long to compute an address.\n",File->label);
29
 
      dpd_error("dpd_file4_mat_irrep_rd_block", stderr);
30
 
    }
31
 
    for(; start_pq > seek_block; start_pq -= seek_block)
32
 
      irrep_ptr = psio_get_address(irrep_ptr, seek_block*coltot*sizeof(double));
33
 
    irrep_ptr = psio_get_address(irrep_ptr, start_pq*coltot*sizeof(double));
34
 
 
35
 
  }
36
 
 
37
 
  if(rowtot && coltot)
38
 
     psio_write(File->filenum, File->label, (char *) File->matrix[irrep][0],
39
 
                size*((long) sizeof(double)), irrep_ptr, &next_address);
40
 
 
41
 
  return 0;
42
 
 
43
 
}