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

« back to all changes in this revision

Viewing changes to slab.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
                                slab.c
 
6
 
 
7
Purpose:
 
8
        For each macromolecular complex,  check which atoms are inside slab.
 
9
        If slab mode is not recognized,  do nothing.  The slab flags will be
 
10
        left intact in this case.  Each macromolecular complex  may have its
 
11
        own slab mode.
 
12
 
 
13
Input:
 
14
        (1) Pointer to MolComplexS structure.
 
15
        (2) Number of macromolecular complexes.
 
16
 
 
17
Output:
 
18
        (1) Slab flag set for each atom in each macromolecular complex.  The
 
19
            value zero  is assigned to all atoms outside the slab  and value
 
20
            one to all atoms inside the slab.
 
21
        (2) Return value.
 
22
 
 
23
Return value:
 
24
        The number of atoms inside slab (zero or positive).
 
25
 
 
26
Notes:
 
27
        (1) For each slab mode a separate function is prepared.
 
28
 
 
29
========includes:============================================================*/
 
30
 
 
31
#include <stdio.h>
 
32
 
 
33
#include <X11/Xlib.h>
 
34
#include <X11/Xutil.h>
 
35
#include <X11/Xos.h>
 
36
#include <X11/Xatom.h>
 
37
 
 
38
#include "defines.h"
 
39
#include "typedefs.h"
 
40
 
 
41
/*======function prototypes:=================================================*/
 
42
 
 
43
size_t          NoSlab_ (MolComplexS *);
 
44
size_t          PlanarSlab_ (MolComplexS *);
 
45
size_t          SphereSlab_ (MolComplexS *);
 
46
size_t          HalfSphereSlab_ (MolComplexS *);
 
47
size_t          CylinSlab_ (MolComplexS *);
 
48
size_t          HalfCylinSlab_ (MolComplexS *);
 
49
 
 
50
/*======cut the slab:========================================================*/
 
51
 
 
52
size_t Slab_ (MolComplexS *mol_complexSP, int mol_complexesN)
 
53
{
 
54
int             mol_complexI;
 
55
MolComplexS     *curr_mol_complexSP;
 
56
 
 
57
/* Check every macromolecular complex: */
 
58
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
 
59
        {
 
60
        /** Pointer to the current macromolecular complex: **/
 
61
        curr_mol_complexSP = mol_complexSP + mol_complexI;
 
62
 
 
63
        /** Do not apply slab if position has not changed: **/
 
64
        if (curr_mol_complexSP->position_changedF == 0) continue;
 
65
 
 
66
        /** Apply the proper slab: **/
 
67
        switch (curr_mol_complexSP->slab_modeI)
 
68
                {
 
69
                /*** Slab not used: ***/
 
70
                case 0:
 
71
                        return NoSlab_ (curr_mol_complexSP);
 
72
                        break;
 
73
 
 
74
                /*** Planar: ***/
 
75
                case 1:
 
76
                        return PlanarSlab_ (curr_mol_complexSP);
 
77
                        break;
 
78
 
 
79
                /*** Spherical: ***/
 
80
                case 2:
 
81
                        return SphereSlab_ (curr_mol_complexSP);
 
82
                        break;
 
83
 
 
84
                /*** Semi-spherical: ***/
 
85
                case 3:
 
86
                        return HalfSphereSlab_ (curr_mol_complexSP);
 
87
                        break;
 
88
 
 
89
                /*** Cylindrical: ***/
 
90
                case 4:
 
91
                        return CylinSlab_ (curr_mol_complexSP);
 
92
                        break;
 
93
 
 
94
                /*** Semi-cylindrical: ***/
 
95
                case 5:
 
96
                        return HalfCylinSlab_ (curr_mol_complexSP);
 
97
                        break;
 
98
 
 
99
                /*** Unknown slab mode: ***/
 
100
                default:
 
101
                        ;
 
102
                }
 
103
        }
 
104
 
 
105
/* If this point is reached, slab mode was not recognized: */
 
106
return 0;
 
107
}
 
108
 
 
109
/*===========================================================================*/
 
110