00001 // $Id: mmdb_rwbrook.h $ 00002 // ================================================================= 00003 // 00004 // CCP4 Coordinate Library: support of coordinate-related 00005 // functionality in protein crystallography applications. 00006 // 00007 // Copyright (C) Eugene Krissinel 2000-2008. 00008 // 00009 // This library is free software: you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License version 3, modified in accordance with the provisions 00012 // of the license to address the requirements of UK law. 00013 // 00014 // You should have received a copy of the modified GNU Lesser 00015 // General Public License along with this library. If not, copies 00016 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU Lesser General Public License for more details. 00022 // 00023 // ================================================================= 00024 // 00025 // 16.09.13 <-- Date of Last Modification. 00026 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00027 // ----------------------------------------------------------------- 00028 // 00029 // **** Module : MMDB_RWBrook <interface> 00030 // ~~~~~~~~~ 00031 // **** Project : MacroMolecular Data Base (MMDB), "new rwbrook" 00032 // ~~~~~~~~~ 00033 // **** Functions : mmdb_f_init_ ( initializer ) 00034 // ~~~~~~~~~~~ mmdb_f_quit_ ( disposer ) 00035 // autoserials_ ( switch to the autoserials regime ) 00036 // setreadcoords_ ( switch for reading coordinates ) 00037 // simrwbrook_ ( simulates old RWBROOK printout ) 00038 // mmdb_f_openl_ ( associates a unit with a file ) 00039 // mmdb_f_open_ ( associates a unit with a file ) 00040 // mmdb_f_copy_ ( copies contents of units ) 00041 // mmdb_f_delete_ ( deletes part of a unit ) 00042 // mmdb_f_settype_ ( changes type of file and r/w mode ) 00043 // mmdb_f_setname_ ( changes file name ) 00044 // mmdb_f_write_ ( writes a data structure into file ) 00045 // mmdb_f_close_ ( closes and disposes a data str-re ) 00046 // mmdb_f_advance_ ( advances the internal pointer ) 00047 // mmdb_f_rewd_ ( sets internal pointer on the top ) 00048 // mmdb_f_bksp_ ( shifts int-l pointer 1 atom back ) 00049 // mmdb_f_atom_ ( reads/writes atom properties ) 00050 // mmdb_f_coord_ ( reads/writes atom coordinates ) 00051 // mmdb_f_setcell_ ( sets the crystal cell parameters ) 00052 // mmdb_f_wbspgrp_ ( sets the space group ) 00053 // mmdb_f_rbspgrp_ ( gets the space group ) 00054 // mmdb_f_wbcell_ ( sets the crystal cell parameters ) 00055 // mmdb_f_rbcell_ ( gets the crystal cell parameters ) 00056 // mmdb_f_rbcelln_ ( gets the crystal cell parameters ) 00057 // mmdb_f_rbrcel_ ( gets the recipricol cell ) 00058 // mmdb_f_rborf_ ( returns or fill transf. matrices ) 00059 // mmdb_f_orthmat_ ( calc. standard othogonalisations ) 00060 // mmdb_f_cvanisou_ ( converts between cryst-c units ) 00061 // mmdb_f_wremark_ ( writes a remark statement ) 00062 // mmdb_f_setter 00063 // mmdb_f_sethet 00064 // rberrstop_ ( error messenger ) 00065 // rbcheckerr_ ( a simple error messenger ) 00066 // 00067 // (C) E. Krissinel 2000-2013 00068 // 00069 // ================================================================= 00070 // 00071 00072 00073 #ifndef __MMDB_RWBrook__ 00074 #define __MMDB_RWBrook__ 00075 00076 #include "mmdb_mattype.h" 00077 #include "mmdb_machine_.h" 00078 00079 00080 // ****** mmdb_rwbrook error codes 00081 00082 enum RWB_ERROR { 00083 00084 RWBERR_Ok = 0, 00085 RWBERR_NoChannel = -1, 00086 RWBERR_NoFile = -2, 00087 RWBERR_NoLogicalName = -3, 00088 00089 RWBERR_CantOpenFile = -4, 00090 RWBERR_WrongInteger = -5, 00091 RWBERR_WrongModelNo = -6, 00092 RWBERR_DuplicatedModel = -7, 00093 RWBERR_ForeignFile = -8, 00094 RWBERR_WrongEdition = -9, 00095 00096 RWBERR_ATOM_Unrecognd = -10, 00097 RWBERR_ATOM_AlreadySet = -11, 00098 RWBERR_ATOM_NoResidue = -12, 00099 RWBERR_ATOM_Unmatch = -13, 00100 00101 RWBERR_NoAdvance = -14, 00102 RWBERR_EmptyPointer = -15, 00103 RWBERR_NoMatrices = -16, 00104 00105 RWBERR_NoCoordinates = -17, 00106 00107 RWBERR_Disagreement = -18, 00108 RWBERR_NoOrthCode = -19, 00109 RWBERR_NoCheck = -20, 00110 00111 RWBERR_NoCellParams = -21, 00112 00113 RWBERR_NotACIFFile = -22, 00114 RWBERR_NoData = -23, 00115 RWBERR_UnrecognCIFItems = -24, 00116 RWBERR_MissingCIFField = -25, 00117 RWBERR_EmptyCIFLoop = -26, 00118 RWBERR_UnexpEndOfCIF = -27, 00119 RWBERR_MissgCIFLoopField = -28, 00120 RWBERR_NotACIFStructure = -29, 00121 RWBERR_NotACIFLoop = -30, 00122 RWBERR_WrongReal = -31, 00123 00124 RWBERR_WrongChainID = -32, 00125 RWBERR_WrongEntryID = -33, 00126 RWBERR_SEQRES_serNum = -34, 00127 RWBERR_SEQRES_numRes = -35, 00128 RWBERR_SEQRES_exraRes = -36, 00129 RWBERR_NCSM_Unrecogn = -37, 00130 RWBERR_NCSM_AlreadySet = -38, 00131 RWBERR_NCSM_WrongSerial = -39, 00132 RWBERR_NCSM_UnmatchIG = -40, 00133 RWBERR_NoModel = -41, 00134 RWBERR_NoSheetID = -42, 00135 RWBERR_WrongSheetID = -43, 00136 RWBERR_WrongStrandNo = -44, 00137 RWBERR_WrongNofStrands = -45, 00138 RWBERR_WrongSheetOrder = -46, 00139 RWBERR_HBondInconsis = -47, 00140 RWBERR_EmptyResidueName = -48, 00141 RWBERR_DuplicateSeqNum = -49, 00142 RWBERR_GeneralError1 = -50, 00143 00144 RWBERR_Error1 = -101, 00145 RWBERR_Error2 = -102, 00146 RWBERR_Error3 = -103 00147 00148 }; 00149 00150 // ***** mmdb_rwbrook warning flags 00151 // 0x00004000 means "it's a warning" 00152 00153 enum RWB_WARNING { 00154 RWBWAR_Warning = 0x00004000, 00155 RWBWAR_RewOutput = 0x00004010, 00156 RWBWAR_FileTop = 0x00004020, 00157 RWBWAR_WrongSerial = 0x00004040, 00158 RWBWAR_UnkFormFactor = 0x00004080, 00159 RWBWAR_AmbFormFactor = 0x00004100, 00160 RWBWAR_NoOccupancy = 0x00004200, 00161 RWBWAR_NoTempFactor = 0x00004400 00162 }; 00163 00164 // ------------------------------------------------------------------ 00165 00166 // mmdb_f_init_() makes a general initialization of the file system. 00167 // It must be called ONLY ONCE from the top of an application. 00168 00169 // FORTRAN equivalent: subroutine MMDB_F_Init 00170 // ~~~~~~~~~~~~~~~~~~~ 00171 00172 FORTRAN_SUBR ( MMDB_F_INIT, mmdb_f_init, (),(),() ); 00173 00174 00175 // ------------------------------------------------------------------ 00176 00177 // mmdb_f_quit_() disposes the file system. A correct use assumes that 00178 // it will be called before an application quits. 00179 00180 // FORTRAN equivalent: subroutine MMDB_F_Quit 00181 // ~~~~~~~~~~~~~~~~~~~ 00182 00183 FORTRAN_SUBR ( MMDB_F_QUIT, mmdb_f_quit, (),(),() ); 00184 00185 00186 // ------------------------------------------------------------------ 00187 00188 // autoserials_(..) switches On/Off the regime of automatical 00189 // generation of atom serial numbers at reading from PDB ASCII file. 00190 // The autoserials regime is On if iOnOff parameter is set to 00191 // non-zero, and the regime is turned Off otherwise. The setting 00192 // will last until next call to autoserials_(..) 00193 // 00194 // When this regime is Off (default state), all atom serial 00195 // numbers are expected to be in strictly incremental order and 00196 // any deviation from this rule will cause end of reading and 00197 // MMDB_F_Open_(..) will issue the RWBERR_AlreadySet error code. If 00198 // this code is then passed to error messengers (rberrstop_(..) or 00199 // rbcheckerr_(..)) the application will stop. It is Ok, however, 00200 // for serial numbers to increment by 2 or more. 00201 // 00202 // When the autoserials regime is On, MMDB_F_Open_(..) does not pay 00203 // attention to the serial numbers and generates them for each 00204 // atom in strict incremental-by-one. This will work correctly only 00205 // if all atom records ("ATOM"/"HETATM", "SIGATM", "ANISOU" and 00206 // "SIGUIJ") are grouped, for every atom, as they should (precisely, 00207 // "ATOM" or "HETATM" opens the group, then "SIGATM", "ANISOU" and 00208 // "SIGUIJ" should follow until next "ATOM"/"HETATM" is met). 00209 00210 // FORTRAN equivalent: subroutine AutoSerials ( iOnOff ) 00211 // ~~~~~~~~~~~~~~~~~~~ integer iOnOff 00212 00213 FORTRAN_SUBR ( AUTOSERIALS,autoserials, 00214 ( int * iOnOff ), 00215 ( int * iOnOff ), 00216 ( int * iOnOff ) ); 00217 00218 00219 // ------------------------------------------------------------------ 00220 00221 // setreadcoords_(..) switches On/Off the reading of atomic 00222 // coordinates when mmdb_f_open_ is called for input. The coordinates 00223 // will be read if iOnOff parameter is set to non-zero, otherwise 00224 // the reading will stop on the coordinate section of PDB file. 00225 // The setting will last until the next call to setreadcoords_(..). 00226 // 00227 // By default, the coordinates are read. 00228 // 00229 // FORTRAN equivalent: subroutine SetReadCoords ( iOnOff ) 00230 // ~~~~~~~~~~~~~~~~~~~ integer iOnOff 00231 00232 FORTRAN_SUBR ( SETREADCOORDS,setreadcoords, 00233 ( int * iOnOff ), 00234 ( int * iOnOff ), 00235 ( int * iOnOff ) ); 00236 00237 00238 // ------------------------------------------------------------------ 00239 00240 // simrwbrook_(..) switches On/Off the regime of exact following 00241 // the old fortran RWBROOK's way of issuing messages and warnings. 00242 // 00243 // By default, this regime is switched off, which supresses all 00244 // messages from mmdb_rwbrook unless directly ordered or catastrophic. 00245 // Switching this regime on will make the printout of converted 00246 // programs significantly closer to that resulting from the use of 00247 // old fortran RWBROOK package. The setting will last until the 00248 // next call to simrwbrook_(..). 00249 // 00250 // FORTRAN equivalent: subroutine SimRWBROOK ( iOnOff ) 00251 // ~~~~~~~~~~~~~~~~~~~ integer iOnOff 00252 00253 FORTRAN_SUBR ( SIMRWBROOK,simrwbrook, 00254 ( int * iOnOff ), 00255 ( int * iOnOff ), 00256 ( int * iOnOff ) ); 00257 00258 00259 // ------------------------------------------------------------------ 00260 00261 // mmdb_f_open_(..) associates a coordinate file with channel number 00262 // given in iUnit. If iUnit was previously associated with another 00263 // or the same file, the file gets complete logical reinitialization 00264 // which means that all previous modifications to the file are lost 00265 // unless stored on disk with mmdb_f_write_(..) or mmdb_f_close_(..). 00266 // 00267 // If the file is to be opened for input (RWStat is set to 00268 // "INPUT"), all contents of the file is read into memory. It may be 00269 // then modified and written back into a file (same or different). 00270 // 00271 // If the file is to be opened for output (RWStat is set to 00272 // "OUTPUT"), no file is physically opened, and only empty data 00273 // structure is created in the memory. It may then be added with the 00274 // data and stored in a disk file. 00275 // 00276 // If FType is set to "PDB" or " ", the physical file is assumed 00277 // to be read or written in the PDB format. "CIF" option is reserved 00278 // for mmCIF files and is not realized at present. "BIN" means 00279 // binary format. Note that both file name and file type may be 00280 // changed before writting the file (see mmdb_f_setname_(..) and 00281 // mmdb_f_settype_(..)). 00282 // 00283 // mmdb_f_open(..) sets an internal pointer to "before the first" 00284 // atom in the file (therefore it should be advanced to get access 00285 // to the first atom, see mmdb_f_advance1_(..)). This pointer is used 00286 // for getting atomic coordinates and other atomic characteristics 00287 // from the file structure or for storing them into the structure. 00288 // The pointer may be advanced, backspaced or set to a specific 00289 // position in the file structure (see below). 00290 // 00291 // iRet returns the error code (defined above). Extended 00292 // information on the error may be then obtained through the 00293 // geterror_(..) function immediately after return from 00294 // mmdb_f_open_(..). 00295 00296 // FORTRAN equivalent: subroutine MMDB_F_Open ( LName,RWStat,FType, 00297 // ~~~~~~~~~~~~~~~~~~~ iUnit,iRet ) 00298 // character*(*) LName,RWStat,FType 00299 // integer iUnit,iRet 00300 00301 FORTRAN_SUBR ( MMDB_F_OPEN, mmdb_f_open, 00302 ( // lengths-at-end list 00303 mmdb::machine::fpstr LName, // logical name 00304 mmdb::machine::fpstr RWStat, // "INPUT" or "OUTPUT" 00305 mmdb::machine::fpstr FType, // "PDB", "CIF", "BIN" or " " 00306 int * iUnit, // channel number 00307 int * iRet, // returns error code 00308 int LName_len, // fortran-hidden length of LName 00309 int RWStat_len, // fortran-hidden length of RWStat 00310 int FType_len // fortran-hidden length of FType 00311 ), ( // lengths-in-structure list 00312 mmdb::machine::fpstr LName, 00313 mmdb::machine::fpstr RWStat, 00314 mmdb::machine::fpstr FType, 00315 int * iUnit, int * iRet 00316 ), ( // lengths-follow list 00317 mmdb::machine::fpstr LName, int LName_len, 00318 mmdb::machine::fpstr RWStat, int RWStat_len, 00319 mmdb::machine::fpstr FType, int FType_len, 00320 int * iUnit, int * iRet 00321 ) ); 00322 00323 00324 00325 // ------------------------------------------------------------------ 00326 00327 // mmdb_f_open1_(..) is equivalent to mmdb_f_open_(..) but takes directly 00328 // the file name (FName) instead of logical name (LName). 00329 // 00330 // FORTRAN equivalent: subroutine MMDB_F_Open1 ( FName,RWStat,FType, 00331 // ~~~~~~~~~~~~~~~~~~~ iUnit,iRet ) 00332 // character*(*) FName,RWStat,FType 00333 // integer iUnit,iRet 00334 00335 FORTRAN_SUBR ( MMDB_F_OPEN1, mmdb_f_open1, 00336 ( // lengths-at-end list 00337 mmdb::machine::fpstr FName, // file name 00338 mmdb::machine::fpstr RWStat, // "INPUT" or "OUTPUT" 00339 mmdb::machine::fpstr FType, // "PDB", "CIF", "BIN" or " " 00340 int * iUnit, // channel number 00341 int * iRet, // returns error code 00342 int FName_len, // fortran-hidden length of FName 00343 int RWStat_len, // fortran-hidden length of RWStat 00344 int FType_len // fortran-hidden length of FType 00345 ), ( // lengths-in-structure list 00346 mmdb::machine::fpstr FName, 00347 mmdb::machine::fpstr RWStat, 00348 mmdb::machine::fpstr FType, 00349 int * iUnit, int * iRet 00350 ), ( // lengths-follow list 00351 mmdb::machine::fpstr FName, int FName_len, 00352 mmdb::machine::fpstr RWStat, int RWStat_len, 00353 mmdb::machine::fpstr FType, int FType_len, 00354 int * iUnit, int * iRet 00355 ) ); 00356 00357 00358 00359 // ------------------------------------------------------------------ 00360 00361 // mmdb_f_copy_(..) copies the specified part(s) of iUnit2 into iUnit1. 00362 // All data which contained in the corresponding part(s) of iUnit1 00363 // before the copying, is destroyed. 00364 // 00365 // FORTRAN equivalent: subroutine MMDB_F_Copy ( iUnit1,iUnit2, 00366 // ~~~~~~~~~~~~~~~~~~~ copyKey,iRet ) 00367 // integer iUnit1,iUnit2,copyKey,iRet 00368 00369 FORTRAN_SUBR ( MMDB_F_COPY, mmdb_f_copy, 00370 ( // lengths-at-end list 00371 int * iUnit1, // destination unit 00372 int * iUnit2, // source unit 00373 int * copyKey, // copy key: 00374 // = 1 copy all 00375 // = 2 copy all except coordinates 00376 // = 3 copy title section only 00377 // = 4 copy crystallographic 00378 // section only 00379 // = 5 copy coordinate section only 00380 // any other value does not do anything 00381 int * iRet // return code: 00382 // =0 if success 00383 // =RWBERR_NoChannel if a unit 00384 // does not exist 00385 // =RWBERR_NoFile if a unit 00386 // was not opened 00387 ), ( // lengths-in-structure list 00388 int * iUnit1, int * iUnit2, 00389 int * copyKey, int * iRet 00390 ), ( // lengths-follow list 00391 int * iUnit1, int * iUnit2, 00392 int * copyKey, int * iRet 00393 ) ); 00394 00395 00396 00397 // ------------------------------------------------------------------ 00398 00399 // mmdb_f_delete_(..) deletes the specified parts of iUnit-th unit. 00400 // The delete keys are exactly the same as copy keys in mmdb_f_copy_(..). 00401 // 00402 // FORTRAN equivalent: subroutine MMDB_F_Delete ( iUnit1,iUnit2, 00403 // ~~~~~~~~~~~~~~~~~~~ CopyAtoms,iRet ) 00404 // integer iUnit1,iUnit2,CopyAtoms,iRet 00405 00406 FORTRAN_SUBR ( MMDB_F_DELETE, mmdb_f_delete, 00407 ( // lengths-at-end list 00408 int * iUnit, // unit number; *iUnit<=0 means 00409 // "the last mentioned unit" 00410 int * delKey, // delete key: 00411 // = 1 delete all 00412 // = 2 delete all except coordinates 00413 // = 3 delete title section only 00414 // = 4 delete crystallographic 00415 // section only 00416 // = 5 delete coordinate section only 00417 // any other value does not do anything 00418 int * iRet // return code: 00419 // =0 if success 00420 // =RWBERR_NoChannel if a unit 00421 // does not exist 00422 // =RWBERR_NoFile if a unit 00423 // was not opened 00424 ), ( // lengths-in-structure list 00425 int * iUnit, int * delKey, int * iRet 00426 ), ( // lengths-follow list 00427 int * iUnit, int * delKey, int * iRet 00428 ) ); 00429 00430 00431 00432 00433 // ------------------------------------------------------------------ 00434 00435 // mmdb_f_settype_(..) changes the type and/or the read/write mode of 00436 // a unit iUnit, previously initialized with mmdb_f_open_(..). The file 00437 // is not read from or purged onto disk, no data change occurs. 00438 // 00439 // iRet returns either RWBERR_NoChannel if the unit was not 00440 // previously initialized by mmdb_f_open_(..), or RWBERR_Ok in the case 00441 // of success. 00442 00443 // FORTRAN equivalent: subroutine MMDB_F_SetType ( iUnit,FType, 00444 // ~~~~~~~~~~~~~~~~~~~ RWState,iRet ) 00445 // character*(*) FType,RWState 00446 // integer iUnit,iRet 00447 00448 FORTRAN_SUBR ( MMDB_F_SETTYPE, mmdb_f_settype, 00449 ( // lengths-at-end list 00450 int * iUnit, // unit number 00451 mmdb::machine::fpstr FType, // "PDB", "CIF", "BIN" or " " 00452 mmdb::machine::fpstr RWStat, // "INPUT" or "OUTPUT" 00453 int * iRet, // returns -1 if unit not found, 00454 // otherwise 0 00455 int FType_len, // fortran-hidden length of FType 00456 int RWStat_len // fortran-hidden length of RWStat 00457 ), ( // lengths-in-structure list 00458 int * iUnit, mmdb::machine::fpstr FType, 00459 mmdb::machine::fpstr RWStat, int * iRet 00460 ), ( // lengths-follow list 00461 int * iUnit, 00462 mmdb::machine::fpstr FType, int FType_len, 00463 mmdb::machine::fpstr RWStat, int RWStat_len, 00464 int * iRet 00465 ) ); 00466 00467 00468 00469 // ------------------------------------------------------------------ 00470 00471 // mmdb_f_setname_(..) changes the file name for a unit iUnit, 00472 // previously initialized with mmdb_f_open_(..). The file is not 00473 // read from or purged onto disk, no data change occurs. 00474 // 00475 // iRet returns either RWBERR_NoChannel if the unit was not 00476 // previously initialized by mmdb_f_open_(..), or RWBERR_Ok in the case 00477 // of success. 00478 00479 // FORTRAN equivalent: subroutine MMDB_F_SetName ( iUnit,FName, 00480 // ~~~~~~~~~~~~~~~~~~~ iRet ) 00481 // character*(*) FName 00482 // integer iUnit,iRet 00483 00484 FORTRAN_SUBR ( MMDB_F_SETNAME, mmdb_f_setname, 00485 ( // lengths-at-end list 00486 int * iUnit, // unit number 00487 mmdb::machine::fpstr FName, // file name 00488 int * iRet, // returns -1 if unit not found, 00489 // otherwise 0 00490 int FName_len // fortran-hidden length of FName 00491 ), ( // lengths-in-structure list 00492 int * iUnit, mmdb::machine::fpstr FName, int * iRet 00493 ), ( // lengths-follow list 00494 int * iUnit, 00495 mmdb::machine::fpstr FName, int FName_len, 00496 int * iRet 00497 ) ); 00498 00499 00500 00501 // ------------------------------------------------------------------ 00502 00503 // mmdb_f_write_(..) writes content of unit iUnit into a disk file. 00504 // iRet will be set to -1 if the unit was not previously opened with 00505 // mmdb_f_open_(..). If writting was successful, iRet is set to 0, 00506 // otherwise geterror(..) will return an information about the 00507 // error occured. 00508 // 00509 // Note that you may write even units associated with input in 00510 // call to mmdb_f_open(..). The file type does not change unless 00511 // explicitely changed with mmdb_f_settype_(..). 00512 00513 // FORTRAN equivalent: subroutine MMDB_F_Write ( iUnit,iRet ) 00514 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00515 00516 FORTRAN_SUBR ( MMDB_F_WRITE, mmdb_f_write, 00517 ( int * iUnit, int * iRet ), 00518 ( int * iUnit, int * iRet ), 00519 ( int * iUnit, int * iRet ) ); 00520 00521 00522 // ------------------------------------------------------------------ 00523 00524 // mmdb_f_close_(..) acts as mmdb_f_write_(..) if unit iUnit has been 00525 // associated with output in mmdb_f_open_(..) or in the call to 00526 // mmdb_f_settype(..). After writing the file, the unit iUnit is 00527 // completely disposed. 00528 // If unit iUnit is associated with input, mmdb_f_close_(..) merely 00529 // disposes it and all the information contained will be lost. 00530 00531 // FORTRAN equivalent: subroutine MMDB_F_Close ( iUnit,iRet ) 00532 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00533 00534 FORTRAN_SUBR ( MMDB_F_CLOSE, mmdb_f_close, 00535 ( int * iUnit, int * iRet ), 00536 ( int * iUnit, int * iRet ), 00537 ( int * iUnit, int * iRet ) ); 00538 00539 00540 // ------------------------------------------------------------------ 00541 00542 // If unit iUnit is associated with input, mmdb_f_advance_(..) sets 00543 // the internal pointer on the next atom in the file. The atom 00544 // properties may then be retrieved using mmdb_f_atom_(..) and 00545 // mmdb_f_coord_(..). If iTer is set to 0, then 'ter' cards are 00546 // completely ignored. If iTer is set to 1, then 'ter' card will 00547 // cause return with iRet=1 with internal pointer left on this 'ter' 00548 // card. iRet=2 mean end of file, and iRet=0 means that the pointer 00549 // was successfully advanced to the next atom. 00550 // 00551 // If unit iUnit is associated with output, mmdb_f_advance_(..) 00552 // merely advances the pointer. No actual change in the data 00553 // structure or on disk occurs. The new position will be filled with 00554 // atom data after execution of mmdb_f_atom_(..) and/or mmdb_f_coord_(..). 00555 // The pointer WILL NOT be advanced if none of these functions were 00556 // called since last advancement, in which case iRet will return 00557 // RWBERR_NoAdvance. After successfull advancement, iRet will 00558 // return 0. 00559 00560 // FORTRAN equivalent: subroutine MMDB_F_Advance ( iUnit,iOut,iTer,iRet ) 00561 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iOut,iTer,iRet 00562 00563 // Relation to the former XYZAdvance fortran subroutione: 00564 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00565 // 00566 // subroutine XYZAdvance ( iUnit,iOut,iTer,*,* ) 00567 // integer iRet 00568 // character*80 ErrLin 00569 // call MMDB_F_Advance ( iUnit,iOut,iTer,iRet ) 00570 // if (iRet.eq.1) return 1 00571 // if (iRet.eq.2) return 2 00572 // if (iRet.eq.RWBERR_NoChannel) then 00573 // ErrLin = ' ERROR: in MMDB_F_ADVANCE file has not been opened' 00574 // call CCPErr ( 1,ErrLin ) 00575 // endif 00576 // return 00577 // end 00578 // 00579 // where parameter iOut IS NOT USED. 00580 00581 FORTRAN_SUBR ( MMDB_F_ADVANCE, mmdb_f_advance, 00582 ( // lengths-at-end list 00583 int * iUnit, // unit number 00584 int * iOut, // output echo file 00585 int * iTer, // FLAG =1, return iRet=1 if 'ter' card found 00586 // =0, do not return on 'ter' card 00587 int * iRet // =0 if normal return 00588 // =1 if return on 'ter' card (iTer=1) 00589 // =2 if return on end of file 00590 // =3 if return on 'hetatm' card 00591 // =RWBERR_NoChannel if unit does not exist 00592 // =RWBERR_NoAdvance if pointer was not 00593 // advanced 00594 ), ( // lengths-in-structure list 00595 int * iUnit, int * iOut, int * iTer, int * iRet 00596 ), ( // lengths-follow list 00597 int * iUnit, int * iOut, int * iTer, int * iRet 00598 ) ); 00599 00600 00601 00602 // ------------------------------------------------------------------ 00603 00604 // mmdb_f_rewd_(..) sets the internal pointer to the "begining" of 00605 // the data structure associated with unit *iUnit. This means that 00606 // one should the "advance" it with mmdb_f_advance_(..) in order 00607 // to get access to the first atom. 00608 // iRet returns RWBERR_NoChannel if iUnit-th unit was not 00609 // initialized, RWBWAR_RewOutput if the unit was associated with 00610 // output, and 0 otherwise. 00611 00612 // FORTRAN equivalent: subroutine MMDB_F_Rewd ( iUnit,iRet ) 00613 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00614 00615 FORTRAN_SUBR ( MMDB_F_REWD, mmdb_f_rewd, 00616 ( int * iUnit, int * iRet ), 00617 ( int * iUnit, int * iRet ), 00618 ( int * iUnit, int * iRet ) ); 00619 00620 00621 00622 // ------------------------------------------------------------------ 00623 00624 // mmdb_f_bksp_(..) shifts the internal pointer for one atom back in 00625 // the data structure associated with unit *iUnit. This means that 00626 // the combination of mmdb_f_advance1_(..) and mmdb_f_bksp_(..) leaves the 00627 // pointer unchanged. 00628 // iRet returns RWBERR_NoChannel if iUnit-th unit was not 00629 // initialized, and sets bit RWBWAR_RewOutput if the unit was 00630 // associated with output, RWBWAR_FileTop if the pointer is already 00631 // on the top of the structure, and 0 otherwise. 00632 00633 // FORTRAN equivalent: subroutine MMDB_F_Bksp ( iUnit,iRet ) 00634 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00635 00636 FORTRAN_SUBR ( MMDB_F_BKSP, mmdb_f_bksp, 00637 ( int * iUnit, int * iRet ), 00638 ( int * iUnit, int * iRet ), 00639 ( int * iUnit, int * iRet ) ); 00640 00641 00642 00643 // ------------------------------------------------------------------ 00644 00645 // mmdb_f_seek_(..) sets the internal pointer to the specified 00646 // position. If fPos==0, *iRet will return bit RWBWAR_FileTop. 00647 // If unit iUnit is associated with input, iRet will return 2 if 00648 // fPos is given a value outside the file range, 1 if a 'ter' card 00649 // is met and 3 if a 'hetatm' card is met. 00650 // iRet returns RWBERR_NoChannel if iUnit-th unit was not 00651 // initialized, and RWBERR_EmptyPointer if fPos-th position in the 00652 // input file is not occupied. 00653 00654 // FORTRAN equivalent: subroutine MMDB_F_Seek ( iUnit,fPos,iRet ) 00655 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,fPos,iRet 00656 00657 FORTRAN_SUBR ( MMDB_F_SEEK, mmdb_f_seek, 00658 ( // lengths-at-end list 00659 int * iUnit, // unit number 00660 int * fPos, // position to set 00661 int * iRet // return code: 00662 // 0 Ok 00663 // 1 'ter' card met 00664 // 2 end of file 00665 // 3 'hetatm' card met 00666 // <0 error: 00667 // RWBERR_NoChannel 00668 // iUnit was not 00669 // initialized 00670 // RWBERR_EmptyPointer 00671 // fPos-th position 00672 ), ( // lengths-in-structure list 00673 int * iUnit, int * fPos, int * iRet 00674 ), ( // lengths-follow list 00675 int * iUnit, int * fPos, int * iRet 00676 ) ); 00677 00678 00679 00680 // ------------------------------------------------------------------ 00681 00682 // mmdb_f_atom_(..) reads or writes the atom name, residue name, 00683 // chain name and other parameters listed from/into the 00684 // data structure associated with the unit number iUnit (cf. 00685 // mmdb_f_open_(..)). The position in the structure is adjusted 00686 // with the help of mmdb_f_advance_(..), mmdb_f_rewd_(..) or 00687 // mmdb_f_bksp_(..). 00688 00689 // FORTRAN equivalent: subroutine MMDB_F_Atom ( iUnit,iSer,AtNam, 00690 // ~~~~~~~~~~~~~~~~~~~ ResNam,ChnNam,iResN,ResNo, 00691 // InsCod,AltCod,SegID,IZ,ID, 00692 // iRet ) 00693 // integer iUnit,iSer,iResN,IZ,iRet 00694 // character*(*) AtNam,ResNam,ChnNam,ResNo 00695 // character*(*) InsCod,AltCod,SegID,ID 00696 00697 FORTRAN_SUBR ( MMDB_F_ATOM, mmdb_f_atom, 00698 ( // lengths-at-end list 00699 int * iUnit, // unit number 00700 int * iSer, // atom serial number 00701 mmdb::machine::fpstr AtNam, // atom name (left justified) 00702 mmdb::machine::fpstr ResNam, // residue name 00703 mmdb::machine::fpstr ChnNam, // chain name 00704 int * iResN, // residue number as an integer 00705 mmdb::machine::fpstr ResNo, // residue number as character (input only) 00706 mmdb::machine::fpstr InsCod, // the insertion code 00707 mmdb::machine::fpstr AltCod, // the alternate conformation code 00708 mmdb::machine::fpstr segID, // segment ID 00709 int * IZ, // atomic number (input only, returned as 00710 // 7 from ambiguous atoms) 00711 mmdb::machine::fpstr ID, // atomic ID related to atomic number 00712 // (element symbol right justified), plus 00713 // the ionic state +2, +3 etc.. 00714 // 00715 int * iRet, // returns 00716 // RWBERR_NoChannel if iUnit was not 00717 // initialized 00718 // RWBERR_EmptyPointer if atom was not 00719 // advanced 00720 // RWBERR_Error1 internal error #1 00721 // RWBERR_Error2 internal error #2 00722 // RWBERR_Error3 internal error #3 00723 // 00724 // >=0 : success, warning flags: 00725 // RWBWAR_WrongSerial if serial number 00726 // differs from the position 00727 // number in the file 00728 // RWBWAR_UnkFormFactor unknown formfactor 00729 // RWBWAR_AmbFormFactor ambiguous formfactor 00730 // 00731 int AtNam_len, // fortran-hidden length of AtNam 00732 int ResNam_len, // fortran-hidden length of ResNam 00733 int ChnNam_len, // fortran-hidden length of ChnNam 00734 int ResNo_len, // fortran-hidden length of ResNo 00735 int InsCod_len, // fortran-hidden length of InsCod 00736 int AltCod_len, // fortran-hidden length of AltCod 00737 int segID_len, // fortran-hidden length of SegID 00738 int ID_len // fortran-hidden length of ID 00739 ), ( // lengths-in-structure list 00740 int * iUnit, int * iSer, 00741 mmdb::machine::fpstr AtNam, 00742 mmdb::machine::fpstr ResNam, 00743 mmdb::machine::fpstr ChnNam, int * iResN, 00744 mmdb::machine::fpstr ResNo, 00745 mmdb::machine::fpstr InsCod, 00746 mmdb::machine::fpstr AltCod, 00747 mmdb::machine::fpstr segID, int * IZ, 00748 mmdb::machine::fpstr ID, 00749 int * iRet 00750 ), ( // lengths-follow list 00751 int * iUnit, int * iSer, 00752 mmdb::machine::fpstr AtNam, int AtNam_len, 00753 mmdb::machine::fpstr ResNam, int ResNam_len, 00754 mmdb::machine::fpstr ChnNam, int ChnNam_len, 00755 int * iResN, 00756 mmdb::machine::fpstr ResNo, int ResNo_len, 00757 mmdb::machine::fpstr InsCod, int InsCod_len, 00758 mmdb::machine::fpstr AltCod, int AltCod_len, 00759 mmdb::machine::fpstr segID, int segID_len, 00760 int * IZ, 00761 mmdb::machine::fpstr ID, int ID_len, 00762 int * iRet 00763 ) ); 00764 00765 00766 // ------------------------------------------------------------------ 00767 00768 // mmdb_f_copyatom_(..) copies atom from current position in 00769 // channel iUnit1 to current position in channel iUnit2. 00770 00771 // FORTRAN equivalent: subroutine MMDB_F_CopyAtom ( iUnit1, 00772 // ~~~~~~~~~~~~~~~~~~~ iUnit2,iRet ) 00773 // integer iUnit1,iUnit2,iRet 00774 00775 FORTRAN_SUBR ( MMDB_F_COPYATOM, mmdb_f_copyatom, 00776 ( // length-at-end list 00777 int * iUnit1, // source channel number 00778 int * iUnit2, // destination channel number 00779 int * iRet // returns 00780 // RWBERR_NoChannel if iUnit was not 00781 // initialized 00782 // RWBERR_EmptyPointer if atom was not 00783 // advanced 00784 // >=0 : success 00785 ), ( // length-in-structure list 00786 int * iUnit1, int * iUnit2, int * iRet 00787 ), ( // length-follow list 00788 int * iUnit1, int * iUnit2, int * iRet 00789 ) ); 00790 00791 00792 // ------------------------------------------------------------------ 00793 00794 // mmdb_f_coord_(..) reads or writes the atom coordinates, occupancy 00795 // and temperature factor from/into the data structure associated 00796 // with the unit number iUnit (cf. mmdb_f_open_(..)). The position in 00797 // the structure is adjusted with the help of mmdb_f_advance_(..), 00798 // mmdb_f_rewd_(..) or mmdb_f_bksp_(..). 00799 // It is important that mmdb_f_coord_(..) was called AFTER 00800 // mmdb_f_atom_(..) if channel iUnit is associated with output 00801 // (otherwise iRet will return RWBERR_EmptyPointer). 00802 00803 // FORTRAN equivalent: subroutine MMDB_F_Coord ( iUnit,XFlag,BFlag, 00804 // ~~~~~~~~~~~~~~~~~~~ x,y,z,occ,BIso,U,iRet ) 00805 // integer iUnit,iRet 00806 // character*(*) XFlag,BFlag 00807 // real x,y,z,occ,BIso,U(6) 00808 00809 // Be sure that real-type parameters of mmdb_f_coord_(..) match those 00810 // of FORTRAN call. The real type is set with typedef apireal 00811 // statement in the begining of this file. 00812 00813 FORTRAN_SUBR ( MMDB_F_COORD, mmdb_f_coord, 00814 ( // lengths-at-end list 00815 int * iUnit, // unit number 00816 mmdb::machine::fpstr XFlag, // "F" or "O" flag for the fractional 00817 // or orthogonal coordinates x,y,z 00818 // for output files XFlag may also be 00819 // set to "HF" or "HO", where "F" and 00820 // "O" have the same meaning as before 00821 // and "H" indicates that the atom 00822 // should be marked as heteroatom 00823 mmdb::machine::fpstr BFlag , // "F" or "O" flag for temperature 00824 // factor in fractional or orthogonal 00825 // Us 00826 mmdb::machine::apireal * x, // x-coordinate 00827 mmdb::machine::apireal * y, // y-coordinate 00828 mmdb::machine::apireal * z, // z-coordinate 00829 mmdb::machine::apireal * occ, // occupancy 00830 mmdb::machine::apireal * BIso, // isotropic temperature factor 00831 mmdb::machine::apireal * U, // array(6) of the anisotr. t-factor 00832 int * iRet, // returns 00833 // RWBERR_NoChannel if iUnit was not 00834 // initialized 00835 // RWBERR_EmptyPointer if atom was not 00836 // advanced 00837 // RWBERR_NoMatrices if transformation 00838 // matrices are 00839 // undefined 00840 // RWBERR_NoCoordinates if coordinates were 00841 // not set in the atom 00842 // 00843 // >=0 : success, warning flags: 00844 // RWBERR_NoOccupancy if occupancy was 00845 // not set in the atom 00846 // RWBERR_NoTempFactor if temp. factor was 00847 // not set in the atom 00848 // 00849 int XFlag_len, // fortran-hidden length of XFlag 00850 int BFlag_len // fortran-hidden length of BFlag 00851 ), ( // lengths-in-structure list 00852 int * iUnit, 00853 mmdb::machine::fpstr XFlag, 00854 mmdb::machine::fpstr BFlag, 00855 mmdb::machine::apireal * x, 00856 mmdb::machine::apireal * y, 00857 mmdb::machine::apireal * z, 00858 mmdb::machine::apireal * occ, 00859 mmdb::machine::apireal * BIso, 00860 mmdb::machine::apireal * U, 00861 int * iRet 00862 ), ( // lengths-follow list 00863 int * iUnit, 00864 mmdb::machine::fpstr XFlag, int XFlag_len, 00865 mmdb::machine::fpstr BFlag, int BFlag_len, 00866 mmdb::machine::apireal * x, 00867 mmdb::machine::apireal * y, 00868 mmdb::machine::apireal * z, 00869 mmdb::machine::apireal * occ, 00870 mmdb::machine::apireal * BIso, 00871 mmdb::machine::apireal * U, 00872 int * iRet 00873 ) ); 00874 00875 00876 // ------------------------------------------------------------------ 00877 00878 // mmdb_f_setter_(..) sets the termination flag, so that the current 00879 // atom will be converted into terminator of a chain and appear as 00880 // 'ter' card in the output. The atom should be set by mmdb_f_atom_ 00881 // first, but the coordinates (mmdb_f_coord_(..)) do not have to be 00882 // specified. 00883 00884 // FORTRAN equivalent: subroutine MMDB_F_SetTer ( iUnit,iRet ) 00885 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00886 00887 FORTRAN_SUBR ( MMDB_F_SETTER, mmdb_f_setter, 00888 ( int * iUnit, int * iRet ), 00889 ( int * iUnit, int * iRet ), 00890 ( int * iUnit, int * iRet ) ); 00891 00892 00893 // ------------------------------------------------------------------ 00894 00895 // mmdb_f_sethet_(..) sets the heteroatom flag, so that the current 00896 // atom will appear as 'hetatm' card in the output. The atom should 00897 // be set by mmdb_f_atom_ first and then mmdb_f_coord_(..) and 00898 // mmdb_f_sethet_(..) should be called to specify its coordinates and 00899 // heteroatom status. 00900 00901 // FORTRAN equivalent: subroutine MMDB_F_SetHet ( iUnit,iRet ) 00902 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00903 00904 FORTRAN_SUBR ( MMDB_F_SETHET, mmdb_f_sethet, 00905 ( int * iUnit, int * iRet ), 00906 ( int * iUnit, int * iRet ), 00907 ( int * iUnit, int * iRet ) ); 00908 00909 00910 00911 // ------------------------------------------------------------------ 00912 00913 // mmdb_f_setcell_(..) sets the crystal cell properties and calculates 00914 // the orthogonal-fractional transformation matrices for unit iUnit. 00915 00916 // FORTRAN equivalent: subroutine MMDB_F_SetCell ( iUnit,a,b,c, 00917 // ~~~~~~~~~~~~~~~~~~~ alpha,beta,gamma, 00918 // ArgNCode,iRet ) 00919 // integer iUnit,ArgNCode,iRet 00920 // real a,b,c,alpha,beta,gamma 00921 00922 00923 // Relation to the former RBFRAC2 FORTRAN subroutine: 00924 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00925 // subroutine RBFRAC2 ( a,b,c,alpha,beta,gamma,ArgNCode ) 00926 // 00927 // ** the unit number iUnit and buffer for the return code iRet 00928 // have to be supplied. 00929 00930 FORTRAN_SUBR ( MMDB_F_SETCELL, mmdb_f_setcell, 00931 ( // lengths-at-end list 00932 int * iUnit, // unit number; *iUnit<=0 means 00933 // "the last mentioned unit" 00934 mmdb::machine::apireal * a, // cell parameter a, angstroms 00935 mmdb::machine::apireal * b, // cell parameter b, angstroms 00936 mmdb::machine::apireal * c, // cell parameter c, angstroms 00937 mmdb::machine::apireal * alpha, // cell parameter alpha, degrees 00938 mmdb::machine::apireal * beta, // cell parameter beta, degrees 00939 mmdb::machine::apireal * gamma, // cell parameter gamma, degrees 00940 int * ArgNCode, // orthogonalization code, 1-6 00941 int * iRet // return code: 00942 // RWBERR_Ok - success 00943 // RWBERR_NoChannel if unit 00944 // iUnit was not 00945 // initialized 00946 // RWBERR_NoFile if unit 00947 // has been disposed 00948 // RWBERR_Disagreement if a 00949 // disagreement in 00950 // cell parameters 00951 // was found 00952 // RWBERR_NoOrthCode if no 00953 // orthogonalization 00954 // code was found 00955 // RWBERR_NoCheck if check 00956 // of cell parameters 00957 // has failed. 00958 // The last three returns would 00959 // rather indicate a programming 00960 // error in mmdb_rwbrook.cpp 00961 ), ( // lengths-in-structure list 00962 int * iUnit, 00963 mmdb::machine::apireal * a, 00964 mmdb::machine::apireal * b, 00965 mmdb::machine::apireal * c, 00966 mmdb::machine::apireal * alpha, 00967 mmdb::machine::apireal * beta, 00968 mmdb::machine::apireal * gamma, 00969 int * ArgNCode, int * iRet 00970 ), ( // lengths-follow list 00971 int * iUnit, 00972 mmdb::machine::apireal * a, 00973 mmdb::machine::apireal * b, 00974 mmdb::machine::apireal * c, 00975 mmdb::machine::apireal * alpha, 00976 mmdb::machine::apireal * beta, 00977 mmdb::machine::apireal * gamma, 00978 int * ArgNCode, int * iRet 00979 ) 00980 ); 00981 00982 00983 00984 // ------------------------------------------------------------------ 00985 00986 // mmdb_f_wbspgrp_(..) sets the space group 00987 00988 // FORTRAN equivalent: subroutine MMDB_F_WBSpGrp ( iUnit,spGroup,iRet ) 00989 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 00990 // character*(*) spGroup 00991 00992 00993 // Relation to the former WBSpGrp FORTRAN subroutine: 00994 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00995 // subroutine WBSpGrp ( spGroup ) 00996 // 00997 // ** the unit number iUnit and buffer for the return code iRet 00998 // have to be supplied. 00999 01000 FORTRAN_SUBR ( MMDB_F_WBSPGRP, mmdb_f_wbspgrp, 01001 ( // lengths-at-end list 01002 int * iUnit, // unit number; *iUnit<=0 means 01003 // "the last mentioned unit" 01004 mmdb::machine::fpstr spGroup, // space group 01005 int * iRet, // return code: 01006 // RWBERR_Ok - success 01007 // RWBERR_NoChannel if unit 01008 // iUnit was not 01009 // initialized 01010 // RWBERR_NoFile if unit 01011 // has been disposed 01012 int spGroup_len // fortran-hidden length of spGroup 01013 ), ( // lengths-in-structure list 01014 int * iUnit, mmdb::machine::fpstr spGroup, int * iRet 01015 ), ( // lengths-follow list 01016 int * iUnit, mmdb::machine::fpstr spGroup, int spGroup_len, 01017 int * iRet 01018 ) 01019 ); 01020 01021 01022 01023 // ------------------------------------------------------------------ 01024 01025 // mmdb_f_rbspgrp_(..) retrieves the space group 01026 01027 // FORTRAN equivalent: subroutine MMDB_F_RBSpGrp ( iUnit,spGroup,iRet ) 01028 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 01029 // character*(*) spGroup 01030 01031 01032 // Relation to the former RBSpGrp FORTRAN subroutine: 01033 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01034 // subroutine RBSpGrp ( spGroup ) 01035 // 01036 // ** the unit number iUnit and buffer for the return code iRet 01037 // have to be supplied. 01038 01039 FORTRAN_SUBR ( MMDB_F_RBSPGRP, mmdb_f_rbspgrp, 01040 ( // lengths-at-end list 01041 int * iUnit, // unit number; *iUnit<=0 means 01042 // "the last mentioned unit" 01043 mmdb::machine::fpstr spGroup, // space group 01044 int * iRet, // return code: 01045 // RWBERR_Ok - success 01046 // RWBERR_NoChannel if unit 01047 // iUnit was not 01048 // initialized 01049 // RWBERR_NoFile if unit 01050 // has been disposed 01051 int spGroup_len // fortran-hidden length of spGroup 01052 ), ( // lengths-in-structure list 01053 int * iUnit, mmdb::machine::fpstr spGroup, int * iRet 01054 ), ( // lengths-follow list 01055 int * iUnit, mmdb::machine::fpstr spGroup, int spGroup_len, 01056 int * iRet 01057 ) 01058 ); 01059 01060 01061 01062 // ------------------------------------------------------------------ 01063 01064 // mmdb_f_wbcell_(..) sets the crystal cell properties into the 01065 // channel iUnit. 01066 01067 // FORTRAN equivalent: subroutine MMDB_F_WBCell ( iUnit,ArgCell, 01068 // ~~~~~~~~~~~~~~~~~~~ ArgNCode,iRet ) 01069 // integer iUnit,ArgNCode,iRet 01070 // real ArgCell(6) 01071 // 01072 01073 // Relation to the former WBCELL FORTRAN subroutine: 01074 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01075 // subroutine WBCELL ( iUnit,ArgCell,ArgNCode ) 01076 // 01077 // ** the buffer for the return code iRet has to be supplied 01078 01079 FORTRAN_SUBR ( MMDB_F_WBCELL, mmdb_f_wbcell, 01080 ( // lengths-at-end list 01081 int * iUnit, // unit number; *iUnit<=0 means 01082 // "the last mentioned unit" 01083 mmdb::machine::apireal * ArgCell, // array to accept the cell parameters 01084 // if ArgCell(1) is set to 0, then 01085 // the cell does not change 01086 int * ArgNCode, // orthogonalisation code 01087 // if ArgNCode is set to 0, then 01088 // the orthogonalisation matrices 01089 // do not change 01090 int * iRet // return code 01091 // RWBERR_Ok - success 01092 // RWBERR_NoChannel if unit 01093 // iUnit was not 01094 // initialized 01095 // RWBERR_NoFile if unit 01096 // has been disposed 01097 ), ( // lengths-in-structure list 01098 int * iUnit, mmdb::machine::apireal * ArgCell, 01099 int * ArgNCode, int * iRet 01100 ), ( // lengths-follow list 01101 int * iUnit, mmdb::machine::apireal * ArgCell, 01102 int * ArgNCode, int * iRet 01103 ) 01104 ); 01105 01106 01107 01108 // ------------------------------------------------------------------ 01109 01110 // mmdb_f_rbcell_(..) retrieves the crystal cell properties from the 01111 // channel iUnit. 01112 01113 // FORTRAN equivalent: subroutine MMDB_F_RBCell ( iUnit,celld,cvol,iRet ) 01114 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 01115 // real celld(6),cvol 01116 // character*(*) spGroup 01117 01118 // Relation to the former RBCELL FORTRAN subroutine: 01119 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01120 // subroutine RBCELL ( celld,cvol ) 01121 // 01122 // ** the unit number iUnit and buffer for the return code iRet 01123 // have to be supplied. 01124 01125 FORTRAN_SUBR ( MMDB_F_RBCELL, mmdb_f_rbcell, 01126 ( // lengths-at-end list 01127 int * iUnit, // unit number; *iUnit<=0 means 01128 // "the last mentioned unit" 01129 mmdb::machine::apireal * celld, // array to accept the cell parameters 01130 mmdb::machine::apireal * cvol, // returns the cell volume 01131 int * iRet // return code 01132 // RWBERR_Ok - success 01133 // RWBERR_NoChannel if unit 01134 // iUnit was not 01135 // initialized 01136 // RWBERR_NoFile if unit 01137 // has been disposed 01138 // RWBERR_Parameters if the 01139 // cell parameters 01140 // were not set 01141 // RWBERR_NoOrthCode if no 01142 // orthogonalization 01143 // code was found 01144 // RWBERR_NoCheck if check 01145 // of cell parameters 01146 // has failed. 01147 // The last three returns would 01148 // rather indicate a programming 01149 // error in mmdb_rwbrook.cpp 01150 ), ( // lengths-in-structure list 01151 int * iUnit, mmdb::machine::apireal * celld, 01152 mmdb::machine::apireal * cvol, int * iRet 01153 ), ( // lengths-follow list 01154 int * iUnit, mmdb::machine::apireal * celld, 01155 mmdb::machine::apireal * cvol, int * iRet 01156 ) ); 01157 01158 01159 01160 // ------------------------------------------------------------------ 01161 01162 // mmdb_f_rbcelln_(..) retrieves the crystal cell properties from the 01163 // channel iUnit. 01164 01165 // FORTRAN equivalent: subroutine MMDB_F_RBCellN ( iUnit,celld,cvol, 01166 // ~~~~~~~~~~~~~~~~~~~ ArgNCode,iRet ) 01167 // integer iUnit,ArgNCode,iRet 01168 // real celld(6),cvol 01169 01170 // Relation to the former RBCELL FORTRAN subroutine: 01171 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01172 // subroutine RBCELL ( celld,cvol ) 01173 // 01174 // ** the unit number iUnit, buffer for orthogonalization code 01175 // ArgNCode and for the return code iRet have to be supplied. 01176 01177 FORTRAN_SUBR ( MMDB_F_RBCELLN, mmdb_f_rbcelln, 01178 ( // lengths-at-end list 01179 int * iUnit, // unit number; *iUnit<=0 means 01180 // "the last mentioned unit" 01181 mmdb::machine::apireal * celld, // array to accept the cell parameters 01182 mmdb::machine::apireal * cvol, // returns the cell volume 01183 int * ArgNCode, // returns the orthogonalization code, 1-6 01184 int * iRet // return code 01185 // RWBERR_Ok - success 01186 // RWBERR_NoChannel if unit 01187 // iUnit was not 01188 // initialized 01189 // RWBERR_NoFile if unit 01190 // has been disposed 01191 // RWBERR_Parameters if the 01192 // cell parameters 01193 // were not set 01194 // RWBERR_NoOrthCode if no 01195 // orthogonalization 01196 // code was found 01197 // RWBERR_NoCheck if check 01198 // of cell parameters 01199 // has failed. 01200 // The last three returns would 01201 // rather indicate a programming 01202 // error in mmdb_rwbrook.cpp 01203 ), ( // lengths-in-structure list 01204 int * iUnit, 01205 mmdb::machine::apireal * celld, 01206 mmdb::machine::apireal * cvol, 01207 int * ArgNCode, int * iRet 01208 ), ( // lengths-follow list 01209 int * iUnit, 01210 mmdb::machine::apireal * celld, 01211 mmdb::machine::apireal * cvol, 01212 int * ArgNCode, int * iRet 01213 ) 01214 ); 01215 01216 01217 01218 // ------------------------------------------------------------------ 01219 01220 // mmdb_f_rbrcel_(..) retrieves the reciprocal cell dimensions and 01221 // reciprocal cell volume from the channel iUnit. 01222 01223 // FORTRAN equivalent: subroutine MMDB_F_RBRCel ( iUnit,rcell,rvol, 01224 // ~~~~~~~~~~~~~~~~~~~ iRet ) 01225 // integer iUnit,iRet 01226 // real rcell(6),rvol 01227 01228 // Relation to the former RBRCEL FORTRAN subroutine: 01229 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01230 // subroutine RBRCEL ( rcell,rvol ) 01231 // 01232 // ** the unit number iUnit and buffer for the return code iRet 01233 // have to be supplied. 01234 01235 FORTRAN_SUBR ( MMDB_F_RBRCEL, mmdb_f_rbrcel, 01236 ( // lengths-at-end list 01237 int * iUnit, // unit number 01238 mmdb::machine::apireal * rcell, // array to accept the reciprocal 01239 // cell parameters 01240 mmdb::machine::apireal * rvol, // returns the reciprocal cell volume 01241 int * iRet // return code 01242 // RWBERR_Ok - success 01243 // RWBERR_NoChannel if unit 01244 // iUnit was not 01245 // initialized 01246 // RWBERR_NoFile if unit 01247 // has been disposed 01248 // RWBERR_Parameters if the 01249 // cell parameters 01250 // were not set 01251 // RWBERR_NoOrthCode if no 01252 // orthogonalization 01253 // code was found 01254 // RWBERR_NoCheck if check 01255 // of cell parameters 01256 // has failed. 01257 // The last three returns would 01258 // rather indicate a programming 01259 // error in mmdb_rwbrook.cpp 01260 ), ( // lengths-in-structure list 01261 int * iUnit, 01262 mmdb::machine::apireal * rcell, 01263 mmdb::machine::apireal * rvol, 01264 int * iRet 01265 ), ( // lengths-follow list 01266 int * iUnit, 01267 mmdb::machine::apireal * rcell, 01268 mmdb::machine::apireal * rvol, 01269 int * iRet 01270 ) ); 01271 01272 01273 // ------------------------------------------------------------------ 01274 01275 // mmdb_f_rborf_(..) fills or retrieves the fractionalising (RF) and 01276 // orthogonalising (RO) 4x4 matrices, as well as the orthogonalisation 01277 // code (LCode) in/from unit iUnit. 01278 // If RO[1][1] (fortran notations, or RO[0] in C/C++) is set to 0.0 01279 // then the matrices are retrieved and returned in RF and RO; 01280 // otherwise RF and RO are stored in the unit. 01281 01282 // FORTRAN equivalent: subroutine MMDB_F_RBORF ( iUnit,RO,RF, 01283 // ~~~~~~~~~~~~~~~~~~~ LCode,iRet ) 01284 // integer iUnit,LCode,iRet 01285 // real RO(4,4),RF(4,4) 01286 01287 // Relation to the former RBRORF2 FORTRAN subroutine: 01288 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01289 // subroutine RBRORF2 ( RO,RF,LCode ) 01290 // 01291 // ** the unit number iUnit and buffer for the return code iRet 01292 // have to be supplied. 01293 01294 FORTRAN_SUBR ( MMDB_F_RBORF, mmdb_f_rborf, 01295 ( // lengths-at-end list 01296 int * iUnit, // unit number; *iUnit<=0 means 01297 // "the last mentioned unit" 01298 mmdb::machine::apireal * RO, // array for orthogonalising matrix 01299 mmdb::machine::apireal * RF, // array for fractionalising matrix 01300 int * LCode, // buffer for orthogonalisation code 01301 int * iRet // return code: 01302 // RWBERR_Ok - success 01303 // RWBERR_NoChannel if unit 01304 // iUnit was not 01305 // initialized 01306 // RWBERR_NoFile if unit 01307 // has been disposed 01308 // RWBERR_NoMatrices if the 01309 // orthogonalisation 01310 // matrices were not 01311 // calculated 01312 ), ( // lengths-in-structure list 01313 int * iUnit, 01314 mmdb::machine::apireal * RO, 01315 mmdb::machine::apireal * RF, 01316 int * LCode, int * iRet 01317 ), ( // lengths-follow list 01318 int * iUnit, 01319 mmdb::machine::apireal * RO, 01320 mmdb::machine::apireal * RF, 01321 int * LCode, int * iRet 01322 ) 01323 ); 01324 01325 01326 01327 // ------------------------------------------------------------------ 01328 01329 // mmdb_f_orthmat_(..) calculates matrices for standard orthogonalisations 01330 // and cell volume. 01331 // If Cell(1) is greater then zero, the existing cell parameters 01332 // will be substituted. If new cell parameters differ substantially 01333 // from the old ones, the returned value of Vol will be negative. 01334 01335 // FORTRAN equivalent: subroutine MMDB_F_OrthMat ( iUnit,Cell,Vol, 01336 // ~~~~~~~~~~~~~~~~~~~ RRR,iRet 01337 // integer iUnit,iRet 01338 // real Cell(6),Vol,RRR(3,3,6) 01339 01340 // Relation to the former RBFRO1 FORTRAN subroutine: 01341 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01342 // subroutine RBFRO1 ( Cell,Vol,RRR ) 01343 // 01344 // ** the unit number iUnit and buffer for the return code iRet 01345 // have to be supplied. 01346 01347 FORTRAN_SUBR ( MMDB_F_ORTHMAT, mmdb_f_orthmat, 01348 ( // lengths-at-end list 01349 int * iUnit, // unit number; *iUnit<=0 means 01350 // "the last mentioned unit" 01351 mmdb::machine::apireal * Cell, // array of cell parameters: 01352 // Cell(1) - a Cell(4) - alpha 01353 // Cell(2) - b Cell(5) - beta 01354 // Cell(3) - c Cell(6) - gamma 01355 mmdb::machine::apireal * Vol, // returns cell volume 01356 mmdb::machine::apireal * RRR, // array (3,3,6), returns 01357 // orthogonalisation matrices 01358 int * iRet // return code: 01359 // RWBERR_Ok - success 01360 // RWBERR_NoChannel if unit 01361 // iUnit was not 01362 // initialized 01363 // RWBERR_NoFile if unit 01364 // has been disposed 01365 // RWBERR_NoMatrices if the 01366 // orthogonalisation 01367 // matrices were not 01368 // calculated 01369 ), ( // lengths-in-structure list 01370 int * iUnit, 01371 mmdb::machine::apireal * Cell, 01372 mmdb::machine::apireal * Vol, 01373 mmdb::machine::apireal * RRR, int * iRet 01374 ), ( // lengths-follow list 01375 int * iUnit, 01376 mmdb::machine::apireal * Cell, 01377 mmdb::machine::apireal * Vol, 01378 mmdb::machine::apireal * RRR, int * iRet 01379 ) 01380 ); 01381 01382 01383 01384 // ------------------------------------------------------------------ 01385 01386 // mmdb_f_cvanisou_(..) converts between crystallographic bs and 01387 // orthogonal Us or the other way round. 01388 01389 // FORTRAN equivalent: subroutine MMDB_F_CVAnisou ( iUnit,U,iFlag,iRet ) 01390 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iFlag,iRet 01391 // real U(6) 01392 01393 // Relation to the former CVANISOU FORTRAN subroutine: 01394 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01395 // subroutine CVANISOU ( U,iFlag ) 01396 // 01397 // ** the unit number iUnit and buffer for the return code iRet 01398 // have to be supplied. 01399 01400 FORTRAN_SUBR ( MMDB_F_CVANISOU, mmdb_f_cvanisou, 01401 ( // lengths-at-end list 01402 int * iUnit, // unit number; *iUnit<=0 means 01403 // "the last mentioned unit" 01404 mmdb::machine::apireal * U, // array of coordinates to convert 01405 int * iFlag, // =0: convert from fract. to orthog. 01406 // =1: convert from orthog. to fract. 01407 int * iRet // return code: 01408 // RWBERR_Ok - success 01409 // RWBERR_NoChannel if unit 01410 // iUnit was not 01411 // initialized 01412 // RWBERR_NoFile if unit 01413 // has been disposed 01414 // RWBERR_NoMatrices if the 01415 // orthogonalisation 01416 // matrices were not 01417 // calculated 01418 ), ( // lengths-in-structure list 01419 int * iUnit, 01420 mmdb::machine::apireal * U, int * iFlag, int * iRet 01421 ), ( // lengths-follow list 01422 int * iUnit, 01423 mmdb::machine::apireal * U, int * iFlag, int * iRet 01424 ) 01425 ); 01426 01427 01428 01429 // ------------------------------------------------------------------ 01430 01431 // mmdb_f_wremark_(..) writes a remark line into data structure. 01432 // Generally, it puts the line on its place according to a PDB 01433 // keyword which should start the line. The line will be always the 01434 // last one in its group (last remark with given number or without 01435 // it, last JRNL record, last ATOM etc.). If the keyword is not 01436 // recognized, the line is appended after the coordinate section. 01437 // iRet will return same codes as those in mmdb_f_open1_(..) plus 01438 // additional ones specified below. 01439 01440 // FORTRAN equivalent: subroutine MMDB_F_WRemark ( iUnit,Line,iRet ) 01441 // ~~~~~~~~~~~~~~~~~~~ integer iUnit,iRet 01442 // character*(*) Line 01443 01444 // Relation to the former WRemark FORTRAN subroutine: 01445 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01446 // subroutine WRemark ( iUnit,Line ) 01447 // 01448 // ** the buffer for return code iRet has to be supplied 01449 01450 FORTRAN_SUBR ( MMDB_F_WREMARK, mmdb_f_wremark, 01451 ( // lengths-at-end list 01452 int * iUnit, // unit number; *iUnit<=0 means 01453 // "the last mentioned unit" 01454 mmdb::machine::fpstr Line, // line to be added 01455 int * iRet, // return code: 01456 // RWBERR_Ok - success 01457 // RWBERR_NoChannel if unit 01458 // iUnit was not 01459 // initialized 01460 // RWBERR_NoFile if unit 01461 // has been disposed 01462 // other return codea are those 01463 // returned by mmdb_f_open1_(..) 01464 int Line_len // fortran-hidden length of Line 01465 ), ( // lengths-in-structure list 01466 int * iUnit, 01467 mmdb::machine::fpstr Line, int * iRet 01468 ), ( // lengths-follow list 01469 int * iUnit, 01470 mmdb::machine::fpstr Line, int Line_len, int *iRet 01471 ) 01472 ); 01473 01474 01475 /* 01476 // ------------------------------------------------------------------ 01477 01478 // rbrinv_(..) takes 4x4 real matrix A and returns its inverse in 01479 // matrix AI. 01480 01481 // FORTRAN equivalent: subroutine RBRInv ( A,AI ) 01482 // ~~~~~~~~~~~~~~~~~~~ real A(4,4),AI(4,4) 01483 01484 FORTRAN_SUBR ( RBRINV, rbrinv, 01485 ( mmdb::machine::apireal * A, mmdb::machine::apireal * AI ), 01486 ( mmdb::machine::apireal * A, mmdb::machine::apireal * AI ), 01487 ( mmdb::machine::apireal * A, mmdb::machine::apireal * AI ) 01488 ); 01489 01490 */ 01491 /* 01492 01493 // ------------------------------------------------------------------ 01494 01495 // res3to1_(..) returns the 3-character or 1-character residue 01496 // codes. One of them should be supplied (with the other one set 01497 // blank), the routine returns the other one. 01498 01499 // FORTRAN equivalent: subroutine Res3to1 ( ResNm3,resNm1 ) 01500 // ~~~~~~~~~~~~~~~~~~~ character*4 ResNm3 01501 // cgaracter*1 ResNm1 01502 01503 FORTRAN_SUBR ( RES3TO1, res3to1, 01504 ( // lengths-at-end list 01505 mmdb::machine::fpstr ResNm3, // 3-char name, 4th char 01506 // will be set blank 01507 mmdb::machine::fpstr ResNm1, // 1-char name 01508 int ResNm3_len, // fortran-hidden length of ResNm3 01509 int ResNm1_len // fortran-hidden length of ResNm3 01510 ), ( // lengths-in-structure list 01511 mmdb::machine::fpstr ResNm3, mmdb::machine::fpstr ResNm1 01512 ), ( // lengths-follow list 01513 mmdb::machine::fpstr ResNm3, int ResNm3_len, 01514 mmdb::machine::fpstr ResNm1, int ResNm1_len 01515 ) 01516 ); 01517 01518 */ 01519 01520 // ------------------------------------------------------------------ 01521 01522 // rberrstop_(..) checks the return code got from one of the above 01523 // functions, and if it indicates an error, it issues the following 01524 // type of message (example) 01525 // 01526 // *** RWBROOK error: point code unit function 01527 // *** 12 -3 3 MMDB_F_Open 01528 // *** file : input.pdb 01529 // *** reason : cannot open a file 01530 // *** Execution stopped. 01531 // 01532 // if iStop is set to 0, and one of the following type 01533 // 01534 // *** RWBROOK error: point code unit function 01535 // *** 12 -3 3 MMDB_F_Open 01536 // *** file : input.pdb 01537 // *** reason : cannot open a file 01538 // *** continue running, may crash ... 01539 // 01540 // if iStop is not null. 01541 // 01542 // iPlace (12 in the above samples) should be given a number which 01543 // is unique through an application; it serves to the identifying 01544 // the particular call which caused the problem. The return code 01545 // (-3 in the above samples) is that what is back in the iRet 01546 // parameter to the above functions. If iRet is set to RWBERR_Ok, 01547 // rberrstop_(..) makes no action. If rberrstop_(..) is called 01548 // immediately after a call to an RWBROOK function, e.g. 01549 // 01550 // call MMDB_F_Open ( FName,RWStat,FType,iUnit,iRet ) 01551 // call RBErrStop ( 12,iRet,iUnit,0 ) 01552 // 01553 // then the name of the misfunctioned call (MMDB_F_Open in the above 01554 // samples) will be identified automatically and correctly. 01555 01556 // FORTRAN equivalent: subroutine RBErrStop ( iPlace,iRet, 01557 // ~~~~~~~~~~~~~~~~~~~ iUnit ,iStop ) 01558 // integer iUnit,iPlace,iRet,iStop 01559 01560 FORTRAN_SUBR ( RBERRSTOP, rberrstop, 01561 ( // lengths-at-end list 01562 int * iPlace, // (unique) identificator inside an application 01563 int * iRet, // return code to check 01564 int * iUnit, // unit number 01565 int * iStop // if 0 then stop if error 01566 ), ( // lengths-in-structure list 01567 int * iPlace, int * iRet, 01568 int * iUnit, int * iStop 01569 ), ( // lengths-follow list 01570 int * iPlace, int * iRet, 01571 int * iUnit, int * iStop 01572 ) ); 01573 01574 01575 01576 // ------------------------------------------------------------------ 01577 01578 // rbcheckerr_(..) represents a simplified call to rberrstop_(..). 01579 // It will work properly only if rbcheckerr_(..) is called 01580 // immediately after an API function to be checked: 01581 // 01582 // call MMDB_F_Open ( FName,RWStat,FType,iUnit,iRet ) 01583 // call RBCheckErr ( 12,0 ) 01584 // 01585 01586 // FORTRAN equivalent: subroutine RBCheckErr ( iPlace,iStop ) 01587 // ~~~~~~~~~~~~~~~~~~~ integer iPlace,iStop 01588 01589 FORTRAN_SUBR ( RBCHECKERR, rbcheckerr, 01590 ( // lengths-at-end list 01591 int * iPlace, // (unique) identificator inside an application 01592 int * iStop // if 0 then stop if error 01593 ), ( // lengths-in-structure list 01594 int * iPlace, int * iStop 01595 ), ( // lengths-follow list 01596 int * iPlace, int * iStop 01597 ) ); 01598 01599 01600 #endif
1.7.2