~ubuntu-branches/ubuntu/breezy/garlic/breezy

« back to all changes in this revision

Viewing changes to exclude_distant.c

  • Committer: Bazaar Package Importer
  • Author(s): zhaoway
  • Date: 2001-04-24 07:09:13 UTC
  • Revision ID: james.westby@ubuntu.com-20010424070913-uzpupnwdfhmliebz
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 Damir Zucic */
 
2
 
 
3
/*=============================================================================
 
4
 
 
5
                             exclude_distant.c
 
6
 
 
7
Purpose:
 
8
        Exclude exposed polar residues which are below the plane.
 
9
 
 
10
Input:
 
11
        (1) Pointer to RuntimeS structure.
 
12
        (2) The complex index (1 = bottom, 2 = top).
 
13
 
 
14
Output:
 
15
        (1) Some exposed polar residues excluded from the list.
 
16
        (2) Return value.
 
17
 
 
18
Return value:
 
19
        (1) Positive on success.
 
20
        (2) Negative on failure.
 
21
 
 
22
========includes:============================================================*/
 
23
 
 
24
#include <stdio.h>
 
25
 
 
26
#include <X11/Xlib.h>
 
27
#include <X11/Xutil.h>
 
28
#include <X11/Xos.h>
 
29
#include <X11/Xatom.h>
 
30
 
 
31
#include "defines.h"
 
32
#include "typedefs.h"
 
33
 
 
34
/*======function prototypes:=================================================*/
 
35
 
 
36
void            ErrorMessage_ (char *, char *, char *,
 
37
                               char *, char *, char *, char *);
 
38
double          ScalarProduct_ (VectorS *, VectorS *);
 
39
 
 
40
/*======exclude distant residues from the list:==============================*/
 
41
 
 
42
int ExcludeDistant_ (RuntimeS *runtimeSP, int docking_complexI)
 
43
{
 
44
int                     exposed_polarN, exposed_polarI;
 
45
MolComplexS             *curr_mol_complexSP;
 
46
int                     *exposed_atomIP;
 
47
ExposedResidueS         *exposed_polarSP;
 
48
double                  plane_center_x, plane_center_y, plane_center_z;
 
49
VectorS                 normal_vectorS;
 
50
ExposedResidueS         *curr_exposedSP;
 
51
AtomS                   *curr_atomSP;
 
52
double                  x, y, z;
 
53
VectorS                 curr_vectorS;
 
54
 
 
55
/* Check the complex index and prepare the pointers: */
 
56
if (docking_complexI == 1)
 
57
        {
 
58
        exposed_polarN = runtimeSP->exposed_polar1N;
 
59
        curr_mol_complexSP = runtimeSP->mol_complex1SP;
 
60
        exposed_atomIP = runtimeSP->exposed_atom1IP;
 
61
        exposed_polarSP = runtimeSP->exposed_polar1SP;
 
62
        }
 
63
else if (docking_complexI == 2)
 
64
        {
 
65
        exposed_polarN = runtimeSP->exposed_polar2N;
 
66
        curr_mol_complexSP = runtimeSP->mol_complex2SP;
 
67
        exposed_atomIP = runtimeSP->exposed_atom2IP;
 
68
        exposed_polarSP = runtimeSP->exposed_polar2SP;
 
69
        }
 
70
else
 
71
        {
 
72
        ErrorMessage_ ("garlic", "RepresentativeAtoms_", "",
 
73
                       "Bad macromolecular complex index!\n",
 
74
                       "", "", "");
 
75
        return -1;
 
76
        }
 
77
 
 
78
/* Copy the plane center position (plane belongs to bottom complex): */
 
79
plane_center_x = curr_mol_complexSP->planeS.center_x[0];
 
80
plane_center_y = curr_mol_complexSP->planeS.center_y;
 
81
plane_center_z = curr_mol_complexSP->planeS.center_z[0];
 
82
 
 
83
/* Copy the normal vector (plane belongs to bottom complex): */
 
84
normal_vectorS.x = curr_mol_complexSP->planeS.normal_x[0];
 
85
normal_vectorS.y = curr_mol_complexSP->planeS.normal_y;
 
86
normal_vectorS.z = curr_mol_complexSP->planeS.normal_z[0];
 
87
 
 
88
/* Scan the list: */
 
89
for (exposed_polarI = 0; exposed_polarI < exposed_polarN; exposed_polarI++)
 
90
        {
 
91
        /* Pointer to the current exposed polar residue: */
 
92
        curr_exposedSP = exposed_polarSP + exposed_polarI;
 
93
 
 
94
        /* Pointer to the representative atom: */
 
95
        curr_atomSP = curr_mol_complexSP->atomSP +
 
96
                      curr_exposedSP->representative_atomI;
 
97
 
 
98
        /* Copy the atomic coordinates: */
 
99
        x = curr_atomSP->raw_atomS.x[0];
 
100
        y = curr_atomSP->raw_atomS.y;
 
101
        z = curr_atomSP->raw_atomS.z[0];
 
102
 
 
103
        /* Position of the atom relative to the plane center: */
 
104
        curr_vectorS.x = x - plane_center_x;
 
105
        curr_vectorS.y = y - plane_center_y;
 
106
        curr_vectorS.z = z - plane_center_z;
 
107
 
 
108
        /* Check the sign of the scalar product: */
 
109
        if (ScalarProduct_ (&curr_vectorS, &normal_vectorS) < 0)
 
110
                {
 
111
                curr_exposedSP->excludedF = 1;
 
112
                }
 
113
        }
 
114
 
 
115
/* Return positive value on success: */
 
116
return 1;
 
117
}
 
118
 
 
119
/*===========================================================================*/
 
120
 
 
121