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