The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....

Interface of SDL_CStruct

  SDLVersionInfo = 'cstruct_r1050_full';
  IsLightEd = false;
  SDLVersionInfo = 'cstruct_r1050_lighted';
  IsLightEd = true;
  release = 1050;
  MaxLengCTab = 63;                          { maximal number of Atoms in Ctab }
  MaxConn = 10;                        { maximal number of connections allowed }
  MaxConnOld = 8;                      { maximal number of connections allowed }
  MaxRings = 100;                      { maximal number of rings in a molecule }
  MaxRingSize = 64;                          { number of atoms of largest ring }
  MaxDim = 3;                                  { number of graphics dimensions }

  AttribLin = $01;                    { attribute codes of atoms: linear chain }
  Attrib347R = $02;                      { ring of 3 or 4 or more than 6 atoms }
  Attrib5R = $04;                                            { ring of 5 atoms }
  Attrib6R = $08;                                            { ring of 6 atoms }
  AttribBranch = $10;                                         { branching atom }
  AttribAnyR = $20;                                                 { any ring }
  AttribTerm = $40;                                         { terminating atom }
  AttribCondR = $80;                                     { condensed ring atom }
  AttribNone = $00;                                             { no attribute }

  btNoBond = 0;                                          { bond types: no bond }
  btSingle = 1;                                                  { single bond }
  btDouble = 2;                                                  { double bond }
  btTriple = 3;                                                  { triple bond }
  btAromatic = 4;                                              { aromatic bond }

{------------- these few lines are provisional and have been included ---------}
{--- to get a quick solution to the MDL-SD-file problem -----------------------}
  MaxProps = 20;                                  { PROVISIONAL !! (see below) }
  TPropRec = record             { physical properties as read from MDL SD file }
               ID  : string[15]; { PROVISIONAL ! clear up things
                                   concerning MDL-SD later }
               Par : double;
  TProps = array[1..MaxProps] of TPropRec;

  SSSMode = (smSkeleton, smAtoms, smBonds, smAtomAndBonds);
                                                   { sub structure search mode }

  FrgType = (NSglBnd, { number of single bonds in molecule, aromat. not counted }
             NCCSgl,  { number of C-C single bonds, aromat. not counted }
             NDblBnd, { number of double bonds in molecule, aromat. not counted }
             NCCDbl,  { number of C-C double bonds, aromat. not counted }
             NTrplBnd,{ number of triple bonds in molecule }
             NCCTrpl, { number of C-C triple bonds }
             NAroBnd, { number of aromatic bonds }
             NBranch, { number of branching atoms }
             XCnt,    { number of halogen atoms in molecule }
             COOH,    { carbonic acid }
             COO,     { any -CO-O- group, no matter where, but not a COOH }
             NO2,     { any nitro group }
             AnyCO,   { any carbonyl group }
             AroCl,   { aromatic chlorine atom }
             AroBr,   { aromatic bromine atom }
             AnyOH,   { any hydroxyl group }
             PhOH,    { phenolic OH }
             NH2,     { terminal amino group - primary amine }
             NHR,     { secondary amine }
             NR2,     { tertiary amine }
             NCON,    { urea derivative }
             CN,      { nitrile }
             CONR2,   { amide }
             CHO,     { aldehyde }
             COX,     { halogen acid }
             AnySO,   { any sulfoxide group }
             OCH3,    { methoxy group }
             NO,      { nitroso group }
             NNH2);   { -NH-NH2 or -N=NH  }
  AtListType = record
                 NrAtoms : integer;
                 AtList  : array [1..MaxLengCTab] of integer;
  AtFlagType = array[1..MaxLengCTab] of byte;
  BondListType = array[1..MaxConn] of byte;
  RingType = record
               RingSize : byte;           { size of ring }
               AtList   : array[1..MaxRingSize] of byte;{ no.s of atoms in ring }
  RingListType = record
                   NrOfRings : integer; { number of valid rings in the ring list }
                   RList     : array [1..MaxRings] of RingType;  { list of rings }

  CoordUnitType = (cuUnknown, cuPixel, cuNanoM, cuPicoM, cuAngstrom);

  CTElem = record
             AtNum    : byte;                                    { atom number }
             AtWeight : byte;                     { atomic weight of that atom }
             AtFlag   : byte;                         { arbitrary working byte }
             Attrib   : byte;                             { attributes of atom }
             Charge   : shortint;                          { number of charges }
             ConnTo   : BondListType;                        { connected atoms }
             TypConn  : BondListType;                     { type of connection }
             Coords   : array[1..MaxDim] of single;         { 3D-graphics info }
             AtDispAtb: longint;       { display attributes used in TChemGraph }
             { TypConn : 1 = single bond
                         2 = double bond
                         3 = triple bond
                         4 = aromatic bond }
              { Attrib : Bit 0 = linear
                         Bit 1 = 3- or 4-atom ring, or more than 6 atoms
                         Bit 2 = 5-atom ring
                         Bit 3 = 6-atom ring
                         Bit 4 = branch
                         Bit 5 = any ring atom
                         Bit 6 = terminating atom
                         Bit 7 = condensed ring system }
           { AtDispAtb : Bits 0..25 .... color of atom when displayed
                         Bits 26..27 .... reserved
                         Bit 28 .... atom has to be displayed in bold
                         Bit 29 .... atom has to be displayed by inverted colors
                         Bit 30 .... atom has to be displayed in italic letters
                         Bit 31 .... display atom with structure default color }

  TCTab = class (TComponent)
            FOnChange     : TNotifyEvent;
            function  GetNBonds (AtIx: integer): integer;
            function  GetAtNum (AtIx: integer): byte;
            procedure SetAtNum (AtIx: integer; AtNum: byte);
            function  GetAtWeight (AtIx: integer): byte;
            procedure SetAtWeight (AtIx: integer; AtWeight: byte);
            function  GetCharge (AtIx: integer): shortint;
            procedure SetCharge (AtIx: integer; Charge: shortint);
            function  GetAtomEntries (AtIx: integer): CTElem;
            procedure SetAtomEntries (AtIx: integer; AE: CTElem);
            function  GetAtFlag (AtIx: integer): byte;
            procedure SetAtFlag (AtIx: integer; AtFlag: byte);
            function  GetAttrib (AtIx: integer): byte;
            procedure SetAttrib (AtIx: integer; Attrib: byte);
            function  GetCoords (AtIx, DimIx: integer): single;
            procedure SetCoords (AtIx, DimIx: integer; Coord: single);
            function  GetCoordsPresent: boolean;
            procedure SetCoordsPresent (value: boolean);
            function  GetConnTo (AtIx: integer; ConnIx: integer): byte;
            procedure SetConnTo (AtIx, ConnIx: integer; ConnTo: byte);
            function  GetTypConn (AtIx: integer; ConnIx: integer): byte;
            procedure SetTypConn (AtIx: integer; ConnIx: integer; Typ: byte);
            function  GetCASNr: string;
            procedure SetCASNr (InString: string);
            function  CheckCASNr (CASNum: longint): boolean;
            FNumValidAtoms: integer;                   { number of valid atoms }
            FStrucName    : string;                        { name of structure }
            FCASNr        : longint;                     { CAS registry number }
            FCoordUnit    : CoordUnitType;        { units of coordinate values }
            FAtomEntries  : array[1..MaxLengCTab] of CTElem;
            constructor Create (AOwner: TComponent); override;
            destructor  Destroy; override;
            function  AddAtom (AtomRec: CTElem): boolean;
            function  AtomCount (AtNum: byte): integer;
            function  CalcAttributes: integer;
            function  CalcMissingH: integer;
            function  CalcMolExtents (var MinX, MinY, MaxX, MAxY,
                         CentX, CentY: double): double;
            procedure CalcMolCenter (var spx, spy, spz: double);
            function  CalcMolecularFormula (var BForm: TFormulaRec): boolean;
            function  CalcChemMolWeight: double;
            procedure Changed;
            function  CheckConnect (At1,At2: integer): byte;
            procedure ClearAttributes;
            procedure Clear;
            function  CompareWith (CTabSource: TCTab): word;
            procedure CopyFrom (CTabSource: TCTab);
            procedure DeleteAtom (AtomNr: integer);
            function  FindAtomInBox (x, y, z, XRange, YRange,
                         ZRange: double): integer;
            procedure FindClosestAtom (x,y,z: double; var ClosestAtom: integer;
                         var Dist: double);
            function  ContainsUnconnectedAtom: boolean;
            procedure EnterConn (AtIx, Connto, TypConn: integer);
            function  FindNextEndAtom (AtIx: integer): integer;
            function  FindShortestRings (AtomIx: word;
                        var RingList: RingListType): integer;
            function  FindSSSR (var RingList: RingListType): integer;
            function  FragmentCount (FrgCode: FrgType): integer;
            function  FragmentCode (AtIx: integer;
                        var NOuterBonds: integer): longint;
            procedure JoinFragment (CTabSource: TCTab);
            procedure LinkFragment (CtabSource: TCTab);
            function  MakeConnection (At1,At2: integer; CType: byte): boolean;
            procedure MakeSymmetricConnections;
            function  MaxNBonds (var AtIx: integer):integer;
            procedure MatchAtomTemplate (An, Nb: shortint; TypB: BondListType;
                          var AtomsMatched: AtListType);
            function  NrHAtoms (AtIx: integer): integer;
            function  ReadFromClearTextFile (var AFile: textFile): boolean;
            function  ReadFromClearTextFileCTABG (var AFile:TextFile): boolean;
            function  ReadFromMDLCTabFile (var AFile:TextFile): boolean;
            function  ReadFromMDLCTabStream (InStream: TStream): boolean;
            function  ReadFromMDLMolStream (InStream: TStream): boolean;
            function  ReadFromMDLMolFile (var AFile:TextFile): boolean;
            function  ReadFromMDLSDFile (var AFile:TextFile;
                         var Props: TProps): boolean;
            function  ReadConnTabBody (var AFile:TextFile): boolean;
            procedure RemoveHydrogen;
            function  RingsInMolecule: integer;
            procedure RotateWithPCA;
            function  SearchSubStruc (CTabSmall: TCTab;
                          var MatchedAtoms: AtFlagType;
                          CompareBonds: boolean): boolean;
            function  StripfromChains: integer;
            function  SumForContained (CTabSmall: TCTab): boolean;
            procedure WriteToClearTextFile (var AFile:TextFile);
            procedure WriteToMDLCTabFile (var TFile:TextFile);
            procedure WriteToMDLCTabStream (OutStream: TStream);
            procedure WriteToMDLMolFile (var TFile:TextFile; User: ShortString;
                                          ProgName: string; Regnum: longint;
                                          comment: string);
            procedure WriteToMDLMolStream (OutStream: TStream; User: ShortString;
                                          ProgName: string; Regnum: longint;
                                          comment: string);
            procedure WriteToMolConnXFile (IdNum: integer; var AFile:TextFile);

            property  AtAttrib [AtIx: integer]: byte
                         read GetAttrib write SetAttrib;
            property  AtCharge [AtIx: integer]: shortint
                         read GetCharge write SetCharge;
            property  AtCoords [AtIx, DimIx: integer]: single
                         read GetCoords write SetCoords;
            property  AtConnTo [AtIx, ConnIx: integer]: byte
                         read GetConnTo write SetConnTo;
            property  AtTypConn [AtIx, ConnIx: integer]: byte
                         read GetTypConn write SetTypConn;
            property  AtFlag [AtIx: integer]: byte
                         read GetAtFlag write SetAtFlag;
            property  AtNum [AtIx: integer]: byte
                         read GetAtNum write SetAtNum;
            property  AtWeight [AtIx: integer]: byte
                         read GetAtWeight write SetAtWeight;
            property  AtomEntries [AtIx: integer]: CTElem
                         read GetAtomEntries write SetAtomEntries;
            property  BinCASNr: longint read FCASNr write FCASNr;
            property  CoordinatesPresent: boolean
                         read GetCoordsPresent write SetCoordsPresent;
            property  NAtoms: integer read FNumValidAtoms write FNumValidAtoms;
            property  NBonds [AtIx: integer]: integer read GetNBonds;
            property  CoordUnits: CoordUnitType read FCoordUnit write FCoordUnit;
            property  CASNr: string read GetCASNr write SetCASNr;
            property  StrucName: string read FStrucName write FStrucName;
            property  OnChange: TNotifyEvent read FOnChange write FOnChange;

  procedure ClearCTElem
         (var AtomRec : CTElem);
  function  RingInRingList
                (Ring : RingType;
             RingList : RingListType)
                      : boolean;
  function FragmentStr
              (InCode : longint)
                      : string;

Last Update: 2012-Oct-20