ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mengine/src/kopend.c
Revision: 103
Committed: Thu Feb 19 01:37:38 2009 UTC (12 years, 4 months ago) by gilbertke
File size: 3074 byte(s)
Log Message:
major rewrite - removing global data, adding electrostatics tag to read_sdf
Line File contents
1 #define EXTERN extern
2 #include "pcwin.h"
3 #include "pcmod.h"
4
5 #include "angles.h"
6
7 EXTERN struct t_ooplane_k {
8 int nopbend;
9 char iopb[MAXOOP][13];
10 float copb[MAXOOP];
11 } ooplane_k;
12
13 void numeral(int,char *,int);
14 int get_field(void);
15 EXTERN int Missing_constants;
16
17 void kopbend()
18 {
19 int i, j, ia,ib,ic,id, jj, ierr,field;
20 int ita,itb, itc,itd, itd_class;
21 int it, it1;
22 char pa[4],pb[4],pc[4],pd[4],pdc[4],pt[13],pt1[13],pt2[13];
23
24 angles.nopb = 0;
25 field = get_field();
26 for (i=0; i < angles.nang; i++)
27 {
28 ia = angles.i13[i][0];
29 ib = angles.i13[i][1];
30 ic = angles.i13[i][2];
31 ita = atom.type[ia];
32 itb = atom.type[ib];
33 itc = atom.type[ic];
34 ierr = FALSE;
35 if (angles.i13[i][3] != 0 )
36 {
37 // angle ia-ib-id-ic
38 id = angles.i13[i][3];
39 itd = atom.type[id];
40 itd_class = atom.tclass[id];
41 numeral(ita,pa,3);
42 numeral(itb,pb,3);
43 numeral(itc,pc,3);
44 numeral(itd,pd,3);
45 numeral(itd_class,pdc,3);
46 if (field == MMX || field == MM3)
47 {
48 strcpy(pt," 0"); strcat(pt,pb); strcat(pt,pd); strcat(pt," 0");
49 }else if (field == MMFF94)
50 {
51 if (ita <= itc && ita <= itd)
52 {
53 if (itc <= itd)
54 {
55 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pc); strcat(pt,pd);
56 } else
57 {
58 strcpy(pt,pa); strcat(pt,pb); strcat(pt,pd); strcat(pt,pc);
59 }
60 } else if ( itc <= ita && itc <= itd)
61 {
62 if (ita <= itd)
63 {
64 strcpy(pt,pc); strcat(pt,pb); strcat(pt,pa); strcat(pt,pd);
65 } else
66 {
67 strcpy(pt,pc); strcat(pt,pb); strcat(pt,pd); strcat(pt,pa);
68 }
69 } else if (itd <= ita && itd <= itc)
70 {
71 if ( ita <= itc)
72 {
73 strcpy(pt,pd); strcat(pt,pb); strcat(pt,pa); strcat(pt,pc);
74 } else
75 {
76 strcpy(pt,pd); strcat(pt,pb); strcat(pt,pc); strcat(pt,pa);
77 }
78 }
79 }
80 strcpy(pt1," 0"); strcat(pt1,pb); strcat(pt1,pdc); strcat(pt1," 0");
81 strcpy(pt2," 0"); strcat(pt2,pb); strcat(pt2," 0"); strcat(pt2," 0");
82 it = itb*100 + itd;
83 it1 = itb*100;
84 ierr = FALSE;
85 for (j=0; j < ooplane_k.nopbend; j++)
86 {
87 if (strcmp(pt,ooplane_k.iopb[j]) == 0 || strcmp(pt1,ooplane_k.iopb[j]) == 0 || strcmp(pt2,ooplane_k.iopb[j]) == 0)
88 {
89 angles.copb[i] = ooplane_k.copb[j];
90 angles.angin[i] = TRUE;
91 angles.nopb++;
92 ierr = TRUE;
93 break;
94 }
95 }
96 }
97 }
98 }