1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Select atoms at alternate locations.
11
(1) Pointer to MolComplexS structure, with macromol. complexes.
12
(2) Number of macromolecular complexes.
13
(3) Selection mode index (0 = overwrite, 1 = restrict, 2 = expand
17
(1) The flag selectedF set for all atoms at alternate positions,
18
in all currently caught macromolecular complexes.
22
(1) The number of selected atoms (zero or positive value).
25
(1) The position_changedF is updated, because some atoms may not
26
have the proper color.
28
========includes:============================================================*/
33
#include <X11/Xutil.h>
35
#include <X11/Xatom.h>
40
/*======select atoms at alternate positions:=================================*/
42
long SelectAlternate_ (MolComplexS *mol_complexSP, int mol_complexesN,
45
long selected_atomsN = 0;
47
MolComplexS *curr_mol_complexSP;
51
unsigned char alternateF;
53
/* Check every macromolecular complex: */
54
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
56
/** Pointer to the current macromolecular complex: **/
57
curr_mol_complexSP = mol_complexSP + mol_complexI;
59
/** Check is the current macromolecular complex caught: **/
60
if (curr_mol_complexSP->catchF == 0) continue;
62
/** Number of atoms in a macromolecular complex: **/
63
atomsN = curr_mol_complexSP->atomsN;
65
/** Scan all atoms in the current complex: **/
66
for (atomI = 0; atomI < atomsN; atomI++)
68
/** Pointer to the current atom: **/
69
curr_atomSP = curr_mol_complexSP->atomSP + atomI;
71
/** Check the alternate position indicator: **/
72
alt_location = curr_atomSP->raw_atomS.alt_location;
74
if ((alt_location != ' ') && (alt_location != 'A'))
79
/** Set the selection flag for the current atom: **/
80
switch (selection_modeI)
82
/*** Overwrite the previous selection: ***/
84
curr_atomSP->selectedF = alternateF;
87
/*** Restrict the previous selection: ***/
89
curr_atomSP->selectedF &= alternateF;
92
/*** Expand the previous selection: ***/
94
curr_atomSP->selectedF |= alternateF;
101
/** Check the selection flag; increase **/
102
/** the count if flag is equal to one: **/
103
if (curr_atomSP->selectedF) selected_atomsN++;
106
/** Update the position_changedF (some atoms may have bad color): **/
107
curr_mol_complexSP->position_changedF = 1;
110
/* Return the number of selected atoms: */
111
return selected_atomsN;
114
/*===========================================================================*/