~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/lib/libdpd/close.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 <cstdlib>
 
7
#include "dpd.h"
 
8
#define EXTERN
 
9
#include "dpd.gbl"
 
10
 
 
11
extern "C" {
 
12
 
 
13
int dpd_close(int dpd_num)
 
14
{
 
15
  int h,i,j,k,cnt;
 
16
  int nirreps,num_subspaces,num_pairs;
 
17
  dpd_data *this_dpd;
 
18
 
 
19
  /*  dpd_file2_cache_print(stdout); */
 
20
  dpd_file2_cache_close();
 
21
  /*  dpd_file4_cache_print(stdout);*/
 
22
  dpd_file4_cache_close();
 
23
 
 
24
  this_dpd = &(dpd_list[dpd_num]);
 
25
 
 
26
  num_subspaces = this_dpd->num_subspaces;
 
27
  nirreps = this_dpd->nirreps;
 
28
  num_pairs = this_dpd->num_pairs;
 
29
 
 
30
  for(i=0; i < num_pairs; i++)
 
31
    for(j=0; j < num_pairs; j++)
 
32
      free_int_matrix(this_dpd->params4[i][j].start13);
 
33
 
 
34
  for(i=0; i < num_subspaces; i++)  free(this_dpd->orboff[i]);
 
35
  free(this_dpd->orboff);
 
36
 
 
37
  for(i=0; i < num_subspaces; i++) {
 
38
    for(j=0; j < 5; j++) {
 
39
      free_int_matrix(this_dpd->pairidx[5*i+j]);
 
40
      for(k=0; k < this_dpd->nirreps; k++) 
 
41
        if(this_dpd->pairtot[5*i+j][k])
 
42
          free_int_matrix(this_dpd->pairorb[5*i+j][k]);
 
43
      free(this_dpd->pairorb[5*i+j]);
 
44
    }
 
45
  }
 
46
  for(i=0,cnt=5*num_subspaces; i < num_subspaces; i++) {
 
47
    for(j=i+1; j < num_subspaces; j++,cnt+=2) {
 
48
      free_int_matrix(this_dpd->pairidx[cnt]);
 
49
      free_int_matrix(this_dpd->pairidx[cnt+1]);
 
50
      for(k=0; k < nirreps; k++) {
 
51
        if(this_dpd->pairtot[cnt][k])
 
52
          free_int_matrix(this_dpd->pairorb[cnt][k]);
 
53
        if(this_dpd->pairtot[cnt+1][k])
 
54
          free_int_matrix(this_dpd->pairorb[cnt+1][k]);
 
55
      }
 
56
      free(this_dpd->pairorb[cnt]);
 
57
      free(this_dpd->pairorb[cnt+1]);
 
58
    }
 
59
  }
 
60
  free(this_dpd->pairidx); free(this_dpd->pairorb);
 
61
 
 
62
  for(i=0; i < num_subspaces; i++) {
 
63
    free(this_dpd->orbidx2[i]);
 
64
    for(j=0; j < nirreps; j++) {
 
65
      if(this_dpd->orbspi[i][j]) free(this_dpd->orbs2[i][j]);
 
66
    }
 
67
    free(this_dpd->orbs2[i]);
 
68
  }
 
69
  free(this_dpd->orbidx2); free(this_dpd->orbs2);
 
70
 
 
71
  for(i=0; i < num_subspaces; i++) {
 
72
    free(this_dpd->orbspi[i]);
 
73
    free(this_dpd->orbsym[i]);
 
74
  }
 
75
  free(this_dpd->orbspi); free(this_dpd->orbsym);
 
76
 
 
77
  free_int_matrix(this_dpd->pairtot);
 
78
 
 
79
  free(this_dpd->numorbs);
 
80
 
 
81
  for(i=0; i < num_pairs; i++)
 
82
    free(this_dpd->params4[i]);
 
83
  free(this_dpd->params4);
 
84
  for(i=0; i < num_subspaces; i++)
 
85
    free(this_dpd->params2[i]);
 
86
  free(this_dpd->params2);
 
87
 
 
88
  /*
 
89
    printf("memory = %d; memfree = %d\n",
 
90
    dpd_main.memory, dpd_main.memfree);
 
91
  */
 
92
 
 
93
  return 0;
 
94
}
 
95
 
 
96
} /* extern "C" */