~ubuntu-branches/ubuntu/precise/psicode/precise

« back to all changes in this revision

Viewing changes to src/bin/input/correlate.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
/** This function returns a lookup array that correlates irreps of a point group
 
2
 ** with irreps of a subgroup produced by a displacement of a particular
 
3
 ** irrep (in the higher point group). It returns an array that contains the
 
4
 ** the irrep of the sugroup that corresponds with the irreps of the higher
 
5
 ** point group.
 
6
 ** returns: int *array with dimension (number of old irreps) */ 
 
7
 
 
8
#include <stdio.h>
 
9
#include <stdlib.h>
 
10
#include <math.h>
 
11
#include <libciomr/libciomr.h>
 
12
#include "global.h"
 
13
 
 
14
int *correlate(char *ptgrp, int irrep, int *nirreps_old, int *nirreps_new)
 
15
{
 
16
  int i;
 
17
  int *arr;
 
18
 
 
19
  if (strcmp(ptgrp,"C1 ") == 0)
 
20
    *nirreps_old = 1;
 
21
  else if (strcmp(ptgrp,"Cs ") == 0)
 
22
    *nirreps_old = 2;
 
23
  else if (strcmp(ptgrp,"Ci ") == 0)
 
24
    *nirreps_old = 2;
 
25
  else if (strcmp(ptgrp,"C2 ") == 0)
 
26
    *nirreps_old = 2;
 
27
  else if (strcmp(ptgrp,"C2v") == 0)
 
28
    *nirreps_old = 4;
 
29
  else if (strcmp(ptgrp,"D2 ") == 0)
 
30
    *nirreps_old = 4;
 
31
  else if (strcmp(ptgrp,"C2h") == 0)
 
32
    *nirreps_old = 4;
 
33
  else if (strcmp(ptgrp,"D2h") == 0)
 
34
    *nirreps_old = 8;
 
35
  else {
 
36
    fprintf(outfile,"point group %s unknown.\n",ptgrp);
 
37
    exit(1);
 
38
  }
 
39
 
 
40
  arr = init_int_array(*nirreps_old);
 
41
 
 
42
  if (irrep == 0) { /* return identity */
 
43
    *nirreps_new = *nirreps_old;
 
44
    for (i=0; i<*nirreps_old; ++i)
 
45
      arr[i] = i; 
 
46
    return arr;
 
47
  }
 
48
 
 
49
  *nirreps_new = *nirreps_old / 2;
 
50
  if ((strcmp(ptgrp,"C1 ") == 0) || (strcmp(ptgrp,"Cs ") == 0) ||
 
51
      (strcmp(ptgrp,"Ci ") == 0) || (strcmp(ptgrp,"C2 ") == 0) ) {
 
52
        arr[0] = 0;
 
53
  }
 
54
  else if ( (strcmp(ptgrp,"C2v") == 0) || (strcmp(ptgrp,"D2 ") == 0) ||
 
55
            (strcmp(ptgrp,"C2h") == 0) ) {
 
56
    if (irrep == 1) {
 
57
      arr[0] = 0;  arr[1] = 0; arr[2] = 1;  arr[3] = 1;
 
58
    }
 
59
    else if (irrep == 2) {
 
60
      arr[0] = 0;  arr[1] = 1; arr[2] = 0;  arr[3] = 1;
 
61
    }
 
62
    else if (irrep == 3) {
 
63
      arr[0] = 0;  arr[1] = 1; arr[2] = 1;  arr[3] = 0;
 
64
    }
 
65
  }
 
66
  else if (strcmp(ptgrp,"D2h") == 0) {
 
67
    /* 1,2,3 give C2h displaced geometries */
 
68
    if (irrep == 1) {
 
69
      arr[0] = 0;  arr[1] = 0; arr[2] = 1;  arr[3] = 1;
 
70
      arr[4] = 2;  arr[5] = 2; arr[6] = 3;  arr[7] = 3;
 
71
    }
 
72
    else if (irrep == 2) {
 
73
      arr[0] = 0;  arr[1] = 1; arr[2] = 0;  arr[3] = 1;
 
74
      arr[4] = 2;  arr[5] = 3; arr[6] = 2;  arr[7] = 3;
 
75
    }
 
76
    else if (irrep == 3) {
 
77
      arr[0] = 0;  arr[1] = 1; arr[2] = 1;  arr[3] = 0;
 
78
      arr[4] = 2;  arr[5] = 3; arr[6] = 3;  arr[7] = 2;
 
79
    }
 
80
    /* 4 gives D2 displaced geometries */
 
81
    else if (irrep == 4) { /* D2 */
 
82
      arr[0] = 0;  arr[1] = 1; arr[2] = 2;  arr[3] = 3;
 
83
      arr[4] = 0;  arr[5] = 1; arr[6] = 2;  arr[7] = 3;
 
84
    }
 
85
    /* displacements along irreps 5,6,7 make C2v structures */
 
86
    /* care is taken to make sure definition of b1 and b2 will
 
87
       match those that input will generate - the following seems to work:
 
88
       b1u disp: has C2(z), b2 irrep symmetric wrt sigma(yz)
 
89
       b2u disp: has C2(y), b2 irrep symmetric wrt sigma(xy)
 
90
       b3u disp: has C2(x), b2 irrep symmetric wrt sigma(xz) */
 
91
    else if (irrep == 5) { /* b1u */
 
92
      arr[0] = 0;  arr[1] = 1; arr[2] = 2;  arr[3] = 3;
 
93
      arr[4] = 1;  arr[5] = 0; arr[6] = 3;  arr[7] = 2;
 
94
    }
 
95
    else if (irrep == 6) { /* b2u */
 
96
      arr[0] = 0;  arr[1] = 3; arr[2] = 1;  arr[3] = 2;
 
97
      arr[4] = 1;  arr[5] = 2; arr[6] = 0;  arr[7] = 3;
 
98
    }
 
99
    else if (irrep == 7) { /* b3u */
 
100
      arr[0] = 0;  arr[1] = 2; arr[2] = 3;  arr[3] = 1;
 
101
      arr[4] = 1;  arr[5] = 3; arr[6] = 2;  arr[7] = 0;
 
102
    }
 
103
  }
 
104
  else {
 
105
    fprintf(outfile,"Point group unknown for correlation table.\n");
 
106
  }
 
107
 
 
108
  return arr;
 
109
}