ccp4srs  Version 1.0.0
ccp4srs_chem.h
Go to the documentation of this file.
1 // $Id: ccp4srs_chem.h $
2 // =================================================================
3 //
4 // CCP4 SRS Library: Storage, Retrieval and Search support for
5 // CCP4 ligand data.
6 //
7 // Copyright (C) Eugene Krissinel 2010-2013.
8 //
9 // This library is free software: you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License version 3, modified in accordance with the provisions
12 // of the license to address the requirements of UK law.
13 //
14 // You should have received a copy of the modified GNU Lesser
15 // General Public License along with this library. If not, copies
16 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // =================================================================
24 //
25 // 18.09.13 <-- Date of Last Modification.
26 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 // -----------------------------------------------------------------
28 //
29 // **** Module : ccp4srs_chem <interface>
30 // ~~~~~~~~~
31 // **** Classes : ccp4srs::Chem - SRS chemistry manager class
32 // ~~~~~~~~~
33 //
34 // (C) E. Krissinel 2010-2013
35 //
36 // =================================================================
37 //
38 
39 #ifndef CCP4SRS_CHEM_H
40 #define CCP4SRS_CHEM_H
41 
42 #include "ccp4srs_base.h"
43 #include "ccp4srs_types.h"
44 
45 namespace ccp4srs {
46 
47  // ==================================================================
48 
49  DefineClass(Chem);
50 
51  class Chem : public Base {
52 
53  public:
54  Chem ();
55  ~Chem();
56 
57  CCP4SRS_RC getEnergyTypes ( mmdb::PResidue R,
58  mmdb::io::PFile structFile );
59  CCP4SRS_RC getEnergyTypes ( mmdb::PPResidue R, int nRes,
60  mmdb::io::PFile structFile );
61  CCP4SRS_RC getEnergyTypes ( mmdb::PChain chain,
62  mmdb::io::PFile structFile );
63  CCP4SRS_RC getEnergyTypes ( mmdb::PModel model,
64  mmdb::io::PFile structFile );
65  CCP4SRS_RC getEnergyTypes ( mmdb::PManager MMDB,
66  mmdb::io::PFile structFile );
67 
68  CCP4SRS_RC addHydrogens ( mmdb::PResidue R,
69  mmdb::io::PFile structFile );
70  CCP4SRS_RC addHydrogens ( mmdb::PChain chain,
71  mmdb::io::PFile structFile );
72  CCP4SRS_RC addHydrogens ( mmdb::PModel model,
73  mmdb::io::PFile structFile );
74  CCP4SRS_RC addHydrogens ( mmdb::PManager MMDB,
75  mmdb::io::PFile structFile );
76 
77 
78  // MakeBonds(..) makes bonds between atoms in MMDB's residue R
79  // from data found in SBase. Residue R must be associated with
80  // coordinate hierarchy. Data is retrieved from SBase on the basis
81  // of residue name only. In case of multiple conformations, if
82  // altLoc:
83  // NULL - the highest occupancy atom will be taken
84  // if all occupancies are equal then atom with
85  // first altLoc taken
86  // other - atoms with given altLoc are taken. If such
87  // altLoc is not found, the function does as if
88  // NULL value for altLoc is given.
89  // If selHandles is not NULL, the function also selects atoms
90  // in the residue according to their hydrogen bond attributes.
91  // This is a special option for hydrogen bond calculations
92  // If ignoreNegSigOcc is set True then the function will ignore
93  // atoms with negative occupancy standard deviation. Such atoms
94  // may be hydrogens added by CSBase0::AddHydrogen(..) function,
95  // in general any atoms added by CSBAtom::MakeCAtom(..) function.
96  // Added hydrogens may be ignored if MakeBonds is used in
97  // CSbase::CalcHBonds(..) function.
98  // Return:
99  // SBASE_Ok success
100  // SBASE_FileNotFound non-initiated SBase
101  // SBASE_StructNotFound the residue's name is not found
102  // in SBase
103  // SBASE_EmptyResidue residue R does not contain atoms
104  // SBASE_NoAtomsFound SBase entry does not contain atoms
105  // SBASE_BrokenBonds some bonds could not be set up because
106  // of missing atoms in R. This could be
107  // a result of residue R named wrongly.
108  CCP4SRS_RC makeBonds ( mmdb::PResidue R,
109  mmdb::pstr altLoc,
110  mmdb::io::PFile structFile,
111  PDASelHnds selHandles,
112  bool ignoreNegSigOcc );
113 
114  // CalcHBonds(..) calculates hydrogen bonds and salt bridges
115  // between atoms of residues given in Res1[0..nres1-1] and
116  // Res2[0..nres2-1]. H-bonds are returned in HBond[0..nHBonds-1]
117  // and salt bridges are returned in SBridge[0..nSBridges-1].
118  //
119  // On input:
120  // Res1, Res2 must belong to the same MMDB
121  // HBond, SBridge should be set NULL, otherwise the
122  // function attempts to deallocate them
123  // nHBonds, nSBridges ignored
124  // structFile may be a pointer to open SBase stucture
125  // file in order to save on file open
126  // operation. If structFile is set NULL,
127  // the function will open the SBase
128  // structure file by itself
129  // altLoc specifies the alternative location for
130  // donors and acceptors.
131  // altLoc==NULL the highest occupancy
132  // atoms are taken. If all
133  // occupancies are equal
134  // equal then atom with
135  // first altLoc taken
136  // altLoc!=NULL atoms with given altLoc
137  // are taken. If such
138  // altLoc is not found,
139  // the function acts as
140  // if NULL value for altLoc
141  // were given.
142  // ignoreNegSigOcc if it is set True, then the function
143  // ignores atoms with negative occupancy
144  // standard deviation. Such atoms may be
145  // hydrogens added by addHydrogen(..)
146  // function, or, in general, any atoms added
147  // by CCP4SRSAtom::MakeCAtom(..) function.
148  // Such added hydrogens are not guaranteed to
149  // be in correct place, therefore the
150  // function may mistake on some hydrogen
151  // bonds if they are not neglected.
152  //
153  // On output:
154  // Allocated arrays HBond[0..nHBonds-1] and
155  // SBridge[0..nSBridges-1]. If no bonds/bridges were found,
156  // the corresponding array is not allocated and set NULL.
157  // Application is responsible for deallocation of the arrays,
158  // when not needed, using statements
159  // if (HBond) delete[] HBond;
160  // if (SBridge) delete[] SBridge;
161  // HBond[i].a1, SBridge[i].a1 always refer atom from Res1[],
162  // and HBond[i].a2, SBridge[i].a2 always refer atom from
163  // Res2[].
164  //
165  CCP4SRS_RC CalcHBonds ( mmdb::PPResidue Res1, int nres1,
166  mmdb::PPResidue Res2, int nres2,
167  RPAtomPair HBond, int & nHBonds,
168  RPAtomPair SBridge, int & nSBridges,
169  mmdb::io::PFile structFile=NULL,
170  mmdb::pstr altLoc=NULL,
171  bool ignoreNegSigOcc=false );
172 
173  protected:
174  // Geometry parameters for H-bond calculations
177 
178  void init_chem();
179 
180  };
181 
182 } // namespace ccp4srs
183 
184 #endif // CCP4SRS_CHEM_H
CCP4SRS_RC makeBonds(mmdb::PResidue R, mmdb::pstr altLoc, mmdb::io::PFile structFile, PDASelHnds selHandles, bool ignoreNegSigOcc)
Definition: ccp4srs_chem.cpp:399
mmdb::realtype maxDAdist
Definition: ccp4srs_chem.h:175
DefineClass(Angle)
CCP4SRS_RC CalcHBonds(mmdb::PPResidue Res1, int nres1, mmdb::PPResidue Res2, int nres2, RPAtomPair HBond, int &nHBonds, RPAtomPair SBridge, int &nSBridges, mmdb::io::PFile structFile=NULL, mmdb::pstr altLoc=NULL, bool ignoreNegSigOcc=false)
Definition: ccp4srs_chem.cpp:549
~Chem()
Definition: ccp4srs_chem.cpp:50
mmdb::realtype maxSBdist
Definition: ccp4srs_chem.h:175
mmdb::realtype minDAdist
Definition: ccp4srs_chem.h:175
mmdb::realtype maxDHAcos
Definition: ccp4srs_chem.h:176
CCP4SRS_RC
Definition: ccp4srs_types.h:55
mmdb::realtype maxDDAcos
Definition: ccp4srs_chem.h:176
Definition: ccp4srs_base.h:51
CCP4SRS_RC getEnergyTypes(mmdb::PResidue R, mmdb::io::PFile structFile)
Definition: ccp4srs_chem.cpp:66
mmdb::realtype maxHAdist2
Definition: ccp4srs_chem.h:175
Definition: ccp4srs_angle.cpp:42
CCP4SRS_RC addHydrogens(mmdb::PResidue R, mmdb::io::PFile structFile)
Definition: ccp4srs_chem.cpp:255
Chem()
Definition: ccp4srs_chem.cpp:46
mmdb::realtype maxDAAcos
Definition: ccp4srs_chem.h:176
Definition: ccp4srs_chem.h:51
mmdb::realtype maxHAAcos
Definition: ccp4srs_chem.h:176
void init_chem()
Definition: ccp4srs_chem.cpp:52