00001
00015 #if !defined(ABSTREE_H)
00016 #define ABSTREE_H
00017
00018
00019
00020 const int OpAnd = 0x01;
00021 const int OpOr = 0x02;
00022 const int OpNot = 0x03;
00023 const int OpEqual = 0x04;
00024 const int OpNotEq = 0x05;
00025 const int OpLess = 0x06;
00026 const int OpMore = 0x07;
00027 const int OpLessEq = 0x08;
00028 const int OpMoreEq = 0x09;
00029 const int OpConst = 0x0a;
00030 const int OpWithin = 0x0b;
00031 const int OpMember = 0xac;
00032
00033 const int OpLftProp = 0x10;
00034 const int OpLftVal = 0x20;
00035 const int OpRgtProp = 0x40;
00036 const int OpRgtVal = 0x80;
00037
00038
00039 const int PropIdent = 1;
00040 const int PropXCord = 2;
00041 const int PropYCord = 3;
00042 const int PropZCord = 4;
00043 const int PropTemp = 5;
00044 const int PropRad = 6;
00045 const int PropResId = 7;
00046 const int PropName = 8;
00047 const int PropChain = 9;
00048 const int PropResName = 10;
00049 const int PropSelect = 11;
00050 const int PropElemNo = 12;
00051 const int PropModel = 13;
00052 const int PropChemGroup = 14;
00053 const int PropMolPtr = 15;
00054 const int PropAtGroup = 16;
00055
00056 inline int PredAbsOrd( int x ) { return (x - 20); }
00057 inline int PredAbsChr( int x ) { return (x + 20); }
00058
00059 const int PredAlpha = 20;
00060 const int PredAmino = 21;
00061 const int PredAT = 22;
00062 const int PredBonded = 23;
00063 const int PredCG = 24;
00064 const int PredCystine = 25;
00065 const int PredDNA = 26;
00066 const int PredHelix = 27;
00067 const int PredHetero = 28;
00068 const int PredHydrogen = 29;
00069 const int PredIon = 30;
00070 const int PredLigand = 31;
00071 const int PredMainChain = 32;
00072 const int PredNucleic = 33;
00073 const int PredProtein = 34;
00074 const int PredPurine = 35;
00075 const int PredPyrimidine = 36;
00076 const int PredRNA = 37;
00077 const int PredSelected = 38;
00078 const int PredSheet = 39;
00079 const int PredSidechain = 40;
00080 const int PredSolvent = 41;
00081 const int PredTurn = 42;
00082 const int PredWater = 43;
00083
00084 const int PredAcidic = 44;
00085 const int PredAcyclic = 45;
00086 const int PredAliphatic = 46;
00087 const int PredAromatic = 47;
00088 const int PredBasic = 48;
00089 const int PredBuried = 49;
00090 const int PredCharged = 50;
00091 const int PredCyclic = 51;
00092 const int PredHydrophobic = 52;
00093 const int PredLarge = 53;
00094 const int PredMedium = 54;
00095 const int PredNeutral = 55;
00096 const int PredPolar = 56;
00097 const int PredSmall = 57;
00098 const int PredSurface = 58;
00099
00100
00101 #include "hastl.h"
00102 #include "haatom.h"
00103
00104 class HaMolSet;
00105
00106 #define SetSize 10
00107
00108 class Expr;
00109 class AtomCollection;
00110
00111 typedef union {
00112 AtomCollection *set;
00113 Expr *ptr;
00114 Long limit;
00115 long val;
00116 double dval;
00117 } Branch;
00118
00119
00120 class HaResidue;
00121 class HaChain;
00122
00123
00124 class Expr
00126 {
00127 public:
00128 Expr();
00129 Expr(int new_type, long rval, long lval);
00130 virtual ~Expr();
00131
00132 int type;
00133 Branch rgt;
00134 Branch lft;
00135
00136 long EvaluateExprFor(HaAtom* aptr);
00137 long EvaluateProperty(long prop );
00138
00139 static void DeAllocateExpr(Expr *expr );
00140
00141 static int DefineSetExpr( char*, Expr* );
00142 static Expr* LookUpAtGroupExpr( const char* grp_name, HaMolSet* pmset);
00143 static Expr* LookUpElement( const char* );
00144 static int ParsePrimitiveExpr( HaMolSet* pmset, char** ptr_str_parse);
00145
00146 protected:
00147
00148 inline int OpCode() { return(type & 0x0f); }
00149 long EvaluateExpr();
00150
00151 static HaAtom* QAtom;
00152 static HaResidue* QGroup;
00153 static HaChain* QChain;
00154
00155 };
00156
00157 const double SelectRad = 0.4/BOHR_TO_ANG;
00158
00159 #ifdef ABSTREE_CPP
00160
00161 Expr *QueryExpr=NULL;
00162 HaAtom *PkAtom=NULL;
00163
00164 #else
00165
00166 extern Expr *QueryExpr;
00167 extern HaAtom *PkAtom;
00168
00169
00170 #endif // end ifdef ABSTREE_CPP
00171
00172 #endif // end if !defined(ABSTREE_H)