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

« back to all changes in this revision

Viewing changes to assign_radii.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
                                assign_radii.c
 
6
 
 
7
Purpose:
 
8
        Assign atomic and van der Waals radius to each atom. Generic radii
 
9
        are assigned to unrecognized atoms.
 
10
 
 
11
Input:
 
12
        (1) Pointer to  MolComplexS structure.
 
13
        (2) Pointer to ConfigS structure.
 
14
 
 
15
Output:
 
16
        (1) Atomic radius and van der Waals radius assigned to each atom.
 
17
        (2) Return value.
 
18
 
 
19
Return value:
 
20
        (1) Positive if there are some atoms.
 
21
        (2) Zero if there are no atoms.
 
22
 
 
23
========includes:============================================================*/
 
24
 
 
25
#include <stdio.h>
 
26
 
 
27
#include <string.h>
 
28
 
 
29
#include <X11/Xlib.h>
 
30
#include <X11/Xutil.h>
 
31
#include <X11/Xos.h>
 
32
#include <X11/Xatom.h>
 
33
 
 
34
#include "defines.h"
 
35
#include "typedefs.h"
 
36
 
 
37
/*======assign two radii to each atom:=======================================*/
 
38
 
 
39
int AssignRadii_ (MolComplexS *mol_complexSP, ConfigS *configSP)
 
40
{
 
41
size_t          atomI, atomsN;
 
42
AtomS           *curr_atomSP;
 
43
 
 
44
/* Return zero if there are no atoms in this macromolecular complex: */
 
45
atomsN = mol_complexSP->atomsN;
 
46
if (atomsN == 0) return 0;
 
47
 
 
48
/* Scan the macromolecular complex: */
 
49
for (atomI = 0; atomI < atomsN; atomI++)
 
50
        {
 
51
        /** Pointer to the current atom: **/
 
52
        curr_atomSP = mol_complexSP->atomSP + atomI;
 
53
 
 
54
        /** Check the chemical symbol and assign radii: **/
 
55
        if      (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " H") == 0)
 
56
                {
 
57
                curr_atomSP->raw_atomS.radius = configSP->H_radius;
 
58
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
59
                                configSP->H_van_der_Waals_radius;
 
60
                }
 
61
        else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " C") == 0)
 
62
                {
 
63
                curr_atomSP->raw_atomS.radius = configSP->C_radius;
 
64
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
65
                                configSP->C_van_der_Waals_radius;
 
66
                }
 
67
        else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " N") == 0)
 
68
                {
 
69
                curr_atomSP->raw_atomS.radius = configSP->N_radius;
 
70
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
71
                                configSP->N_van_der_Waals_radius;
 
72
                }
 
73
        else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " O") == 0)
 
74
                {
 
75
                curr_atomSP->raw_atomS.radius = configSP->O_radius;
 
76
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
77
                                configSP->O_van_der_Waals_radius;
 
78
                }
 
79
        else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " S") == 0)
 
80
                {
 
81
                curr_atomSP->raw_atomS.radius = configSP->S_radius;
 
82
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
83
                                configSP->S_van_der_Waals_radius;
 
84
                }
 
85
        else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " P") == 0)
 
86
                {
 
87
                curr_atomSP->raw_atomS.radius = configSP->P_radius;
 
88
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
89
                                configSP->P_van_der_Waals_radius;
 
90
                }
 
91
        else
 
92
                {
 
93
                curr_atomSP->raw_atomS.radius = configSP->generic_radius;
 
94
                curr_atomSP->raw_atomS.van_der_Waals_radius =
 
95
                                configSP->generic_van_der_Waals_radius;
 
96
                }
 
97
        }
 
98
 
 
99
/* Return positive value if this point is reached: */
 
100
return 1;
 
101
}
 
102
 
 
103
/*===========================================================================*/
 
104
 
 
105