File: assign_radii.c

package info (click to toggle)
garlic 1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,516 kB
  • sloc: ansic: 52,465; makefile: 2,254
file content (131 lines) | stat: -rw-r--r-- 4,132 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* Copyright (C) 2000-2002 Damir Zucic */

/*=============================================================================

				assign_radii.c

Purpose:
	Assign atomic, covalent and van der Waals radius to each atom. Assign
	generic radii to unrecognized atoms.

Input:
	(1) Pointer to  MolComplexS structure.
	(2) Pointer to ConfigS structure.

Output:
	(1) Atomic radius,  covalent radius and van der Waals radius assigned
	    to each atom.
	(2) Return value.

Return value:
	(1) Positive if there are some atoms.
	(2) Zero if there are no atoms.

========includes:============================================================*/

#include <stdio.h>

#include <string.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

#include "defines.h"
#include "typedefs.h"

/*======assign two radii to each atom:=======================================*/

int AssignRadii_ (MolComplexS *mol_complexSP, ConfigS *configSP)
{
size_t		atomI, atomsN;
AtomS		*curr_atomSP;

/* Return zero if there are no atoms in this macromolecular complex: */
atomsN = mol_complexSP->atomsN;
if (atomsN == 0) return 0;

/* Scan the macromolecular complex: */
for (atomI = 0; atomI < atomsN; atomI++)
	{
	/** Pointer to the current atom: **/
	curr_atomSP = mol_complexSP->atomSP + atomI;

	/** Assign default ball radius to all atoms: **/
	curr_atomSP->raw_atomS.ball_radius = configSP->default_ball_radius;

	/** Check the chemical symbol and assign four additional radii: **/
	if      (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " H") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->H_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->H_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->H_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->H_van_der_Waals_radius;
		}
	else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " C") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->C_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->C_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->C_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->C_van_der_Waals_radius;
		}
	else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " N") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->N_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->N_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->N_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->N_van_der_Waals_radius;
		}
	else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " O") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->O_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->O_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->O_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->O_van_der_Waals_radius;
		}
	else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " S") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->S_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->S_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->S_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->S_van_der_Waals_radius;
		}
	else if (strcmp (curr_atomSP->raw_atomS.chemical_symbolA, " P") == 0)
		{
		curr_atomSP->raw_atomS.radius = configSP->P_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->P_covalent_radius;
		curr_atomSP->raw_atomS.small_radius = configSP->P_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->P_van_der_Waals_radius;
		}
	else
		{
		curr_atomSP->raw_atomS.radius = configSP->generic_radius;
		curr_atomSP->raw_atomS.covalent_radius =
				configSP->generic_covalent_radius;
		curr_atomSP->raw_atomS.small_radius =
				configSP->generic_small_radius;
		curr_atomSP->raw_atomS.van_der_Waals_radius =
				configSP->generic_van_der_Waals_radius;
		}
	}

/* Return positive value if this point is reached: */
return 1;
}

/*===========================================================================*/