1 /*****
2 This file is part of the Babel Program
3 Copyright (C) 1992-96 W. Patrick Walters and Matthew T. Stahl
4 All Rights Reserved
5 All Rights Reserved
6 All Rights Reserved
7 All Rights Reserved
8
9 For more information please contact :
10
11 babel@mercury.aichem.arizona.edu
12 ------------------------------------------------------------------------------
13
14 FILE : wrxyz.c
15 AUTHOR(S) : Pat Walters
16 DATE : 11-92
17 PURPOSE : Routines to write a dock database file
18 ******/
19
20 #include "bbltyp.h"
21
22 static int first_one = TRUE;
23
24 #define DOCK_CHG_FACTOR 1000.0
25
26 int
write_dock(FILE * file1,ums_type * mol)27 write_dock(FILE *file1, ums_type *mol)
28 {
29 int i;
30 char type_name[5];
31 int result;
32 int num, heavy_count, h_count;
33 double Xmin = 999999.0;
34 double Ymin = 999999.0;
35 double Zmin = 999999.0;
36 vect_type v;
37 ums_type *temp = NULL;
38 char temp_title[BUFF_SIZE];
39
40 if (first_one)
41 {
42 fprintf(file1,"%s\n","DOCK 3.5 ligand_atoms");
43 first_one = FALSE;
44 }
45
46 type_hydrogens(mol);
47
48 for(i = 1;i <= Atoms; i++)
49 {
50 if (X(i) < Xmin) Xmin = X(i);
51 if (Y(i) < Ymin) Ymin = Y(i);
52 if (Z(i) < Zmin) Zmin = Z(i);
53 }
54
55 v.x = -Xmin;
56 v.y = -Ymin;
57 v.z = -Zmin;
58
59 ums_plus_vector(mol,&v);
60
61 heavy_count = total_heavy_atoms(mol);
62 h_count = Atoms - heavy_count;
63
64 fprintf(file1,"%-51s%-51s\n",Title,Title);
65 fprintf(file1,"%3d%3d%3d%12.4f%6d%9.2f\n",
66 Atoms,heavy_count,h_count,0.0,0,0.0);
67
68 for(i = 1;i <= Atoms; i++)
69 {
70 result = get_output_type(i,"DOK",Type(i),type_name,zero);
71 fprintf(file1,"%5.0f%5.0f%5.0f%2d%5.0f%1d%3d\n",
72 X(i)*1000.0,
73 Y(i)*1000.0,
74 Z(i)*1000.0,
75 atoi(type_name),
76 Charge(i)*DOCK_CHG_FACTOR,
77 0,0);
78 }
79 return(TRUE);
80 }
81
82
total_heavy_atoms(ums_type * mol)83 int total_heavy_atoms(ums_type *mol)
84 {
85 int i;
86 int heavy = 0;
87
88 for (i = 1; i <= Atoms; i++)
89 {
90 if (Atomic_number(i) != 1)
91 heavy++;
92 }
93
94 return(heavy);
95 }
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112