NanoShaper  0.7.2
NanoShaper is a tool able to triangulate and inspect an arbitray triangulated surface or several types of molecular surfaces
C:/Documents and Settings/sdecherchi/My Documents/Ricerca/software nostro/NanoShaper0.7/src/DelphiShared.h
00001 
00002 #ifndef  DelphiShared_h
00003 #define  DelphiShared_h
00004 
00005 #include "globals.h"
00006 
00007 #ifdef DBGMEM_CRT
00008         #define _CRTDBG_MAP_ALLOC
00009         #define _CRTDBG_MAP_ALLOC_NEW
00010 #endif
00011 
00012 #include "tools.h"
00013 
00014 #define DEFAULT_PERFIL 80
00015 #define DEFAULT_SCALE 2.0
00016 
00017 // Status map codes
00018 #define STATUS_CAVITY_POINT_SHAPE_UNDER_CHECK -3
00019 #define STATUS_CAVITY_POINT_SHAPE_OK -2
00020 #define STATUS_POINT_INSIDE -1
00021 #define STATUS_POINT_TEMPORARY_OUT 2
00022 // over this index are all cavities
00023 #define STATUS_POINT_OUT 3
00024 // normal cavity point
00025 #define STATUS_FIRST_CAV 4
00026 // support points are those which have in absolute number a cavity number (>=4) but
00027 // an inverted sign. These points represent grid point in which the probe can stay.
00028 // In a generic cavity point probe could not fit.
00029 #define STATUS_FIRST_SUPPORT_CAV -4
00030 
00031 //extern double debug_stern;
00032 
00035 class DelPhiShared {   
00036 public:
00038 
00039         DelPhiShared();
00040 
00042         void init();
00043 
00045         DelPhiShared(double scale,double perfill,string fn,bool map,bool status,bool multi,bool atinfo=false);
00046 
00048         void init(double scale,double perfill, string fn,bool eps_flag,bool stat_flag,bool multi,bool atinfo);
00049         
00052         void DelPhiBinding(     double xmin,double ymin,double zmin,
00053                                                 double xmax,double ymax,double zmax,
00054                                                 double c1,double c2,double c3,double rmax,double perf,
00055                                                 int* local_i_epsmap,int igrid,double scale,
00056                                                 double* local_i_scspos,double* local_i_scsnor,
00057                                                 bool* local_i_idebmap,int* local_i_ibgp,int maxbgp,bool status,int* atsurf);
00058 
00063         void finalizeBinding(int* ibnum);
00065         void clear();
00067         void saveEpsMaps(char* fname);
00069         void saveBGP(char* fname);
00071         void saveStatus(char* fname);
00073         void saveCavities(bool onlySaveNonFilled=false);
00075         void saveCavities2(bool onlySaveNonFilled,string sysName);
00078         int cavitiesToAtoms(double rad);
00080         void markPockets(short* status,vector<bool>& isPocket);
00082         void clearCav2Atoms();
00084         void initCav2Atoms();
00086         static void parseAtomInfo(char* atinfo,string mol,int na,double* xn1,double* rad);
00088         void saveIdebMap(char* fname);
00089         bool clearAndAllocEpsMaps();
00090         void clearEpsMaps();
00091         bool loadAtoms(string fn);
00092         bool loadAtoms(int na,double* pos,double* r,double* q,int* d,char* atinf);
00094         bool buildGrid(double scale,double perfill);
00095         bool getDelphiBinding()
00096         {
00097                 return delphiBinding;
00098         }
00099 
00100         void buildEpsmap(bool a)
00101         {
00102                 buildEpsMap = a;
00103         }
00104 
00105         void buildStatusmap(bool a)
00106         {
00107                 buildStatus = a;
00108         }
00109 
00110         bool getMultiDiel()
00111         {
00112                 return multi_diel;
00113         }
00114 
00115         int getNumAtoms()
00116         {
00117                 return numAtoms;
00118         }
00119         virtual ~DelPhiShared();
00120 
00122 
00123         // multi dielectric mode
00124         bool multi_diel;
00125         double scale;
00126         double perfill;
00127         bool delphiBinding;
00128         bool buildEpsMap;
00129         bool buildStatus;
00130         // epsmap is a four dimensional matrix
00131         int *epsmap,*ibgp;
00132         bool *idebmap;
00133         int maxbgp;
00134         double *scsnor,*scsarea,*scspos;
00135         bool isAvailableAtomInfo;
00136         int* atsurf;
00137         // face area = side*side;
00138         double A;       
00139         double* x;
00140         double* y;
00141         double* z;
00142         int nbgp;
00143         double side;
00144         int nx,ny,nz;
00145         // the status matrix is the status for each grid point:
00146         // -5 -> cavity point is inside a well shaped cavity (temporary)
00147         // -10 -> cavity point under shape check (temporary)
00148         // -1 -> point is inside
00149         // 2 -> point is temporary outside (may be really out or in cavity)
00150         // 3 -> point is really out
00151         // 4 -> point is in cavity number 1
00152         // 5 -> point is in cavity number 2
00153         // 6 -> point is in cavity number 3
00154         // and so on....
00155         // Thus 65536-4 cavities can be detected at best; it should be enough...        
00156         short* status;
00157         // This temporary variable is introduce to detect if a cavity has been split
00158         // in two subcavities during Connolly filtering. Is used by the difference
00159         // function
00160         short* tempStatus;
00161 
00162         double rmaxdim;
00163         double xmin,xmax,ymin,ymax,zmin,zmax;
00164         double baricenter[3];
00165         // atoms vector. Pointer to atom objects
00166         Atom** atoms;
00167         // num atoms
00168         int numAtoms;
00169         char file[BUFLEN];
00170         double hside;
00172         vector < vector <int* >* >* cavitiesVec;
00174         vector < double> cavitiesSize;
00176         vector <bool> cavitiesFlag;
00178         vector< set<int>* > cav2atoms;  
00179 }; 
00180 
00181 #endif