1 //  $Id: mmdb_defs.h,v 1.27 2012/01/26 17:52:20 ekr Exp $
2 //  =================================================================
3 //
4 //   CCP4 Coordinate Library: support of coordinate-related
5 //   functionality in protein crystallography applications.
6 //
7 //   Copyright (C) Eugene Krissinel 2000-2018.
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 //    15.03.19   <--  Date of Last Modification.
26 //                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 //  -----------------------------------------------------------------
28 //
29 //  **** Module  :   MMDBF_Defs <interface>
30 //       ~~~~~~~~~
31 //  **** Project :   MacroMolecular Data Base (MMDB)
32 //       ~~~~~~~~~
33 //
34 //      Definition of types, constants and important classes.
35 //
36 //  (C) E. Krissinel 2000-2019
37 //
38 //  =================================================================
39 //
40 
41 #ifndef __MMDB_Defs__
42 #define __MMDB_Defs__
43 
44 #include "mmdb_mattype.h"
45 
46 namespace mmdb  {
47 
48   enum  MMDB_VERSION  {
49     MAJOR_VERSION = 2,  //!< MMDB major version
50     MINOR_VERSION = 0,  //!< MMDB minor version
51     MICRO_VERSION = 20  //!< MMDB micro version
52   };
53 
54   //  =======================  types  =================================
55 
56   typedef  char         IDCode  [16];   //!< ID code of PDB entry
57   typedef  IDCode *     PIDCode;        //!< pointer to ID code
58   typedef  PIDCode &    RPIDCode;       //!< ref. to pointer to ID code
59   typedef  char         Date    [12];   //!< date DD-MMM-YYYY
60   typedef  char         RecName [7];    //!< name of PDB record
61 
62   typedef  char         ChainID [10];   //!< chain ID
63   typedef  ChainID *    PChainID;       //!< pointer to chain ID
64   typedef  char         InsCode [10];   //!< insertion code
65   typedef  char         DBName  [10];   //!< sequence database name
66   typedef  char         DBAcCode[20];   //!< seq. database accession code
67   typedef  DBAcCode *   PDBAcCode;      //!< pointer to seq. db acc code
68   typedef  char         DBIdCode[20];   //!< seq. database ident-n code
69   typedef  DBIdCode *   PDBIdCode;      //!< pointer to DBIdCode
70   typedef  char         ResName [20];   //!< residue name
71   typedef  ResName  *   PResName;       //!< pointer to residue name
72   typedef  PResName *   PPResName;      //!< ptr to vector of residue names
73   typedef  char         HelixID [20];   //!< helix ID
74   typedef  char         StrandID[20];   //!< strand ID
75   typedef  char         SheetID [20];   //!< sheet ID
76   typedef  char         TurnID  [20];   //!< turn ID
77   typedef  char         LinkRID [20];   //!< Refmac link ID
78 
79   typedef  char         SymGroup[100];  //!< group of space symmetry
80   typedef  realtype     vect3   [3];    //!< vector of 3 real numbers
81   typedef  vect3    *   pvect3;         //!< ptr to vector 3
82   typedef  pvect3   &   rpvect3;        //!< ref to ptr to vector 3
83   typedef  realtype     vect4   [4];    //!< vector of 4 real numbers
84   typedef  vect3        mat33   [3];    //!< matrix 3x3 of real numbers
85 
86   typedef  vect4        mat44   [4];    //!< matrix 4x4 of real numbers
87   typedef  mat44    *   pmat44;         //!< ptr to matrix 4x4
88   typedef  mat44    &   rmat44;         //!< ref to matrix 4x4
89   typedef  pmat44   *   ppmat44;        //!< ptr to ptr to matrix 4x4
90   typedef  pmat44   &   rpmat44;        //!< ref to ptr to matrix 4x4
91   typedef  mat33        mat633  [6];    //!< matrix 6x3x3 of real numbers
92 
93   typedef  char         AtomName[20];   //!< name of the atom
94   typedef  AtomName *   PAtomName;      //!< pointer to atom name
95   typedef  char         AltLoc  [20];   //!< alternate location indicator
96   typedef  AltLoc   *   PAltLoc;        //!< pointer to alt loc indicator
97   typedef  char         SegID   [20];   //!< segment identifier
98   typedef  char         Element [10];   //!< chemical element name
99   typedef  Element  *   PElement;       //!< ptr to chemical element name
100   typedef  char         EnergyType[10]; //!< energy type name
101   typedef  EnergyType * PEnergyType;    //!< pointer to energy type name
102 
103   // do not forget update this when change the above typedefs:
104   typedef  char  maxMMDBName[40];
105 
106 
107   //  =====================  constants  ===============================
108 
109   //   ANY_RES should be used in selection functions for specifying
110   // "any residue" to select. Defined in mmdb_selmngr.cpp
111   extern const int ANY_RES;
112 
113   //    PRNK_XXXXX are the print keys. PRNK_Silent supresses all print
114   // inside mmdb_xxxx unless specifically ordered or catastrophic.
115   // PRNK_SimRWBROOK instructs mmdb to issue, whenever possible and
116   // necessary, printouts and warnings of RWBROOK (fortran) package.
117   enum PRINT_KEY  {
118     PRNK_Silent      = 0,
119     PRNK_SimRWBROOK  = 1
120   };
121 
122   //  Error_XXXX may be returned by XX::ConvertPDBString() and GetCIF(..)
123   // functions.
124   //  Error_WrongSection is returned if the string passed into function
125   // does not belong to the corresponding PDB section.
126 
127 
128   enum ERROR_CODE  {
129 
130     Error_EmptyCIF     =-1,  //!< used as signal at reading CIF files
131 
132     Error_NoError      = 0,
133     Error_Ok           = 0,
134     Error_WrongSection = 1,
135     Error_WrongChainID = 2,
136     Error_WrongEntryID = 3,
137 
138     //  Error_SEQRES_serNum is returned by CSeqRes::ConvertPDBASCII() if
139     //  serial numbers of SEQRES records do not increment by 1
140     Error_SEQRES_serNum = 4,
141 
142     //  Error_SEQRES_numRes is returned by CSeqRes::ConvertPDBASCII() if
143     //  SEQRES records show different number of residues
144     Error_SEQRES_numRes = 5,
145 
146     //  Error_SEQRES_extraRes is returned by CSeqRes::ConvertPDBASCII() if
147     //  SEQRES contains more residues than specified
148     Error_SEQRES_extraRes = 6,
149 
150     Error_NCSM_Unrecognized   = 7,
151     Error_NCSM_AlreadySet     = 8,
152     Error_NCSM_WrongSerial    = 9,
153     Error_NCSM_UnmatchIG      = 10,
154 
155     Error_ATOM_Unrecognized   = 11,
156     Error_ATOM_AlreadySet     = 12,
157     Error_ATOM_NoResidue      = 13,
158     Error_ATOM_Unmatch        = 14,
159 
160     Error_CantOpenFile        = 15,
161     Error_UnrecognizedInteger = 16,
162     Error_WrongModelNo        = 17,
163     Error_DuplicatedModel     = 18,
164     Error_NoModel             = 19,
165     Error_ForeignFile         = 20,
166     Error_WrongEdition        = 21,
167 
168     //  CIF specific
169     Error_NotACIFFile         = 22,
170     Error_NoData              = 23,
171     Error_NoLoop              = 24,
172     Error_NoStruct            = 25,
173     Error_UnrecognCIFItems    = 26,
174     Error_MissingCIFField     = 27,
175     Error_EmptyCIFLoop        = 28,
176     Error_EmptyCIFStruct      = 29,
177     Error_UnexpEndOfCIF       = 30,
178     Error_MissgCIFLoopField   = 31,
179     Error_NotACIFStructure    = 32,
180     Error_NotACIFLoop         = 33,
181     Error_UnrecognizedReal    = 34,
182 
183     Error_NoSheetID           = 35,
184     Error_WrongSheetID        = 36,
185     Error_WrongStrandNo       = 37,
186 
187     //   Error_WrongNumberOfStrands may be issued when reading
188     // sheet data from CIF
189     Error_WrongNumberOfStrands = 38,
190 
191     //   Error_WrongSheetOrder may be issued when reading
192     // sheet data from CIF
193     Error_WrongSheetOrder      = 39,
194 
195     //   Error_HBondInconsistency may be issued when reading
196     // sheet data from CIF
197     Error_HBondInconsistency   = 40,
198 
199     //   Error_EmptyResidueName is issued when PDB ATOM record
200     // does not have a residue name
201     Error_EmptyResidueName     = 41,
202 
203     //   Error_DuplicateSeqNum is issued when PDB ATOM records
204     // show the sequence number and insertion code assigned
205     // to more than one residue name
206     Error_DuplicateSeqNum      = 42,
207 
208     //   Error_NoLogicalName may be returned by file i/o functions
209     // if the specified environmental variable for file name
210     // is not found.
211     Error_NoLogicalName        = 43,
212 
213     //   Error_EmptyFile may be returned at reading non-existing
214     // coordinate files
215     Error_EmptyFile            = 44,
216 
217     Error_Unknown              = 45,
218 
219     //   Error_CIF_EmptyRow is the event of encountering
220     // an empty row in _atom_site loop. It is handled
221     // internally and has no effect on API
222     Error_CIF_EmptyRow      = 99999,
223 
224     Error_GeneralError1     = 10000
225 
226   };
227 
228   //  ClassID_XXXX are used by container classes for proper
229   // creating containered classes when reading from binary file.
230 
231   enum CLASS_ID {
232     ClassID_Template   ,
233     ClassID_String     ,
234     ClassID_ObsLine    ,
235     ClassID_TitleLine  ,
236     ClassID_CAVEAT     ,
237     ClassID_Compound   ,
238     ClassID_Source     ,
239     ClassID_ExpData    ,
240     ClassID_MdlType    ,
241     ClassID_Author     ,
242     ClassID_RevData    ,
243     ClassID_Supersede  ,
244     ClassID_Journal    ,
245     ClassID_Remark     ,
246     ClassID_DBReference,
247     ClassID_SeqAdv     ,
248     ClassID_ModRes     ,
249     ClassID_Het        ,
250     ClassID_NCSMatrix  ,
251     ClassID_TVect      ,
252     ClassID_Helix      ,
253     ClassID_Turn       ,
254     ClassID_Link       ,
255     ClassID_LinkR      ,
256     ClassID_CisPep
257   };
258 
259 
260   //  =====================  classes  ===============================
261 
262   DefineClass(Atom);
263   DefineClass(Residue);
264   DefineClass(Chain);
265   DefineClass(Model);
266   DefineClass(Manager);
267 
268 }  // namespace mmdb
269 
270 #endif
271