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

« back to all changes in this revision

Viewing changes to src/lib/libdpd/file2_init.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 <string.h>
4
 
#include <libpsio/psio.h>
5
 
#include "dpd.h"
6
 
#define EXTERN
7
 
#include "dpd.gbl"
8
 
 
9
 
/* dpd_file2_init(): Initializes a dpd two-index file for reading
10
 
** or writing data.
11
 
**
12
 
** Arguments:
13
 
**   dpdfile2 *File: A pointer to the two-index dpdfile.
14
 
**   int filenum: The PSI unit number for this file.
15
 
**   int irrep: The symmetry of the data (=0 for totally-symmetric)
16
 
**   int pnum: The orbital subspace number for the left index [see
17
 
**             dpd_init()].
18
 
**   int qnum: The orbital subspace number for the right index [see
19
 
**             dpd_init()].
20
 
**   char *label: A string labelling for this buffer.
21
 
**   int print_flag: A boolean for the print routines.
22
 
**   FILE *outfile: The formatted output file stream.
23
 
*/
24
 
 
25
 
int dpd_file2_init(dpdfile2 *File, int filenum, int irrep, int pnum,
26
 
                   int qnum, char *label)
27
 
{
28
 
  int i, q, rs, nirreps;
29
 
  struct dpd_file2_cache_entry *this_entry;
30
 
  int *coltot, *colidx, **colorb, *qpi, *qoff, *qsym;
31
 
 
32
 
  File->dpdnum = dpd_default;
33
 
  File->params = &(dpd_list[dpd_default].params2[pnum][qnum]);
34
 
  strcpy(File->label,label);
35
 
  File->filenum = filenum;
36
 
  File->my_irrep = irrep;
37
 
 
38
 
  nirreps = File->params->nirreps;
39
 
 
40
 
  this_entry = dpd_file2_cache_scan(filenum, irrep, pnum, qnum, label, dpd_default);
41
 
  if(this_entry != NULL) {
42
 
      File->incore = 1;
43
 
      File->matrix = this_entry->matrix;
44
 
    }
45
 
  else {
46
 
      File->incore = 0;
47
 
      File->matrix = (double ***) malloc(File->params->nirreps*sizeof(double **));
48
 
    }
49
 
 
50
 
  /* Construct logical subfile pointers */
51
 
  File->lfiles = (psio_address *) malloc(File->params->nirreps *
52
 
                                         sizeof(psio_address));
53
 
  File->lfiles[0] = PSIO_ZERO;
54
 
  for(i=1; i < File->params->nirreps; i++)
55
 
    File->lfiles[i] = psio_get_address(File->lfiles[i-1],
56
 
                                       (File->params->rowtot[i-1] *
57
 
                                        File->params->coltot[(i-1)^irrep] *
58
 
                                        sizeof(double)));
59
 
 
60
 
  /* Force all two-index files into cache */
61
 
  /*  dpd_file2_cache_add(File); */
62
 
 
63
 
  return 0;
64
 
}