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

« back to all changes in this revision

Viewing changes to src/bin/optking/zmat_to_intco.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
 
/*** ZMAT_TO_INTCO() determine simples from z-matrix coordinates 
2
 
  - not intended to work for dummy atoms ***/
3
 
 
4
 
#include <stdio.h>
5
 
#include <stdlib.h>
6
 
#include <string.h>
7
 
#include <math.h>
8
 
#include <libciomr/libciomr.h>
9
 
#include <libchkpt/chkpt.h>
10
 
 
11
 
#define EXTERN
12
 
#define C_EXTERN
13
 
#define C_CODE
14
 
#include "opt.h"
15
 
#undef C_CODE
16
 
#undef C_EXTERN
17
 
#undef EXTERN
18
 
 
19
 
void zmat_to_intco() {
20
 
  int i, first, a, b, c, d, cnt = 0, natom;
21
 
  char **felement;
22
 
  char buf[2];
23
 
  struct z_entry *zmat;
24
 
 
25
 
  natom = optinfo.natom;
26
 
  chkpt_init(PSIO_OPEN_OLD);
27
 
  zmat = chkpt_rd_zmat();
28
 
  chkpt_close();
29
 
 
30
 
/*
31
 
  for (i=0;i<natom;++i) {
32
 
    fprintf(outfile,"%d %d %d %d\n",  i, zmat[i].bond_atom, zmat[i].angle_atom, zmat[i].tors_atom);
33
 
    fprintf(outfile,"%20.10lf %20.10lf %20.10lf\n", zmat[i].bond_val, zmat[i].angle_val, zmat[i].tors_val);
34
 
    fprintf(outfile,"%s %s %s \n", zmat[i].bond_label, zmat[i].angle_label, zmat[i].tors_label);
35
 
   }
36
 
*/
37
 
 
38
 
  ffile(&fp_intco,"intco.dat",0);
39
 
  fprintf(fp_intco,"intco: (\n");
40
 
 
41
 
  fprintf(fp_intco,"  stre = (\n");
42
 
  for (i=1; i<natom; ++i) {
43
 
    a = i+1;
44
 
    b = zmat[i].bond_atom;
45
 
    swap(&a, &b);
46
 
    fprintf(fp_intco, "    (%d %d %d)\n",++cnt, a, b);
47
 
  }
48
 
  fprintf(fp_intco,"  )\n");
49
 
  
50
 
  fprintf(fp_intco,"  bend = (\n");
51
 
  for (i=2; i<natom; ++i) {
52
 
    a = i+1;
53
 
    b = zmat[i].bond_atom;
54
 
    c = zmat[i].angle_atom;
55
 
    swap(&a, &c);
56
 
    if (zmat[i].angle_val != 180.0) {
57
 
      fprintf(fp_intco, "    (%d %d %d %d)\n",++cnt, a, b, c);
58
 
    }
59
 
  }
60
 
  fprintf(fp_intco,"  )\n");
61
 
 
62
 
  fprintf(fp_intco,"  tors = (\n");
63
 
  for (i=3; i<natom; ++i) {
64
 
    a = i+1;
65
 
    b = zmat[i].bond_atom;
66
 
    c = zmat[i].angle_atom;
67
 
    d = zmat[i].tors_atom;
68
 
    swap_tors(&a, &b, &c, &d);
69
 
    if (zmat[i].angle_val != 180.0)
70
 
      fprintf(fp_intco, "    (%d %d %d %d %d)\n",++cnt, a, b, c, d);
71
 
  }
72
 
  fprintf(fp_intco,"  )\n");
73
 
 
74
 
  first = 1;
75
 
  for (i=2; i<natom; ++i) {
76
 
    a = i+1;
77
 
    b = zmat[i].bond_atom;
78
 
    c = zmat[i].angle_atom;
79
 
    swap(&a, &c);
80
 
    if (zmat[i].angle_val == 180.0) {
81
 
      if (first) {
82
 
        fprintf(fp_intco,"  lin1 = (\n");
83
 
        first = 0;
84
 
      }
85
 
      fprintf(fp_intco, "    (%d %d %d %d)\n",++cnt, a, b, c);
86
 
    }
87
 
  }
88
 
  if (!first) fprintf(fp_intco,"  )\n");
89
 
 
90
 
  first = 1;
91
 
  for (i=2; i<natom; ++i) {
92
 
    a = i+1;
93
 
    b = zmat[i].bond_atom;
94
 
    c = zmat[i].angle_atom;
95
 
    swap(&a, &c);
96
 
    if (zmat[i].angle_val == 180.0) {
97
 
      if (first) {
98
 
        fprintf(fp_intco,"  lin2 = (\n");
99
 
        first = 0;
100
 
      }
101
 
      fprintf(fp_intco, "    (%d %d %d %d)\n",++cnt, a, b, c);
102
 
    }
103
 
  }
104
 
  if (!first) fprintf(fp_intco,"  )\n");
105
 
  fprintf(fp_intco,")");
106
 
  fclose(fp_intco);
107
 
 
108
 
  ffile(&fp_intco,"fintco.dat",0);
109
 
 
110
 
  /* write out coordinates to be frozen */
111
 
  fprintf(fp_intco,"fixed_intco: (\n");
112
 
  cnt = 0;
113
 
 
114
 
  fprintf(fp_intco,"  stre = (\n");
115
 
  for (i=1; i<natom; ++i) {
116
 
    a = i+1;
117
 
    b = zmat[i].bond_atom;
118
 
    swap(&a, &b);
119
 
    if (zmat[i].bond_opt == 0)
120
 
      fprintf(fp_intco, "    ( %d %d)\n", a, b);
121
 
  }
122
 
  fprintf(fp_intco,"  )\n");
123
 
 
124
 
  fprintf(fp_intco,"  bend = (\n");
125
 
  for (i=2; i<natom; ++i) {
126
 
    a = i+1;
127
 
    b = zmat[i].bond_atom;
128
 
    c = zmat[i].angle_atom;
129
 
    swap(&a, &c);
130
 
    if (zmat[i].angle_val != 180.0) {
131
 
      if (zmat[i].angle_opt == 0)
132
 
        fprintf(fp_intco, "    ( %d %d %d)\n", a, b, c);
133
 
    }
134
 
  }
135
 
  fprintf(fp_intco,"  )\n");
136
 
 
137
 
  fprintf(fp_intco,"  tors = (\n");
138
 
  for (i=3; i<natom; ++i) {
139
 
    a = i+1;
140
 
    b = zmat[i].bond_atom;
141
 
    c = zmat[i].angle_atom;
142
 
    d = zmat[i].tors_atom;
143
 
    swap_tors(&a, &b, &c, &d);
144
 
    if (zmat[i].angle_val != 180.0) {
145
 
      if (zmat[i].tors_opt == 0)
146
 
        fprintf(fp_intco, "    ( %d %d %d %d)\n", a, b, c, d);
147
 
    }
148
 
  }
149
 
  fprintf(fp_intco,"  )\n");
150
 
 
151
 
  first = 1;
152
 
  for (i=2; i<natom; ++i) {
153
 
    a = i+1;
154
 
    b = zmat[i].bond_atom;
155
 
    c = zmat[i].angle_atom;
156
 
    swap(&a, &c);
157
 
    if (zmat[i].angle_val == 180.0) {
158
 
      if (zmat[i].angle_opt == 0) {
159
 
        if (first) {
160
 
          fprintf(fp_intco,"  lin1 = (\n");
161
 
          first = 0;
162
 
        }
163
 
        fprintf(fp_intco, "    ( %d %d %d)\n", a, b, c);
164
 
      }
165
 
    }
166
 
  }
167
 
  if (!first) fprintf(fp_intco,"  )\n");
168
 
 
169
 
  first = 1;
170
 
  for (i=2; i<natom; ++i) {
171
 
    a = i+1;
172
 
    b = zmat[i].bond_atom;
173
 
    c = zmat[i].angle_atom;
174
 
    swap(&a, &c);
175
 
    if (zmat[i].angle_val == 180.0) {
176
 
      if (zmat[i].angle_opt == 0) {
177
 
        if (first) {
178
 
          fprintf(fp_intco,"  lin2 = (\n");
179
 
          first = 0;
180
 
        }
181
 
        fprintf(fp_intco, "    ( %d %d %d)\n", a, b, c);
182
 
      }
183
 
    }
184
 
  }
185
 
  if (!first) fprintf(fp_intco,"  )\n");
186
 
 
187
 
  if (cnt > 0)
188
 
    optinfo.constraints_present = 1;
189
 
 
190
 
  fprintf(fp_intco,")");
191
 
  fclose(fp_intco);
192
 
  return;
193
 
}