1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Select cis, trans or bad/undefined peptide groups. More precisely,
9
only residues which contribute N and CA atom to peptide unit are
10
selected, though the peptide group belongs to two residues.
13
(1) Pointer to MolComplexS structure, with macromol. complexes.
14
(2) Number of macromolecular complexes.
15
(3) Selection mode index (0 = overwrite, 1 = restrict, 2 = expand
17
(4) Peptide unit conformation index (0 = bad, 1 = trans, 2 = cis).
20
(1) The flag selectedF set for atoms belonging to residues which
21
have the specified conformation of the peptide unit. More
22
precisely, for atoms which belong to residues whose CA and N
23
atoms are involved in a formation of a peptide unit having
24
the specified type of conformation.
28
(1) The number of selected atoms (zero or positive value).
31
(1) The position_changedF is updated, because some atoms may not
32
have the proper color.
34
========includes:============================================================*/
39
#include <X11/Xutil.h>
41
#include <X11/Xatom.h>
46
/*======select cis, trans or bad residues:===================================*/
48
long SelectCisTrans_ (MolComplexS *mol_complexSP, int mol_complexesN,
49
int selection_modeI, int input_cis_transF)
51
long selected_atomsN = 0;
53
MolComplexS *curr_mol_complexSP;
56
ResidueS *curr_residueSP;
57
unsigned char curr_cis_transF;
58
unsigned char conformationF;
60
/* Check every macromolecular complex: */
61
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
63
/** Pointer to the current macromolecular complex: **/
64
curr_mol_complexSP = mol_complexSP + mol_complexI;
66
/** Check is the current macromolecular complex caught: **/
67
if (curr_mol_complexSP->catchF == 0) continue;
69
/** Number of atoms in a macromolecular complex: **/
70
atomsN = curr_mol_complexSP->atomsN;
72
/** Scan all atoms in the current complex: **/
73
for (atomI = 0; atomI < atomsN; atomI++)
75
/** Pointer to the current atom: **/
76
curr_atomSP = curr_mol_complexSP->atomSP + atomI;
78
/** Pointer to the current residue: **/
79
curr_residueSP = mol_complexSP->residueSP +
80
curr_atomSP->residue_arrayI;
82
/** Prepare the cis_transF: **/
83
curr_cis_transF = curr_residueSP->cis_transF;
85
/** Prepare the conformation flag: **/
87
if (curr_cis_transF == input_cis_transF) conformationF = 1;
89
/** Set the selection flag for the current atom: **/
90
switch (selection_modeI)
92
/*** Overwrite the previous selection: ***/
94
curr_atomSP->selectedF = conformationF;
97
/*** Restrict the previous selection: ***/
99
curr_atomSP->selectedF &= conformationF;
102
/*** Expand the previous selection: ***/
104
curr_atomSP->selectedF |= conformationF;
111
/** Check the selection flag; increase **/
112
/** the count if flag is equal to one: **/
113
if (curr_atomSP->selectedF) selected_atomsN++;
116
/** Update the position_changedF (some atoms may have bad color): **/
117
curr_mol_complexSP->position_changedF = 1;
120
/* Return the number of selected atoms: */
121
return selected_atomsN;
124
/*===========================================================================*/