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

« back to all changes in this revision

Viewing changes to src/bin/oeprop/get_opdm_lbl.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define EXTERN
 
2
#include "includes.h"
 
3
#include "globals.h"
 
4
#include "prototypes.h"
 
5
#include <libqt/qt.h>
 
6
#include <psifiles.h>
 
7
#include <ccfiles.h>
 
8
 
 
9
void get_opdm_lbl(void) { 
 
10
  int i, errcod;
 
11
  int root;
 
12
 
 
13
  nrho = 1;
 
14
 
 
15
  if (ip_exist("NUM_ROOTS",0)) {
 
16
    nrho = 1;
 
17
    errcod = ip_data("NUM_ROOTS","%d",&nrho,0);
 
18
    if (errcod != IPE_OK) {
 
19
      fprintf(outfile,"(oeprop): error parsing NUM_ROOTS keyword\n");
 
20
      abort();
 
21
    }
 
22
  }
 
23
  else if (cc_wfn(wfn)) {
 
24
    psio_open(CC_INFO,1);
 
25
    psio_read_entry(CC_INFO, "Num. of CC densities", (char *) &(nrho), 
 
26
      sizeof(int));
 
27
    psio_close(CC_INFO,1);
 
28
  } 
 
29
  else if (ci_wfn(wfn)) {
 
30
    psio_open(opdm_file,1);
 
31
    if (transdens) 
 
32
      psio_read_entry(opdm_file, "Num MO-basis TDM", (char *) &(nrho),
 
33
        sizeof(int));
 
34
    else
 
35
      psio_read_entry(opdm_file, "Num MO-basis OPDM", (char *) &(nrho),
 
36
        sizeof(int));
 
37
    psio_close(opdm_file,1);
 
38
  }
 
39
 
 
40
  if (nrho < 1) {
 
41
    fprintf(outfile,"(oeprop): error - got nrho = %d\n", nrho);
 
42
    abort();
 
43
  }
 
44
 
 
45
  /* if the ROOT keyword is specified, let's just analyze the ROOT given 
 
46
     and not however many there may be on disk */
 
47
  if (ip_exist("ROOT",0)) {
 
48
    root = 1;
 
49
    errcod = ip_data("ROOT","%d",&root,0);
 
50
    if (errcod != IPE_OK) {
 
51
      fprintf(outfile,"(oeprop): error parsing ROOT keyword\n");
 
52
      abort();
 
53
    }
 
54
    root -= 1;
 
55
    nrho = 1;
 
56
    opdm_lbl = (char **) malloc(sizeof(char *) * nrho);
 
57
    opdm_lbl[0] = (char *) malloc(32*sizeof(char));
 
58
 
 
59
    if (transdens)
 
60
      sprintf(opdm_lbl[0],"MO-basis TDM Root %d",root);
 
61
    else
 
62
      sprintf(opdm_lbl[0],"MO-basis OPDM Root %d",root);
 
63
  } /* end ROOT exists */
 
64
 
 
65
  /* if ROOT is not given and only one density specified, 
 
66
     then let's analyze "THE" density */
 
67
  else if (nrho == 1) {
 
68
    if ( !strcmp(ref,"RHF") || !strcmp(ref,"ROHF") ) {
 
69
      opdm_lbl = (char **) malloc(sizeof(char *) * nrho);
 
70
      opdm_lbl[0] = (char *) malloc(32*sizeof(char));
 
71
      sprintf(opdm_lbl[0], "MO-basis %s", transdens ? "TDM" : "OPDM");
 
72
    }
 
73
    else {
 
74
      opdm_a_lbl = (char **) malloc(sizeof(char *) * nrho);
 
75
      opdm_a_lbl[0] = (char *) malloc(32*sizeof(char));
 
76
      opdm_b_lbl = (char **) malloc(sizeof(char *) * nrho);
 
77
      opdm_b_lbl[0] = (char *) malloc(32*sizeof(char));
 
78
      sprintf(opdm_a_lbl[0], "MO-basis Alpha %s", transdens ? "TDM" : "OPDM");
 
79
      sprintf(opdm_b_lbl[0], "MO-basis Beta %s", transdens ? "TDM" : "OPDM");
 
80
    } 
 
81
  } /* end "THE" density */
 
82
 
 
83
  if (transdens) 
 
84
    fprintf(outfile, "\tTransition densities available up to root %d\n", nrho);
 
85
  else
 
86
    fprintf(outfile, "\tDensities available up to root %d\n", nrho);
 
87
 
 
88
  if (nrho == 1) return;
 
89
 
 
90
  if ( !strcmp(ref,"RHF") || !strcmp(ref,"ROHF") ) {
 
91
    opdm_lbl = (char **) malloc(sizeof(char *) * nrho);
 
92
    for (i=0;i<nrho;i++) {
 
93
      opdm_lbl[i] = (char *) malloc(32*sizeof(char));
 
94
      if (i==0 && cc_wfn(wfn)) sprintf(opdm_lbl[i], "MO-basis %s",
 
95
        transdens ? "TDM" : "OPDM");
 
96
      else sprintf(opdm_lbl[i], "MO-basis %s Root %d", 
 
97
        transdens ? "TDM" : "OPDM", i);
 
98
    }
 
99
  }
 
100
  else {
 
101
    opdm_a_lbl = (char **) malloc(sizeof(char *) * nrho);
 
102
    opdm_b_lbl = (char **) malloc(sizeof(char *) * nrho);
 
103
    for (i=0;i<nrho;i++) {
 
104
      opdm_a_lbl[i] = (char *) malloc(32*sizeof(char));
 
105
      opdm_b_lbl[i] = (char *) malloc(32*sizeof(char));
 
106
      if (i==0 && cc_wfn(wfn)) {
 
107
        sprintf(opdm_a_lbl[i], "MO-basis Alpha %s", 
 
108
          transdens ? "TDM" : "OPDM");
 
109
        sprintf(opdm_b_lbl[i], "MO-basis Beta %s",
 
110
          transdens ? "TDM" : "OPDM");
 
111
      }
 
112
      else {
 
113
        sprintf(opdm_a_lbl[i], "MO-basis Alpha %s Root %d", 
 
114
          transdens ? "TDM" : "OPDM", i);
 
115
        sprintf(opdm_b_lbl[i], "MO-basis Beta %s Root %d", 
 
116
          transdens ? "TDM" : "OPDM", i);
 
117
      }
 
118
    }
 
119
  }
 
120
 
 
121
  return;
 
122
 
 
123
}
 
124