1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Check which atoms are inside the cylindrical slab. Cylindrical slab
9
is defined by two concentric cylinders. A given atom is inside the
10
slab if it is outside the inner and inside the outer cylinder. Use
11
this slab type to hide the inner part (the "cork") of a porin-like
12
protein. The y axis is a symmetry axis.
15
(1) Pointer to MolComplexS structure.
18
(1) Slab flag set for each atom. The value one is assigned to atoms
19
inside the slab, zero to the rest.
23
The number of atoms inside the slab.
25
========includes:============================================================*/
30
#include <X11/Xutil.h>
32
#include <X11/Xatom.h>
37
/*======cylindrical slab:====================================================*/
39
size_t CylinSlab_ (MolComplexS *curr_mol_complexSP)
41
size_t atoms_inside_slabN = 0;
44
double x0, z0, rho0_squared, rho1_squared;
45
double x, z, rho_squared;
47
/* The number of atoms in a complex: */
48
atomsN = curr_mol_complexSP->atomsN;
50
/* Copy the slab center coordinates: */
51
x0 = curr_mol_complexSP->slab_center_vectorS.x;
52
z0 = curr_mol_complexSP->slab_center_vectorS.z;
53
rho0_squared = curr_mol_complexSP->slab_back_relative_position;
54
rho0_squared *= rho0_squared;
55
rho1_squared = curr_mol_complexSP->slab_front_relative_position;
56
rho1_squared *= rho1_squared;
58
/* Set the slab flag for each atom: */
59
for (atomI = 0; atomI < atomsN; atomI++)
61
/** Pointer to the current atom: **/
62
curr_atomSP = curr_mol_complexSP->atomSP + atomI;
64
/** Set the initial values of slab flags to one; this **/
65
/** will be changed later for atoms outside the slab: **/
66
curr_atomSP->inside_slabF = 1;
67
curr_atomSP->inside_projected_slabF = 1;
69
/** Distance between the current atom and the cylinder axis: **/
70
x = curr_atomSP->raw_atomS.x[0] - x0;
71
z = curr_atomSP->raw_atomS.z[0] - z0;
72
rho_squared = x * x + z * z;
74
/** If atom is inside the inner cylinder, set **/
75
/** slab flag to zero and check the next atom: **/
76
if (rho_squared < rho0_squared)
78
curr_atomSP->inside_slabF = 0;
79
curr_atomSP->inside_projected_slabF = 0;
83
/** If atom is outside the outer slab cylinder: **/
84
if (rho_squared > rho1_squared)
86
curr_atomSP->inside_slabF = 0;
87
curr_atomSP->inside_projected_slabF = 0;
91
/** If this points is reached, current atom is inside the slab: **/
95
/* Return the number of atoms inside the slab: */
96
return atoms_inside_slabN;
99
/*===========================================================================*/