00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00099 #ifndef __CMTZLib__
00100 #define __CMTZLib__
00101
00102
00103
00104 #include "ccp4_utils.h"
00105
00106 #ifdef __cplusplus
00107 namespace CMtz {
00108 extern "C" {
00109 typedef CCP4::CCP4File CCP4File;
00110 #endif
00111
00112
00113 #include "mtzdata.h"
00114
00115
00116
00123 MTZ *MtzGet(const char *logname, int read_refs);
00124
00131 MTZ *MtzGetUserCellTolerance(
00132 const char *logname, int read_refs, const double cell_tolerance);
00133
00140 int MtzRrefl(CCP4File *filein, int ncol, float *refldata);
00141
00148 int MtzPut(MTZ *mtz, const char *logname);
00149
00154 CCP4File *MtzOpenForWrite(const char *logname);
00155
00163 int MtzWhdrLine(CCP4File *fileout, int nitems, char buffer[]);
00164
00172 int MtzWrefl(CCP4File *fileout, int ncol, float *refldata);
00173
00180 int MtzDeleteRefl(MTZ *mtz, int iref);
00181
00182
00183
00195 MTZ *MtzMalloc(int nxtal, int nset[]);
00196
00201 int MtzFree(MTZ *mtz);
00202
00209 MTZCOL *MtzMallocCol(MTZ *mtz, int nref);
00210
00215 int MtzFreeCol(MTZCOL *col);
00216
00220 MTZBAT *MtzMallocBatch(void);
00221
00226 int MtzFreeBatch(MTZBAT *batch);
00227
00232 char *MtzCallocHist(int nhist);
00233
00238 int MtzFreeHist(char *hist);
00239
00245 void MtzMemTidy(void);
00246
00247
00248
00253 int MtzNbat(const MTZ *mtz);
00254
00259 int MtzNref(const MTZ *mtz);
00260
00265 int MtzSpacegroupNumber(const MTZ *mtz);
00266
00274 int MtzResLimits(const MTZ *mtz, float *minres, float *maxres);
00275
00276
00277
00282 int MtzNxtal(const MTZ *mtz);
00283
00288 int MtzNumActiveXtal(const MTZ *mtz);
00289
00294 MTZXTAL **MtzXtals(MTZ *mtz);
00295
00301 MTZXTAL *MtzIxtal(const MTZ *mtz, const int ixtal);
00302
00309 char *MtzXtalPath(const MTZXTAL *xtal);
00310
00316 MTZXTAL *MtzXtalLookup(const MTZ *mtz, const char *label);
00317
00325 MTZXTAL *MtzAddXtal(MTZ *mtz, const char *xname, const char *pname,
00326 const float cell[6]);
00327
00332 int MtzNsetsInXtal(const MTZXTAL *xtal);
00333
00339 int MtzNumActiveSetsInXtal(const MTZ *mtz, const MTZXTAL *xtal);
00340
00346 MTZSET **MtzSetsInXtal(MTZXTAL *xtal);
00347
00354 MTZSET *MtzIsetInXtal(const MTZXTAL *xtal, const int iset);
00355
00356
00357
00362 int MtzNset(const MTZ *mtz);
00363
00368 int MtzNumActiveSet(const MTZ *mtz);
00369
00377 MTZXTAL *MtzSetXtal(const MTZ *mtz, const MTZSET *set);
00378
00387 char *MtzSetPath(const MTZ *mtz, const MTZSET *set);
00388
00395 MTZSET *MtzSetLookup(const MTZ *mtz, const char *label);
00396
00404 MTZSET *MtzAddDataset(MTZ *mtz, MTZXTAL *xtl, const char *dname,
00405 const float wavelength);
00406
00413 int MtzNcolsInSet(const MTZSET *set);
00414
00419 int MtzNumActiveColsInSet(const MTZSET *set);
00420
00426 int MtzNumSourceColsInSet(const MTZSET *set);
00427
00433 int MtzNbatchesInSet(const MTZ *mtz, const MTZSET *set);
00434
00440 MTZCOL **MtzColsInSet(MTZSET *set);
00441
00449 MTZCOL *MtzIcolInSet(const MTZSET *set, const int icol);
00450
00451
00452
00460 MTZCOL *MtzAddColumn(MTZ *mtz, MTZSET *set, const char *label,
00461 const char *type);
00462
00467 int MtzAssignHKLtoBase(MTZ *mtz);
00468
00481 int MtzAssignColumn(MTZ *mtz, MTZCOL *col, const char crystal_name[],
00482 const char dataset_name[]);
00483
00490 int MtzToggleColumn(MTZCOL *col);
00491
00498 MTZSET *MtzColSet(const MTZ *mtz, const MTZCOL *col);
00499
00504 int MtzNcol(const MTZ *mtz);
00505
00510 int MtzNumActiveCol(const MTZ *mtz);
00511
00517 int MtzNumSourceCol(const MTZ *mtz);
00518
00526 char *MtzColPath(const MTZ *mtz, const MTZCOL *col);
00527
00534 int MtzRJustPath(char *path, const char *partial, const int njust);
00535
00541 int MtzPathMatch(const char *path1, const char *path2);
00542
00548 MTZCOL *MtzColLookup(const MTZ *mtz, const char *label);
00549
00554 char *MtzColType(MTZCOL *col);
00555
00561 void MtzDebugHierarchy(const MTZ *mtz);
00562
00570 int MtzListColumn(const MTZ *mtz, char clabs[][31], char ctyps[][3], int csetid[]);
00571
00579 int MtzListInputColumn(const MTZ *mtz, char clabs[][31], char ctyps[][3], int csetid[]);
00580
00581
00582
00591 int MtzFindInd(const MTZ *mtz, int *ind_xtal, int *ind_set, int ind_col[3]);
00592
00599 float MtzInd2reso(const int in[3], const double coefhkl[6]);
00600
00606 int MtzHklcoeffs(const float cell[6], double coefhkl[6]);
00607
00614 int MtzArrayToBatch(const int *intbuf, const float *fltbuf, MTZBAT *batch);
00615
00622 int MtzBatchToArray(MTZBAT *batch, int *intbuf, float *fltbuf);
00623
00632 MTZBAT *sort_batches(MTZBAT *batch, int numbat);
00633
00634
00635
00642 int ccp4_lrtitl(const MTZ *mtz, char *title);
00643
00650 int ccp4_lrhist(const MTZ *mtz, char history[][MTZRECORDLENGTH], int nlines);
00651
00657 int ccp4_lrsort(const MTZ *mtz, int isort[5]);
00658
00665 int ccp4_lrbats(const MTZ *mtz, int *nbatx, int batchx[]);
00666
00672 int ccp4_lrcell(const MTZXTAL *xtl, float cell[]);
00673
00683 int ccp4_lrsymi(const MTZ *mtz, int *nsympx, char *ltypex, int *nspgrx,
00684 char *spgrnx, char *pgnamx);
00685
00695 int ccp4_lrsymm(const MTZ *mtz, int *nsymx, float rsymx[192][4][4]);
00696
00706 int MtzParseLabin(char *labin_line, const char prog_labels[][31],
00707 const int nlprgi, char user_labels[][2][31]);
00708
00722 MTZCOL **ccp4_lrassn(const MTZ *mtz, const char labels[][31], const int nlabels,
00723 char types[][3]);
00724
00738 int ccp4_lridx(const MTZ *mtz, const MTZSET *set, char crystal_name[64],
00739 char dataset_name[64], char project_name[64], int *isets,
00740 float datcell[6], float *datwave);
00741
00757 int ccp4_lrrefl(const MTZ *mtz, float *resol, float adata[], int logmss[], int iref);
00758
00775 int ccp4_lrreff(const MTZ *mtz, float *resol, float adata[], int logmss[],
00776 const MTZCOL *lookup[], const int ncols, const int iref);
00777
00785 int ccp4_ismnf(const MTZ *mtz, const float datum);
00786
00792 int ccp4_lhprt(const MTZ *mtz, int iprint);
00793
00800 int ccp4_lhprt_adv(const MTZ *mtz, int iprint);
00801
00809 int ccp4_lrbat(MTZBAT *batch, float *buf, char *charbuf, int iprint);
00810
00815 int MtzPrintBatchHeader(const MTZBAT *batch);
00816
00824 int ccp4_lwtitl(MTZ *mtz, const char *ftitle, int flag);
00825
00835 int MtzSetSortOrder(MTZ *mtz, MTZCOL *colsort[5]);
00836
00843 int MtzAddHistory(MTZ *mtz, const char history[][MTZRECORDLENGTH], const int nlines);
00844
00859 int ccp4_lwsymm(MTZ *mtz, int nsymx, int nsympx, float rsymx[192][4][4],
00860 char ltypex[], int nspgrx, char spgrnx[], char pgnamx[]);
00861
00874 MTZCOL **ccp4_lwassn(MTZ *mtz, const char labels[][31], const int nlabels,
00875 const char types[][3], const int iappnd);
00876
00893 int ccp4_lwidx(MTZ *mtz, const char crystal_name[], const char dataset_name[],
00894 const char project_name[], const float datcell[6], const float *datwave);
00895
00896
00909 int ccp4_lwrefl(MTZ *mtz, const float adata[], MTZCOL *lookup[],
00910 const int ncol, const int iref);
00911
00925 int ccp4_lwbat(MTZ *mtz, MTZBAT *batch, const int batno, const float *buf, const char *charbuf);
00926
00933 int ccp4_lwbsetid(MTZ *mtz, MTZBAT *batch, const char xname[], const char dname[]);
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991 #ifdef __cplusplus
00992 } }
00993 #endif
00994 #endif
00995
00996
00997
00998
00999
01000