13.07.2015 Views

OEChem - API Manual

OEChem - API Manual

OEChem - API Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>OEChem</strong> - <strong>API</strong> <strong>Manual</strong>version 1.7.0OpenEye Scientific Software, Inc.March 2, 20099 Bisbee Ct, Suite DSanta Fe, NM 87508www.eyesopen.comsupport@eyesopen.com


Copyright c○ 1997-2009 OpenEye Scientific Software, Santa Fe, New Mexico. All rights reserved.All rights reserved. This material contains proprietary information of OpenEye Scientific Software. Use of copyrightnotice is precautionary only and does not imply publication or disclosure.The information supplied in this document is believed to be true but no liability is assumed for its use or theinfringement of the rights of others resulting from its use. Information in this document is subject to changewithout notice and does not represent a commitment on the part of OpenEye Scientific Software.This package is sold/licensed/distributed subject to the condition that it shall not, by way of trade or otherwise,be lent, re-sold, hired out or otherwise circulated without OpenEye Scientific Software’s prior consent, in anyform of packaging or cover other than that in which it was produced. No part of this manual or accompanyingdocumentation, may be reproduced, stored in a retrieval system on optical or magnetic disk, tape, CD, DVD orother medium, or transmitted in any form or by any means, electronic, mechanical, photocopying recording orotherwise for any purpose other than for the purchaser’s personal use without a legal agreement or other writtenpermission granted by OpenEye.This product should not be used in the planning, construction, maintenance, operation or use of any nuclear facilitynor the flight, navigation or communication of aircraft or ground support equipment. OpenEye Scientific software,shall not be liable, in whole or in part, for any claims arising from such use, including death, bankruptcy or outbreakof war.Windows is a registered trademark of Microsoft Corporation. Apple and Macintosh are registered trademarks ofApple Computer, Inc. AIX and IBM are registered trademarks of International Business Machines Corporation.UNIX is a registered trademark of the Open Group. RedHat is a registered trademark of RedHat, Inc. Linux isa registered trademark of Linus Torvalds. Alpha is a trademark of Digital Equipment Corporation. SPARC is aregistered trademark of SPARC International Inc.SYBYL is a registered trademark of TRIPOS, Inc. MDL is a registered trademark and ISIS is a trademark ofMDL Information Systems, Inc. SMILES, SMARTS, and SMIRKS may be trademarks of Daylight ChemicalInformation Systems. Macromodel is a trademark of Schrödinger, Inc. Schrödinger, Inc may be a wholly ownedsubsidiary of the Columbia University, New York.Python is a trademark of the Python Software Foundation. Java is a trademark or registered trademark of SunMicrosystems, Inc. in the U.S. and other countries.“The forefront of chemoinformatics” is a trademark of Daylight Chemical Information Systems, Inc.Other products and software packages referenced in this document are trademarks and registered trademarks oftheir respective vendors or manufacturers.


CONTENTSI Introduction 11 Overview 22 C++ Compilers and Platforms 32.1 Native Compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 GNU C/C++ Compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4II OEBio Library 53 OEBIO 64 OEBio Classes and Member Functions 74.1 OEHierChain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 OEHierFragment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.3 OEHierResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.4 OEHierView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.5 OESequenceAlignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 OEBio Functions 155.1 OECopyCrystalSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.2 OEExpandCrystalSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.3 OEGetAlignmentMethodName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.4 OEGetChis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.5 OEGetCrystalSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.6 OEGetSpaceGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.7 OEGetSpaceGroupNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.8 OEGetPhi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.9 OEGetPsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.10 OEGetProteinTorsionName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.11 OEGetResidueAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.12 OEGetAlignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.13 OEGetTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.14 OEHasBondedResidues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.15 OEHasCrystalSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.16 OEIsStandardProteinResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.17 OERMSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18ii


5.18 OESetCrystalSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.19 OESetTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.20 OESwapAIEResidueAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.21 OEWriteAlignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 OEBio Functors 216.1 OEHasPDBAtomIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.2 OEIsAlphaCarbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.3 OEIsBackboneAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 OEBio Namespaces 237.1 OEAssumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237.2 OEProtTorType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237.3 OESeqAlignmentMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24III <strong>OEChem</strong> Library 258 <strong>OEChem</strong> Classes and Member Functions 268.1 OEAbsCanonicalConfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268.2 OEAbsoluteConfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268.3 OEAtomBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278.4 OEBondBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388.5 OECartesianToInternal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438.6 OECliqueSearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448.7 OEConfBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458.8 OEConfBaseT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458.9 OEConfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498.10 OEDefaultConfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498.11 OEEuler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508.12 OEExprBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508.13 OEFuzzy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518.14 OEInternalToCartesian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538.15 OEIsomericConfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538.16 OELibaryGen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548.17 OELingoSim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588.18 OEMatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608.19 OEMatchBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628.20 OEMatchPair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648.21 OEMCMolBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648.22 OEMCMolBaseT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658.23 OEMCSFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688.24 OEMCSMaxAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698.25 OEMCSMaxBonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698.26 OEMCSMaxAtomsCompleteCycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708.27 OEMCSMaxBondsCompleteCycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708.28 OEMCSSearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718.29 OEMol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758.30 OEMolBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778.31 oemolistream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838.32 oemolostream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878.33 oemolstreambase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90iii


8.34 OEQAtomBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908.35 OEQBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918.36 OEQBondBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918.37 OEQMol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 918.38 OEQMolBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938.39 OEQuaternion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948.40 OERotMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958.41 OEResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958.42 OESubSearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.43 OETrans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038.44 OETransBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048.45 OETranslation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058.46 OEUniMolecularRxn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058.47 OEVectorBindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079 <strong>OEChem</strong> Functions 1099.1 OE3DToAtomStereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.2 OE3DToBondStereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.3 OE3DToInternalStereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.4 OEAddExplicitHydrogens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.5 OEAddMols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109.6 OEAssignAromaticFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109.7 OEAssignBondiVdWRadii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119.8 OEAssignCovalentRadii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119.9 OEAssignDelphiRadii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119.10 OEAssignFormalCharges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119.11 OEAssignHybridization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.12 OEAssignImplicitHydrogens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.13 OEAssignMDLHydrogens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.14 OEAssignPaulingVdWRadii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.15 OEAssignResidueNumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.16 OEAssignSerialNumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.17 OEAssignZap9Radii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.18 OEAtomGetMDLParity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.19 OEAtomGetResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.20 OEAtomGetSmallestRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.21 OEAtomIsInAromaticRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149.22 OEAtomIsInRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149.23 OEAtomSetMDLParity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149.24 OEAtomSetResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149.25 OEBondGetSmallestRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149.26 OEBondIsInAromaticRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159.27 OEBondIsInRingSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159.28 OECalcCartesianCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159.29 OECalcInternalCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159.30 OECalculateMolecularWeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159.31 OECanonicalOrderAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169.32 OECanonicalOrderBonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169.33 <strong>OEChem</strong>GetPlatform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169.34 <strong>OEChem</strong>GetRelease . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169.35 <strong>OEChem</strong>GetVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169.36 <strong>OEChem</strong>IsLicensed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117iv


9.37 OECenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1179.38 OEClearAromaticFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1179.39 OEClearPartialCharges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189.40 OECreateAbsSmiString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189.41 OECreateCanSmiString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189.42 OECreateIsoSmiString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189.43 OECreateSlnString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1199.44 OECreateSmiString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1209.45 OEDefaultImplicitHCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219.46 OEDefaultMDLHCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219.47 OEDeleteEverythingExceptTheFirstLargestComponent . . . . . . . . . . . . . . . . . . . . . . 1219.48 OEDetermineComponents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219.49 OEDetermineConnectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219.50 OEDetermineRingSystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229.51 OEDoubleBondCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229.52 OEEulerRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229.53 OEExactGraphMatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229.54 OEExpandSuperAtoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229.55 OEFindRingAtomsAndBonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1239.56 OEFormalPartialCharges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1239.57 OEGasteigerInitialCharges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1239.58 OEGasteigerPartialCharges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1239.59 OEGetAbsTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249.60 OEGetAminoAcidCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249.61 OEGetAngle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249.62 OEGetAtomComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259.63 OEGetAtomicNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259.64 OEGetAtomicSymbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259.65 OEGetAutomorphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259.66 OEGetAverageWeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1259.67 OEGetBondiVdWRadius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269.68 OEGetComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269.69 OEGetCovalentRadius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269.70 OEGetDefaultMass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269.71 OEGetDelphiRadius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269.72 OEGetDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279.73 OEGetDistance2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279.74 OEGetFileExtension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279.75 OEGetFileType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.76 OEGetFormatExtension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.77 OEGetFormatString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.78 OEGetHybridization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.79 OEGetIsotopicWeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.80 OEGetPackedCoords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289.81 OEGetPaulingVdWRadius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1299.82 OEGetPDBAtomIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1299.83 OEGetPDBAtomName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1299.84 OEGetPathLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1299.85 OEGetResidueIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1309.86 OEGetResidueName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1309.87 OEGetSmallestSubtree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130v


9.139 OEReadMDLFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1429.140 OEReadMol2File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1429.141 OEReadMolecule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1429.142 OEReadMOPACFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1439.143 OEReadOldBinary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1439.144 OEReadPDBFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1439.145 OEReadSketchFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1449.146 OEReadXYZFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1449.147 OEResidueHydrogens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1449.148 OERMSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1449.149 OERotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.150 OESameChain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.151 OESameResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.152 OEScrambleMolecule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.153 OESet3DHydrogenGeom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.154 OESetAtomComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.155 OESetComment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469.156 OESetDimensionFromCoords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479.157 OESetPackedCoords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479.158 OESetTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479.159 OESingleBondCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479.160 OESmilesAtomCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.161 OESubsetMol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.162 OESuppressHydrogens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.163 OETheFunctionFormerlyKnownAsStripSalts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1499.164 OETranslate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1499.165 OETripleBondCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1499.166 OETriposAtomNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1499.167 OETriposAtomType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.168 OETriposAtomTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.169 OETriposAtomTypeNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.170 OETriposBondTypeNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1519.171 OETriposTypeElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1519.172 OETriposTypeIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1519.173 OETriposTypeName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1519.174 OETriposTypeNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1519.175 OEWriteCDXFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.176 OEWriteFASTAFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.177 OEWriteMacroModelFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.178 OEWriteMDLFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.179 OEWriteMOPACInputFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1539.180 OEWriteMol2File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1539.181 OEWritePDBFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1539.182 OEWriteMolecule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1549.183 OEWriteXYZFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15510 <strong>OEChem</strong> Functors 15610.1 OEAtomIsInResidue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15610.2 OEAtomIsInRing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.3 OEBondIsInRing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.4 OEGetNbrAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.5 OEHasAlphaBetaUnsat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158vii


10.6 OEHasAtomicNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15810.7 OEHasAtomIdx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15910.8 OEHasAtomName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15910.9 OEHasAtomStereoSpecified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16010.10 OEHasBondIdx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16010.11 OEHasBondStereoSpecified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16110.12 OEHasChainID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16110.13 OEHasConfIdx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16110.14 OEHasFragmentNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16210.15 OEHasIdx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16210.16 OEHasMapIdx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16310.17 OEHasOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16310.18 OEHasResidueNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16410.19 OEIsAromaticAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16410.20 OEIsAromaticBond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16510.21 OEIsCAlpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16510.22 OEIsCarbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16510.23 OEIsChiralAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16610.24 OEIsChiralBond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16610.25 OEIsHalogen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16710.26 OEIsHeavy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16710.27 OEIsHydrogen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16810.28 OEIsMember . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16810.29 OEIsMemberPtr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16910.30 OEIsNitrogen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16910.31 OEIsOxygen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17010.32 OEIsPhosphorus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17010.33 OEIsPolar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17110.34 OEIsPolarHydrogen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17110.35 OEIsRGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17210.36 OEIsRotor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17210.37 OEIsSulfur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17210.38 OEMatchFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17310.39 OENthAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17310.40 OEPartPred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17411 <strong>OEChem</strong> Constants 17511.1 OEAroModel Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17512 <strong>OEChem</strong> Template Functions 17612.1 OECalcInertialTensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17612.2 OESetCoordsToInertialFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17613 <strong>OEChem</strong> Namespaces 17713.1 OEAroType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17713.2 OECounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17813.3 OEElemNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17813.4 OEExprOpts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18013.5 OEExprType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18613.6 OEFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18713.7 OEFuzzVal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18713.8 OEIFlavor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188viii


13.9 OEOFlavor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19013.10 OEHybridization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19513.11 OEMCMolType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19613.12 OEMDLOFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19613.13 OEMModTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19613.14 OEMolBaseType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19813.15 OEMOPACOFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19813.16 OEPDBAtomName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19813.17 OEPDBIFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20013.18 OEPDBOFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20013.19 OEPreserveResInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20013.20 OEProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20113.21 OEQMolType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20213.22 OEResidueIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20213.23 OERxnRole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20313.24 OESmiFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20413.25 OETriposType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20413.26 OEWriteMolReturnCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205IV OESystem Library 20614 OESystem Classes and Member Functions 20714.1 OEBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20714.2 OEBaseData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21114.3 OEBitVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21214.4 OEContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21614.5 OEDots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21614.6 OEErrorHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21614.7 OEErrorHandlerImplBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21814.8 OEInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21814.9 OEParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22314.10 OERandom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23014.11 OEStopwatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23015 OESystem Functions 23215.1 OEBitVectorAnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.2 OEBitVectorEqual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.3 OEBitVectorNot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.4 OEBitVectorOr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23215.5 OEBitVectorSub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23315.6 OEBitVectorXor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23315.7 OEGetTag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23315.8 OEGetThreadSafe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23415.9 OEHasTag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23415.10 OENumberToString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23415.11 OESetThreadSafe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23515.12 OEStringJoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23515.13 OEStringLower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23515.14 OEStringMatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23615.15 OEStringSimplifyWhiteSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23615.16 OEStringStripWhiteSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236ix


15.17 OEStringTokenize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23615.18 OEStringTokenizeQuoted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23615.19 OEStringToNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23715.20 OEStringTranslate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23715.21 OEStringUpper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23715.22 OETanimoto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23715.23 OEConfigure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23815.24 OECheckHelp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24115.25 OEParseCommandLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24215.26 OEParseCommandLineLW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24415.27 OEWriteSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24516 OESystem Templates 24616.1 OEAnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24616.2 OEFactory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24616.3 OEGetDataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24716.4 OEIter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24716.5 OEIterBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24916.6 OENot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25016.7 OEOr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25016.8 OETypedParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25016.9 OETypeId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25116.10 OEUnaryFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25116.11 OEUnaryPredicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25217 OESystem Globals 25317.1 OEThrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253V OEMath Library 25418 OEMath Constants 25618.1 Deg2Rad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25618.2 Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25618.3 Pi2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25618.4 Rad2Deg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25619 OEMath Template Functions 25719.1 OEGeom2DAdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25719.2 OEGeom2DAngle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25719.3 OEGeom2DCopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25719.4 OEGeom2DDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25719.5 OEGeom2DDistance2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.6 OEGeom2DDotProd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.7 OEGeom2DMidpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.8 OEGeom2DNormalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.9 OEGeom2DSubtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.10 OEGeom2DScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25819.11 OEGeom3DAbsTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25919.12 OEGeom3DAdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25919.13 OEGeom3DAngle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25919.14 OEGeom3DAngleCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259x


19.15 OEGeom3DCopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25919.16 OEGeom3DCrossProd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.17 OEGeom3DDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.18 OEGeom3DDistance2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.19 OEGeom3DDotProd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.20 OEGeom3DEulerRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.21 OEGeom3DMidpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.22 OEGeom3DNormalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26019.23 OEGeom3DRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.24 OEGeom3DRotVectorToTransform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.25 OEGeom3DSubtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.26 OEGeom3DScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.27 OEGeom3DTorsion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.28 OEGeom3DTranslate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26119.29 OEGeom3DVolume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.30 OEGeom3DPlanarCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.31 OEGeom3DTetraCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.32 OEGeom3DEulerToRotMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.33 OEGeomQuaternionMultiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.34 OEGeomNormalizeQuaternion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26219.35 OEGeom3DQuaternionToRotMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26319.36 OEGeom3DMatrixMultiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26319.37 OEGeom3DQuaternionRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26319.38 OEGeom3DUnitQuaternionRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263VI OEPlatform Library 26420 OEPlatform Classes and Member Functions 26520.1 OEDirectoryScan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26520.2 oeifstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26620.3 oeigzstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26620.4 oeipstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26720.5 oeisstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26720.6 oeistdstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26820.7 oeistream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26920.8 oeiwrapperstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27220.9 OEMutex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27320.10 oeofstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27320.11 oeogzstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27420.12 oeopstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27420.13 oeosstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27520.14 oeostdstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27620.15 oeostream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27720.16 oeowrapperstream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27820.17 oestream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27920.18 OETryMutex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28021 OEPlatform Functions 28221.1 OECloseIStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28221.2 OECloseOStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28221.3 OECompressionAvailable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282xi


21.4 OECompress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28221.5 OECreateDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.6 oeendl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.7 oeends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.8 oeflush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.9 OEGetUserName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.10 OEOpenIStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28321.11 OEOpenOStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28421.12 OERegisterIStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28421.13 OERegisterOStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28521.14 OERenameFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28521.15 OESleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28521.16 OEUncompress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28521.17 OEUnlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28521.18 OEUnlinkDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28621.19 operator


Part IIntroduction1


CHAPTERONEOverviewThis reference manual describes OpenEye Scientific Software’s <strong>OEChem</strong> library. This manual strives to describeboth the semantics and the expected behavior of every function in the <strong>OEChem</strong> library. The descriptions are terseand directed at a user who is already familiar with the general form and use of <strong>OEChem</strong>’s objects and functions (asdescribed in the theory manual). As mush as possible, we have attempted to unify the descriptions of <strong>API</strong> pointsfor the different programming and scripting languages supported in <strong>OEChem</strong>. We do this first as a discipline tominimize the differences in behavior, second, to provide a natural place for the discussion of any small differencesin behavior which may arise, and finally, to aide in porting end-user code from one of the supported languages toanother.As with any reference material, one of the most critical aspects is the ability to locate pertinent information efficiently.Currently, the method of choice for finding information in this reference guide is its very extensive table ofcontents. While we believe this is adequate for most tasks, we hope to add further indexing and cross-referencingin the future.We hope you enjoy, benefit from, and critique this reference manual.2


CHAPTERTWOC++ Compilers and PlatformsThe <strong>OEChem</strong> Libraries are currently supported on the following platforms:• x86 Linux on Intel Pentium series and AMD Athlon processors.• x86 64 Linux on Intel Pentium series and AMD Athlon processors.• Apple OS X 10.4 on Intel and PowerPC processors.• Microsoft Windows 2000 and XP on x86.• IBM AIX 5.3 on PowerPC processors.• Linux on Itanium2 processors (SGI Altix).• Linux on IBM pSeries PowerPC processors.• RedHat Cygwin (Mingw only) on Microsoft Windows on x86.• SUN Solaris 2.10 on SPARC and x64 processors.• Legacy SGI IRIX 6.5 on MIPS processors.Due to the use of C++, and the lack or instability of a standardized C++ ABIs on many operating systems, versionsof the <strong>OEChem</strong> libraries are provided for different compilers, and even different compiler versions. Typically,<strong>OEChem</strong> is available for the system’s native C++ compiler, for GNU g++ 3.4.3 , and also for GNU g++ version4.1.2 on x86 and x86 64 Linux systems.2.1 Native CompilersThe only native compilers unable to build OpenEye’s libraries are SUN Microsystem’s Forte compilers prior toversion 5.5, Microsoft Visual C/C++ prior to versions 7.1 and system compilers on RedHat 6.x and earlier.On MIPS IRIX, MIPSPro C/C++ v7.41 or later is recommended.On IBM AIX, Visual Age C/C++ (xlC) version 7.0 or later is recommended.3


4 Chapter 2. C++ Compilers and Platforms2.2 GNU C/C++ CompilersCurrently, 3.4.3 is the preferred version of GCC for OpenEye’s libraries.When OpenEye’s libraries are build with a GCC that isn’t the system compiler on that system, the compiler istypically ”configured” with the –disable-shared option, so that there are no dependencies on shared libraries, suchas /usr/local/lib/libstdc++.so. Unfortunately, on a few platforms, such as Solaris 2.10 this isn’t possible, as it wouldbe impossible to use <strong>OEChem</strong> in a shared library, if its built on top of a non-shared libstdc++. This may be fixedin future releases of GCC.On ia64-unknown-linux-gnu, we recommend configuring GCC with both the GNU assembler and GNU linkerfrom GNU binutils 2.14 or later.On mips-sgi-irix6.5, we had to configure GCC 3.4.3 with –disable-c-mbchar to work around IRIX portabilityproblems with IRIX 6.5 prior to 6.5.19.


Part IIOEBio Library5


CHAPTERTHREEOEBIO6


CHAPTERFOUROEBio Classes and Member Functions4.1 OEHierChainclass OEHierChainThis class represents a snapshot of one of the chains inside the molecule used to construct the OEHierView objectwhich owns the OEHierChain object. It can be used to give a temporary hierarchical view to the underlyingmolecular data structure.4.1.1 ConstructorsOEHierChain ( ) ;OEHierChain ( const OEHierChain &);Default and copy constructors4.1.2 operator =OEHierChain &operator=(const OEHierChain &);Default assignment operator4.1.3 Destructor˜ OEHierChain ( ) ;Cleans up all memory and destroys object.4.1.4 GetChainIDchar GetChainID ( ) const ;7


8 Chapter 4. OEBio Classes and Member FunctionsReturns the single character representation of the chain ID for this chain of the molecule. This corresponds to thechain ID found in the PDB file.4.1.5 GetOEResidueconst OEResidue &GetOEResidue ( ) const ;This returns an arbitrary OEResidue object associated with this chain.4.1.6 GetFragmentsOESystem : : OEIterBase∗ GetFragments ( ) ;OESystem : : OEIterBase∗ GetFragments ( ) const ;Returns an interator over all of the fragments in the chain.4.1.7 GetResidueOEHierResidue &GetResidue ( const char∗ resName , int resIdx ) ;const OEHierResidue &GetResidue ( const char∗ resName , int resIdx ) const ;Gives direct access to a residue using the typical information that a user might know about a residue of interest(e.g. - THR242). The chain specifier is not included because the chain is implied by the current object.4.1.8 GetAtom<strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) ;const <strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) const ;Returns an atom specified by the residue name, residue number and atom name.4.2 OEHierFragmentclass OEHierFragmentThe hierarchical view has an OEHierFragment object in the hierarcy between OEHierChain andOEHierResidue. This gives a hierarchical view of a temporary snapshot of the data structure in the moleculeused to construct the OEHierView which owns the fragment objects.4.2.1 ConstructorsOEHierFragment ( ) ;OEHierFragment ( const OEHierFragment &);


4.2. OEHierFragment 9Default and copy constructors4.2.2 operator =OEHierFragment &operator=(const OEHierFragment &);Default assignment operator4.2.3 Destructor˜ OEHierFragment ( ) ;Cleans up all memory and destroys object.4.2.4 GetFragmentNumberint GetFragmentNumber ( ) const ;Returns the integer representation of the fragment number for this fragment of the chain. While reading a PDBfile, fragment numbers are incremented every time a TER record is encountered or a new ChainID is encountered.4.2.5 GetOEResidueconst OEResidue &GetOEResidue ( ) const ;This returns an arbitrary OEResidue object associated with this fragment.4.2.6 GetResiduesOESystem : : OEIterBase∗ GetResidues ( ) ;OESystem : : OEIterBase∗ GetResidues ( ) const ;Returns an interator over all of the residues in the fragment.4.2.7 GetAtom<strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) ;const <strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) const ;Returns an atom specified by the residue name, residue number and atom name.4.2.8 GetResidueOEHierResidue &GetResidue ( const char∗ resName , int resIdx ) ;const OEHierResidue &GetResidue ( const char∗ resName , int resIdx ) const ;


10 Chapter 4. OEBio Classes and Member FunctionsGives direct access to a residue using the typical information that a user might know about a residue of interest(e.g. - THR242). The chain specifier is not included because the chain is implied by the current object.4.3 OEHierResidueclass OEHierResidueThis is the lowest temporary object in the hierarchical view. OEHierResidue objects are available from withinthe OEHierFragment object and give access to the OEAtomBase objects within the molecule at the time theparent OEHierView was created. Any atom deletions or additions after the creation of the OEHierView willnot be available in the object. However, changes to atoms or bonds will be available via the OEAtomBase api.The bonds of a molecule are not directly available throught the OEHierView object, but instead must be accessedvia the OEAtomBase::GetBonds api point.4.3.1 ConstructorsOEHierResidue ( ) ;OEHierResidue ( const OEHierResidue &);Default and copy constructors4.3.2 operator =OEHierResidue &operator=(const OEHierResidue &);Default assignment operator4.3.3 Destructor˜ OEHierResidue ( ) ;Cleans up all memory and destroys object.4.3.4 GetResidueNumberint GetResidueNumber ( ) const ;Returns the integer representation of the residue number for this residue of the fragment.4.3.5 GetOEResidueconst OEResidue &GetOEResidue ( ) const ;This returns an arbitrary OEResidue object associated with this OEHierResidue.4.3.6 GetAtom


4.4. OEHierView 11<strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) ;const <strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) const ;Returns an atom specified by the residue name, residue number and atom name.4.3.7 GetAtomsOESystem : : OEIterBase∗ GetAtoms ( ) ;OESystem : : OEIterBase∗ GetAtoms ( ) const ;Returns an interator over all of the atoms in the residue.4.4 OEHierViewclass OEHierViewThe HierView class provides a convenient method for examining biological molecules as if they were hierarchicaldata. We would like to emphasize that hierarchical views can be fraught with inefficiencies. Despite this,they are such a common means of thinking about macromolecules, that we provide access to <strong>OEChem</strong> moleculesin this manner. The HierView class takes a snapshot of an OEMolBase and then provides convenient access toa hierarchical view of the data. Note: Unlike typical <strong>OEChem</strong> iterators that closely track changes to a molecule,the hierarchy view is based on a snapshot of the molecule. One should use the assignment operator to update thehierarchical view after any change to the molecule.4.4.1 ConstructorsOEHierView ( )OEHierView ( const OEHierView &)OEHierView ( const OEMolBase &)There are three constructors for OEHierView. The default and copy constructors are defined and behave asexpected. The third constructor takes an OEMolBase as an argument. This constructor takes a snapshot of themolecule and sets up a hierarchichal data view of the molecule. This allows hierarchical access to the molecule viathe OEIter class. Note: Unlike typical <strong>OEChem</strong> iterators that closely track changes to a molecule, the hierarchyview is based on a snapshot of the molecule. One should use the assignment operator to update the hierarchicalview after any change to the molecule.4.4.2 Assignment OperatorsOEHierView &operator=(const OEHierView &)OEHierView &operator=(const OEMolBase &)The first assignment operator takes an OEHierView argument and behaves as expected, making an exact copyof the object. The second assignment operator takes an OEMolBase argument and makes a hierarchical view ofa snapshot of the molecule. This allows hierarchical access to the molecule via the OEIter class. Note: Unliketypical <strong>OEChem</strong> iterators that closely track changes to a molecule, the hierarchy view is based on a snapshot of


12 Chapter 4. OEBio Classes and Member Functionsthe molecule. One should use the assignment operator to update the hierarchical view after any change to themolecule.4.4.3 Destructors˜ OEHierView ( )Cleans up any memory owned by the class.4.4.4 GetChainsOESystem : : OEIterBase∗ GetChains ( ) ;OESystem : : OEIterBase∗ GetChains ( ) const ;Returns an interator over all of the chains in the hierarchical view.4.4.5 GetFragmentsOESystem : : OEIterBase∗ GetFragments ( ) ;OESystem : : OEIterBase∗ GetFragments ( ) const ;Returns an interator over all of the fragments in the hierarchical view.4.4.6 GetResiduesOESystem : : OEIterBase∗ GetResidues ( ) ;OESystem : : OEIterBase∗ GetResidues ( ) const ;Returns an interator over all of the residues in the hierarchical view.4.4.7 GetAtom<strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( char chainID , const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) ;const <strong>OEChem</strong> : : OEAtomBase ∗GetAtom ( char chainID , const char∗ resName ,int resIdx , unsigned pdbAtomIdx ) const ;Returns an atom specified by the chainID, residue name, residue number and atom name.4.4.8 GetAtomsOESystem : : OEIterBase∗ GetAtoms ( ) ;OESystem : : OEIterBase∗ GetAtoms ( ) const ;Returns an interator over all of the atoms in the hierarchical view.4.4.9 GetResidue


4.5. OESequenceAlignment 13OEHierResidue &GetResidue ( char chainID , const char∗ resName , int resIdx ) ;const OEHierResidue &GetResidue ( char chainID , const char∗ resName , int resIdx ) const ;Gives direct access to a residue using the typical information that a user might know about a residue of interest(e.g. - THR242 of chain ’A’).4.5 OESequenceAlignmentThis class contains information regarding a sequence alignment between two molecules that have residue information.The class includes information concerning the methods used to generate the alignment as well asOEMatch information for either the alpha carbons or all the backbone atoms that are paired by the alignment.The OESequenceAlignment class can be passed to an OEBio::OERMSD function to generate 3D alignmentbased on the sequence alignment, and can also be passed to the OEWriteAlignment function to generate astandard sequence alignment text output.4.5.1 ConstructorsOESequenceAlignment ( ) ;OESequenceAlignment ( const OESequenceAlignment &);Default and copy constructors4.5.2 operator =OESequenceAlignment &operator=(const OESequenceAlignment &);Default assignment operator4.5.3 Destructor˜ OESequenceAlignment ( ) ;Cleans up all memory and destroys object.4.5.4 Clearvoid Clear ( )Resets the object to the state in which it is default constructed.4.5.5 GetMethodunsigned GetMethod ( )const


14 Chapter 4. OEBio Classes and Member FunctionsReturns the unsigned integer that corresponds to one of the constants in the namespaceOESeqAlignmentMethod. This is the method that was used to create the alignment.4.5.6 GetGapint GetGap ( )constReturns an integer that is the gap penalty used in creating the sequence alignment.4.5.7 GetExtendint GetExtend ( )constReturns an integer that is the extention penalty used in creating the sequence alignment.4.5.8 GetScoreint GetScore ( )constReturns an integer that is the score of the sequence alignment.4.5.9 GetMaxSeqIdxunsigned int GetMaxSeqIdx ( )constReturns a pointer that is the maximum index of any of the sequences used in the alignment.4.5.10 GetBackboneMatchconst <strong>OEChem</strong> : : OEMatch &GetBackboneMatch ( unsigned idx1=0 ,unsigned idx2=1)Returns and <strong>OEChem</strong>::OEMatch that is the alignment of backbone atoms between the sequences indicated byidx1 and idx2. By default, the indicies are 0 and 1 respectivelly, corresponding to a simple pairwise alignment.4.5.11 GetCAlphaMatchconst <strong>OEChem</strong> : : OEMatch &GetCAlphaMatch ( unsigned idx1=0 ,unsigned idx2=1)Returns and <strong>OEChem</strong>::OEMatch that is the alignment of alpha carbon atoms between the sequences indicatedby idx1 and idx2. By default, the indicies are 0 and 1 respectivelly, corresponding to a simple pairwise alignment.


CHAPTERFIVEOEBio Functions5.1 OECopyCrystalSymmetrybool OECopyCrystalSymmetry ( const <strong>OEChem</strong> : : OEMolBase &src , <strong>OEChem</strong> : : OEMolBase &dst ) ;This function copies any existing crystal symmetry from the source molecule to the destination molecule. Thisfunction returns false if there was no symmetry to copy and true otherwise.5.2 OEExpandCrystalSymmetrybool OEExpandCrystalSymmetry ( <strong>OEChem</strong> : : OEMolBase &m , float radius , float ∗center = 0 ) ;This function expands atoms to fill the desired radius and optional center using the existing crystal symmetry onthe molecule. If no center is specified, the center of the molecule is used. This function adds symmetry atoms andbonds to the molecule.5.3 OEGetAlignmentMethodNameconst char∗ OEGetAlignmentMethodName ( unsigned int methodIdx )Takes an argument from the OESeqAlignmentMethod namespace and returns a const char* version forconvenience in writing output.5.4 OEGetChisOESystem : : OEIterBase ∗OEGetChis ( OEHierResidue &res ) ;OESystem : : OEIterBase ∗OEGetChis ( <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;15


16 Chapter 5. OEBio FunctionsThese functions return an interator over all the the side-chain rotor indicators that are associated witha particularresidue.5.5 OEGetCrystalSymmetrybool OEGetCrystalSymmetry ( const <strong>OEChem</strong> : : OEMolBase &mol ,float &a , float &b , float &c ,float &alpha , float &beta , float &gamma ,unsigned int &sgnumber ) ;This function retrieves the crystal symmetry information from the molecule. The standard cell lengths a,b andc are returned along with the cell angles alpha, beta and gamma and spacegroup number sgnumber fromthe International Crystallographic Tables.5.6 OEGetSpaceGroupbool OEGetSpaceGroup ( std : : string &spacegroup ,unsigned int sgnumber ,bool shortname = false ) ;This function assigns the standard spacegroup name referenced by sgnumber to spacegroup. If shortnameis true then the standard shortened name for the spacegroup is assigned. This function returns false if sgnumberdoes not reference a valid space group.5.7 OEGetSpaceGroupNumberint OEGetSpaceGroupNumber ( const std : : string &spacegroup ) ;This function returns the integer spacegroup number for the spacegroup referenced by spacegroup. If thespacegroup cannot be found, this function returns 0.5.8 OEGetPhidouble OEGetPhi ( OEHierResidue &res ) ;double OEGetPhi ( <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;This function returns the phi angle in radians for a residue specified by its OEHierResidue class or by and<strong>OEChem</strong>::OEAtomBase from the residue.5.9 OEGetPsidouble OEGetPsi ( OEHierResidue &res ) ;double OEGetPsi ( <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;


5.10. OEGetProteinTorsionName 17This function returns the psi angle in radians for a residue specified by its OEHierResidue class or by any<strong>OEChem</strong>::OEAtomBase from the residue.5.10 OEGetProteinTorsionNameconst char∗ OEGetProteinTorsionName ( unsigned int torType )This function takes an integer from the OEProtTorType namespace and returns a const char* version for use inoutput.5.11 OEGetResidueAtomsThese two functions generate an iterator of all of the atoms in a residue. They differ dramatically in the mannerin which the residue is specified. In both functions, the assume argument is a bitmask that indicates whether thealgorithm can assume that the molecule has perceived residues, has PDB ordered atoms, or as bonded residues (seethe OEAssumption namespace for more information). Please see OEHierView for an additional method foraccessing the atoms of a residue in a protein.OESystem : : OEIterBase∗OEGetResidueAtoms ( <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;OESystem : : OEIterBase∗OEGetResidueAtoms ( const <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;In this function, the residue of interest is identified by passing any atom from that residue into the function.OESystem : : OEIterBase∗OEGetResidueAtoms ( <strong>OEChem</strong> : : OEMolBase &mol , const <strong>OEChem</strong> : : OEResidue &residue ,unsigned assume = OEAssumption : : Default ) ;OESystem : : OEIterBase∗OEGetResidueAtoms ( const <strong>OEChem</strong> : : OEMolBase &mol ,const <strong>OEChem</strong> : : OEResidue &residue ,unsigned assume = OEAssumption : : Default ) ;In this function, the residue is indicated by a combination of the molecule of interest as well as any one of the<strong>OEChem</strong>::OEResidue objects from the residue.5.12 OEGetAlignmentOESequenceAlignment OEGetAlignment ( <strong>OEChem</strong> : : OEMolBase &m1 ,<strong>OEChem</strong> : : OEMolBase &m2 ,unsigned int assume = OEAssumption : : Default ,unsigned int method = OESeqAlignmentMethod : : PAM250 ,int gap = −10,int extend = −2);This function returns an OESequenceAlignment between two molecules. The first two parameters of thetwo protein molecules of interest. The remaining four parameters have default values and are thus optional. The


18 Chapter 5. OEBio Functionsmethod parameter indicates the method to be used to generate the alignment and should be one of the constantsselected from the OESeqAlignmentMethod namespace. The gap and extend parameters indicate the gap andextention penalty to be used in the alignment respectively.The assume argument is a bitmask that indicates whether the algorithm can assume that the molecule has perceivedresidues, has PDB ordered atoms, or as bonded residues (see the OEAssumption namespace for moreinformation).5.13 OEGetTorsiondouble OEGetTorsion ( const OEHierResidue &res , unsigned torType ) ;double OEGetTorsion ( const <strong>OEChem</strong> : : OEAtomBase ∗atom , unsigned torType ,unsigned assume = OEAssumption : : Default ) ;This function returns the angle in radians for one of the standard torsions in a residue. The specific torsion isindicated by passing one of the constants form the OEProtTorType namespace into the torType parameter.The residue is specified by its OEHierResidue class or by any <strong>OEChem</strong>::OEAtomBase from the residue. Ifthe specified torsion type does not exist in the given residue, the function returns -100.0.5.14 OEHasBondedResiduesbool OEHasBondedResidues ( <strong>OEChem</strong> : : OEMolBase &mol ,unsigned assume = OEAssumption : : Default ) ;This function returns a boolean flag indicating whether all of the atoms of each residue in the molecule are bondedto one another. The assume argument is a bitmask that indicates whether the algorithm can assume that themolecule has perceived residues, has PDB ordered atoms, or as bonded residues (see the OEAssumption namespacefor more information).5.15 OEHasCrystalSymmetrybool OEHasCrystalSymmetry ( const <strong>OEChem</strong> : : OEMolBase &mol ) ;This function returns a boolean flag indicating whether the molecule has crystal symmetry or not.5.16 OEIsStandardProteinResiduebool OEIsStandardProteinResidue ( OEHierResidue &res )This function returns whether a residue represented by an OEHierResidue is one of: ALA, ARG, ASN, ASP,CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, ASX, GLX, CYX,CYH, HID, HIE or HIP.5.17 OERMSD


5.18. OESetCrystalSymmetry 19double OERMSD ( const <strong>OEChem</strong> : : OEMolBase &ref , const <strong>OEChem</strong> : : OEMolBase &fit ,OESequenceAlignment &align , bool onlyCAlpha = true ,bool overlay = false , double ∗rot = 0 , double ∗trans = 0 ) ;This OEBio::OERMSD function is quite analogous to the heavily overloaded <strong>OEChem</strong>::OERMSD functions.It takes to molecules as const parameters (one the reference and the other to be fit). It also takes anOESequenceAlignment class that indicates the correspondence between the two molecules. Whether thecorresponding alignment considers all backbone atoms or only alpha carbons is controlled by the onlyCAlphaparameter. The overlay parameter indicates whether the RMSD should be measured using the current coordinatesof the two molecules (defualt) or whether an optimum possible RMSD between the two molecules shouldbe calculated. If the optimum overlay is calculated, the transformations applied to the fit molecule to generatethis optimum overlay can be retrieved by passing an array of double[9] to the rot parameter and an array ofdouble[3] to the trans parameter. These two arrays can subsequently be applied to the fit molecule using the<strong>OEChem</strong>::OERotate and <strong>OEChem</strong>::OETranslate functions if desired.The return value is a root-mean square distance between the specified atoms in the two molecules.5.18 OESetCrystalSymmetrybool OESetCrystalSymmetry ( <strong>OEChem</strong> : : OEMolBase &mol ,float a , float b , float c ,float alpha , float beta , float gamma ,unsigned int sgnumber ) ;This function sets the crystal symmetry for a given molecule. For more detais see 5.5.This function returns false if the indicated space group number is not found or the symmetry cannot be set on themolecule.5.19 OESetTorsionbool OESetTorsion ( OEHierResidue &res , unsigned torType , double radians ) ;bool OESetTorsion ( <strong>OEChem</strong> : : OEAtomBase ∗atom , unsigned torType , double radians ,unsigned assume = OEAssumption : : Default ) ;This function one of the standard torsions in a residue to a particular value in radians. The specific torsion isindicated by passing one of the constants form the OEProtTorType namespace into the torType parameter.The residue is specified by its OEHierResidue class or by any <strong>OEChem</strong>::OEAtomBase from the residue.5.20 OESwapAIEResidueAtomsbool OESwapAIEResidueAtoms ( <strong>OEChem</strong> : : OEMolBase &mol , OEHierResidue &res ) ;bool OESwapAIEResidueAtoms ( <strong>OEChem</strong> : : OEMCMolBase &mol , OEHierResidue &res ) ;bool OESwapAIEResidueAtoms ( <strong>OEChem</strong> : : OEMolBase &mol , <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;bool OESwapAIEResidueAtoms ( <strong>OEChem</strong> : : OEMCMolBase &mol , <strong>OEChem</strong> : : OEAtomBase ∗atom ,unsigned assume = OEAssumption : : Default ) ;The function name OESwapAIEResidueAtoms stands for “Swap Ambiguous Isoelectronic Residue Atoms”.This high-level function allows a user to easily swap the residues in an atom which may not be fully specified by


20 Chapter 5. OEBio Functionsthe crystallographic densities. The residues which are effected by this function include ASP, ASN, ASX, GLU,GLN, GLX, HIS, HIP, HID and HIE.The assume argument is a bitmask that indicates whether the algorithm can assume that the molecule has perceivedresidues, has PDB ordered atoms, or as bonded residues (see the OEAssumption namespace for moreinformation).5.21 OEWriteAlignmentbool OEWriteAlignment ( OEPlatform : : oeostream &ofs ,const OESequenceAlignment &align ) ;This function generates a version of the standard formatted text representation of sequence alignments.


CHAPTERSIXOEBio Functors6.1 OEHasPDBAtomIndexclass OEHasPDBAtomIndex :public OESystem : : OEUnaryPredicateThis class allows you to define a predicate for identifying any PDBAtom according to it’s PDBAtomIndex asdefined in the <strong>OEChem</strong>::OEPDBAtomName namespace.OEHasPDBAtomIndex ( unsigned pdbatomidx )This constructor takes the PDBAtomIndex you are interested in as an argument.bool operator ( ) ( const <strong>OEChem</strong> : : OEAtomBase &atom ) constThis implicit boolean function is the critical function for the predicate. It returns true if the atom’s PDBAtomNameis the same as the argument the object was constructed with.OESystem : : OEUnaryFunction ∗CreateCopy ( )This function can be called to generate a deep copy of any OEUnaryPredicate.6.2 OEIsAlphaCarbonclass OEIsAlphaCarbon : public OESystem : : OEUnaryPredicateThis class allows you to select only alpha carbons from all the atoms in a molecule. This function is particularlyhelpful when passed to <strong>OEChem</strong>::OEMolBase::GetAtoms. This class can be passed to any function thatrequires an OEUnaryPredicate.bool operator ( ) ( const <strong>OEChem</strong> : : OEAtomBase &atom ) constThis implicit boolean function is the critical function for the predicate. It returns true if the atom is an alpha carbon.OESystem : : OEUnaryFunction ∗CreateCopy ( )This function can be called to generate a deep copy of any OEUnaryPredicate.6.3 OEIsBackboneAtom21


22 Chapter 6. OEBio Functorsclass OEIsBackboneAtom : public OESystem : : OEUnaryPredicateThis class allows you to select any backbone atom from all the atoms in a molecule. This function is particularlyhelpful when passed to <strong>OEChem</strong>::OEMolBase::GetAtoms. This class can be passed to any function thatrequires an OEUnaryPredicate.bool operator ( ) ( const <strong>OEChem</strong> : : OEAtomBase &atom ) constThis implicit boolean function is the critical function for the predicate. It returns true if the atom is an any backboneatom.OESystem : : OEUnaryFunction ∗CreateCopy ( )This function can be called to generate a deep copy of any OEUnaryPredicate.


CHAPTERSEVENOEBio Namespaces7.1 OEAssumptionThe OEAssumption namespace defines a bitmask that indicates what assumptions can be made about the proteinpassed to certain OEBio functions. In many cases, if more assumptions can be made, the function canrun significantly faster. As long as the assumptions passed with the flag correspond to the protein, identical answerswill be returned. The PDBOrder flag refers to whether the atoms have been ordered in the official PDBatom order as is done by the <strong>OEChem</strong>::OEPDBOrderAtoms function. The BondedResidue flag refers towhether a bond path can be traced between all of the atoms in each individual residue. This can be tested by theOEBio::OEHasBondedResidues function. The ResPerceived function indicates whether the moleculesresidues have been perceived. This is most commonly carried out with the <strong>OEChem</strong>::OEPerceiveResiduesfunction.namespace OEAssumption{const unsigned int None = 0x0 ;const unsigned int PDBOrder = 0x1 ;const unsigned int BondedResidue = 0x2 ;const unsigned int ResPerceived = 0x4 ;const unsigned int Default = 0xF ;}7.2 OEProtTorTypeThe OEProtTorType namespace is used to indicate a particular torsion of a protein residue. As is standard, theOmega torsion refers to the amide bond following the alpha carbon associated with a residue.namespace OEProtTorType{const unsigned int Unknown = 0 ;const unsigned int Phi = 1 ;const unsigned int Psi = 2 ;const unsigned int Omega = 3 ; //CaC(=O)NCa’ for the Ca residueconst unsigned int Chi1 = 4 ;const unsigned int Chi2 = 5 ;const unsigned int Chi3 = 6 ;const unsigned int Chi4 = 7 ;23


24 Chapter 7. OEBio Namespaces}const unsigned int Chi5 = 8 ;const unsigned int Max = 9 ;7.3 OESeqAlignmentMethodThe OESeqAlignmentMethod namespace is used to indicate which method is used to indicate which method(matrix) should be used to generate a sequence alignment between two molecules.namespace OESeqAlignmentMethod{const unsigned int None = 0 ;const unsigned int Identity = 1 ;const unsigned int PAM250 = 2 ;const unsigned int BLOSUM62 = 3 ;const unsigned int GONNET = 4 ;}


Part III<strong>OEChem</strong> Library25


CHAPTEREIGHT<strong>OEChem</strong> Classes and MemberFunctions8.1 OEAbsCanonicalConfTestclass OEAbsCanonicalConfTest : public OEConfTestThis implementation of OEConfTest combines subsequent connection tables into a multi-conformer molecule ifthey:1. Have the same absolute (non-isomeric) graph.This conformer test puts all of the molecules in their canonical atom order. In addition, all fully specified isomericvalues are set to UNDEFINED.8.2 OEAbsoluteConfTestclass OEAbsoluteConfTest : public OEConfTestThis implementation of OEConfTest combines subsequent connection tables into a multi-conformer molecule ifthey:1. Have the same number of atoms and bonds in the same order.2. Each atom and bond must have identical properties with its order correspondent in the subsequent connectiontable.3. Have the same title (optional).This conformer test sets all fully specified isomeric values to UNDEFINED.This ConfTest shouldn’t be used for reading multi-conformer molecules in PDB or XYZ file format. These fileformats typically require the use of OEDetermineConnectivity (and OEPercieveBondOrders) whichmay potentially perceive and create bonds in different orders (or arbitrarily assign bond orders and Kekulé formsdifferently) for different conformers of the same molecule. This disrupts the ordering (and property) constraints26


8.3. OEAtomBase 27described above. Generally, file formats other than PDB and XYZ should be used for storing multi-conformermolecules (as consecutive connection tables), but if unavoidable, the OEAbsCanonicalConfTest class shouldbe used instead.OEAbsoluteConfTest ( bool compTitles = true )The constructor for OEAbsoluteConfTest has a default argument for whether or not to compare titles. If theconstructor is called with no arguments or with the argument true, the titles will be required to be the same.Otherwise, the titles will not be compared. In the latter instance, each conformer will have the individual title ofits original connection table and the multi-conformer molecule will reflect the title of the active conformer.8.3 OEAtomBaseclass OEAtomBase : public OESystem : : OEBaseThe OEAtomBase class is the abstract interface for representing atoms within <strong>OEChem</strong>. OEAtomBases are createdby calling the OEMolBase::NewAtom method on the parent molecule.8.3.1 GetAtomicNumvirtual unsigned int GetAtomicNum ( )constReturn the atomic number of the atom. A value of zero is returned for wildcard atoms, such as MDL superatoms. An atomic number is specified as the argument to OEAtomBase::NewAtom and may be changed usingOEAtomBase::SetAtomicNum. The set of unsigned integer values for this property are defined by theOEElemNo namespace.8.3.2 GetAtomsvirtual OESystem : : OEIterBase ∗GetAtoms ( ) constvirtual OESystem : : OEIterBase ∗GetAtoms (const OESystem : : OEUnaryPredicate &) constReturn an OEAtomBase iterator of the neighboring atoms of this atom. The returned iterator traverses onlythe explicit atoms that are bonded to the OEAtomBase. The number of neighbors in the iterator is identical toOEAtomBase::GetExplicitDegree.8.3.3 GetBondvirtual OEBondBase ∗GetBond ( const OEAtomBase ∗nbor ) constReturn a pointer to the bond connecting the OEAtomBase to the atom specified in the method argument. If theOEAtomBase is not connected to the specified atom, a NULL pointer code(OEBondBase*)0 is returned.8.3.4 GetBonds


28 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsvirtual OESystem : : OEIterBase ∗GetBonds ( ) constvirtual OESystem : : OEIterBase ∗GetBonds (const OESystem : : OEUnaryPredicate &) constReturn an OEBondBase iterator of the bonds connected to an atom. The returned iterator traverses only theexplicit bonds that are attached to the OEAtomBase. The number of bonds in the iterator is identical toOEAtomBase::GetExplicitDegree.8.3.5 GetDegreevirtual unsigned int GetDegree ( )constReturn the total number of neighbor atoms bonded to an atom, or equivalently the total number of bondsconnected to an atom. This value includes bonds to implicit hydrogen atoms. This value is identicalto OEAtomBase::GetExplicitDegree() + OEAtomBase::GetImplicitHCount(), and is alsoidentical to OEAtomBase::GetHvyDegree() + OEAtomBase::GetTotalHCount().8.3.6 GetExplicitDegreevirtual unsigned int GetExplicitDegree ( )constReturn the number of explicit neighbor atoms bonded to an atom. This value does not include bonds to implicithydrogen atoms.8.3.7 GetExplicitHCountvirtual unsigned int GetExplicitHCount ( )constReturn the number of explicit hydrogen neighbors bonded to an atom.8.3.8 GetExplicitValencevirtual unsigned int GetExplicitValence ( )constReturn the sum of the bond orders of explicit bonds connected to an atom.8.3.9 GetFormalChargevirtual int GetFormalCharge ( )constReturn the formal charge on an atom. The default value is zero. The “formal charge” property may be set usingthe OEAtomBase::SetFormalCharge method. Formal charges may also be set on a molecule usingthe OEAssignFormalCharges function that infers reasonable formal charges using the atomic number, andimplicit hydrogen count for each atom.8.3.10 GetHvyDegreevirtual unsigned int GetHvyDegree ( )const


8.3. OEAtomBase 29Return the number of non-hydrogen neighbors of an atom.8.3.11 GetHvyValencevirtual unsigned int GetHvyValence ( )constReturn the sum of bond orders of bonds to non-hydrogen atoms.8.3.12 GetHybvirtual unsigned int GetHyb ( )constReturn the “hybridization” of an atom. The set of unsigned integer values for this property are defined in the namespaceOEHybridization. The default value is zero, OEHybridization::Unknown. The “hybridization”property may be set with the OEAtomBase::SetHyb method. Hybridizations may also be set on amolecule using the function OEAssignHybridization. The hybridization property of an atom is a stored,not a computed, property. To calculate a reasonable hybridization of an atom from connectivity, use the functionOEGetHybridization.8.3.13 GetIdxvirtual unsigned int GetIdx ( )constReturn the atom index of an atom. This value is assigned by <strong>OEChem</strong> when an atom is created. Theatom index is unique for the atoms of a given molecule, and is stable (not reused) for the lifetime of thatOEMolBase. These values may not be assigned sequentially, and may contain gaps. Atom indices are guaranteedto be less than OEMolBase::GetMaxAtomIdx. Atom indices are typically only used for efficientlystoring data in arrays (or vectors) externally to the OEMolBase. They arrays can be conveniently indexed viaOEAtomBase::GetIdx(). For iterating across the atoms of a molecule, use OEMolBase::GetAtoms()and for keeping track of a particular atom use an OEAtomBase*.8.3.14 GetImplicitHCountvirtual unsigned int GetImplicitHCount ( )constReturn the number of implicit hydrogens attached to atom. The default value is zero. The “implicit hydrogencount” property may be set using the OEAtomBase::SetImplicitHCount method. Implicit hydrogencounts may also be set on a molecule using the function OEAssignImplicitHydrogens. The implicit hydrogencount property of an atom is a stored, not a computed, property. To calculate a reasonable implicit hydrogencount for an atom from connectivity, use the function OEDefaultImplicitHCount.To convert explicit hydrogens to implicit hydrogens, use the <strong>OEChem</strong> function OESupressHydrogens, and toconvert implicit hydrogens to explicit hydrogens, use the function OEAddExplicitHydrogens.8.3.15 GetIntTypevirtual int GetIntType ( )const


30 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsReturn the integer atom type of an atom. The default value is zero. The “integer atom type” property may be setusing the OEAtomBase::SetIntType method.8.3.16 GetIsotopevirtual unsigned int GetIsotope ( )constReturn the isotopic mass of an atom. The default value is zero, meaning that the atom isn’t a specific single isotope,but a composition of isotopes in their naturally occurring abundances. A non-zero value indicates that the atom isa specific isotope. The “isotopic mass” property may be set using the OEAtomBase::SetIsotope method.8.3.17 GetMapIdxvirtual unsigned int GetMapIdx ( )constReturn the reaction atom map index of an atom. This integer value is used for tracking equivalent atom positionsin a reaction molecule/transform. The default value is zero, meaning that the atom isn’t mapped in the reaction.The “reaction map index” property may be set using the OEAtomBase::SetMapIdx method.8.3.18 GetNamevirtual const char ∗GetName ( )constReturn the atom name string of an atom. This property is typically used when reading or writing molecular fileformats. For example in PDB files, the atom name “ CA ” is used to denote that the atom is a peptide alpha carbon.The default value is the empty string. The “atom name” property may be set using the OEAtomBase:SetNamemethod.8.3.19 GetParentvirtual OEMolBase ∗GetParent ( )constReturn the parent molecule of an atom. All OEAtomBases are created as a component of an OEMolBase, thismethod can be used to determine the molecule of which an atom is part. The “parent molecule” property of anatom cannot be assigned, as its determined at the point the atom is created.8.3.20 GetPartialChargevirtual double GetPartialCharge ( )constReturn the floating point partial charge on an atom. The default value is 0.0. The “partial charge” property onan atom may be set using the OEAtomBase::SetPartialCharge method. The partial charge property is astored, not a calculated, property. The function OEClearPartialCharges may be used to reset the partialcharges on a molecule to zero, and the function OEFormalPartialCharges may be used to set the partialcharge on each atom equal to its formal charge.8.3.21 GetRadius


8.3. OEAtomBase 31virtual double GetRadius ( )constReturn the floating point radius assigned to an atom. The default value is 0.0. The “radius” property on an atommay be set using the OEAtomBase::SetRadius method. The radius property is typically used to hold a Vander Waal’s or ionic radius for a given atom when passing an OEMolBase to an algorithm requiring some form ofradii, such as a surface area calculation.8.3.22 GetRxnRolevirtual unsigned int GetRxnRole ( )constReturn the reaction role of an atom in a reaction molecule/transform. The set of unsigned integer values forthis property are defined in the namespace OERxnRole. The default value is zero, OERxnRole::None,which means that the atom does have a role, i.e. is part of a normal molecule. Other values includeOERxnRole::Reactant, OERxnRole::Agent and OERxnRole::Product which correspond to reactant,agent and product atoms in a reaction or transform. The reaction role property may be set using theOEAtomBase::SetRxnRole method.8.3.23 GetStereovirtual unsigned int GetStereo ( const std : : vector &v ,unsigned int c )Return the chirality (or stereochemistry) annotation of the current atom. This method takes a STL vector ofneighboring atoms, v, and a specific stereochemistry class, c, and returns whether that stereochemisty is specifiedat this atom, and if so, what that specified value is. The chiral annotation of an atom may be set using theOEAtomBase::SetStereo method. This function returns the value OEAtomStereo::Undefined if thestereo chemistry for the given stereochemistry class is unspecified, if the stereo chemistry class is invalid or if thevector of neighboring atoms is invalid.In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for atoms isOEAtomStereo::Tetrahedral which corresponds to sp3 tetrahedral chirality. Valid return valuesfor the OEAtomStereo::Tetrahedral stereochemistry class are OEAtomStereo::Left andOEAtomStereo::Right.8.3.24 GetSymmetryClassvirtual unsigned int GetSymmetryClass ( )Return the symmetry class of an atom. The default value is zero, indicating that symmetry classes haven’t beenassigned. The symmetry class property may be set using the OEAtomBase::SetSymmetryClass method.Symmetry classes of a molecule are usually set by calling the function OEPerceiveSymmetry.8.3.25 GetTotalHCountvirtual unsigned int GetTotalHCount ( )constReturn the total number of hydrogen atoms attached to an atom. This value includes the implicithydrogen atoms. This value is identical to OEAtomBase::GetExplicitHCount() +


32 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEAtomBase::GetImplicitHCount().8.3.26 GetTypevirtual const char ∗GetType ( )constReturn the “atom type name” string of an atom. This value is typically used when reading and writing molecularformats. For example, in Sybyl mol2 file, the atom type name “N.pl3” means that the atom should be treated as athree-valent planar nitrogen. The default value is the empty string. The atom type name property may be set usingthe OEAtomBase::SetType method.8.3.27 GetValencevirtual unsigned int GetValence ( )constReturn the sum of all bond orders to an atom. This value includes bonds to implicit hydrogen atoms. This value isequal to OEAtomBase::GetExplicitValence()+OEAtomBase::GetImplicitHCount().8.3.28 HasStereoSpecifiedvirtual bool HasStereoSpecified ( unsigned int c=OEAtomStereo : : All ) constDetermine whether the given atom has specified stereochemistry. The optional argument specifies the class of stereochemistyto check for. The default value, OEAtomStereo::All, checks whether any class of stereochemistryis specified for the current atom.In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for atoms isOEAtomStereo::Tetrahedral which corresponds to sp3 tetrahedral chirality. If a chiral atom has unspecifiedstereochemistry, and this function returns false, the molecule is assumed to represent either a racemic mixtureor an undetermined isomer of this compound. If this function returns true, this atom has an explicit stereochemistrywhich may be retrieved using the OEAtomBase::GetStereo method.This method initially returns false for a newly created atom. The stereochemistry of an atom may be set by callingthe OEAtomBase::SetStereo method with the appropriate stereochemistry class, c, and any value other thanOEAtomStereo::Undefined. The atom stereochemistry may subsequently be cleared by calling the samemethod, with the appropriate stereochemistry class, but specifying the value OEAtomStereo::Undefined.8.3.29 IsAromaticvirtual bool IsAromatic ( )constReturn the Boolean aromatic property of an atom. The default value is false. The aromatic property of an atomcan be set using the OEAtomBase::SetAromatic method. The aromatic properties of atoms and bonds in amolecule are typically set by calling either the <strong>OEChem</strong> OEAssignAromaticFlags function, or possibly theOEClearAromaticFlags function.8.3.30 IsCarbonvirtual bool IsCarbon ( )const


8.3. OEAtomBase 33Determine whether an atom is a carbon atom. This method tests whether the atom’s atomic number is 6, and isequivalent to OEAtomBase::GetAtomicNum() == OEElemNo::C.8.3.31 IsChiralvirtual bool IsChiral ( )constDetermine whether the current atom is a stereogenic center. If this method returns true, the atom is a chiral centerand the different left-handed and right-handed configurations about this atom represent two distinct isomers. If thisfunction returns false, this atom is not a chiral stereocenter.This method/value is independent of the current OEAtomBase::HasStereoSpecified setting whichrecords whether a particular left-handed or right-handed configuration is specified at a particular atom.8.3.32 IsConnectedvirtual bool IsConnected ( const OEAtomBase ∗nbor ) constDetermine whether the atom is bonded to the given atom “nbor”. To obtain the actual bond linkingthe atom to its neighbor use the OEAtomBase::GetBond method. This method is equivalent toOEAtomBase::GetBond() != (OEBondBase*)0.8.3.33 IsHalogenvirtual bool IsHalogen ( )constDetermine whether an atom is a halogen atom. This method tests whether the atom is Fluorine, Chlorine, Bromine,Iodine or Astatine (atomic number 9, 17, 35, 53 or 85).8.3.34 IsHydrogenvirtual bool IsHydrogen ( )constDetermine whether an atom is a hydrogen atom. This method tests whether the atom’s atomic number is 1, and isequivalent to OEAtomBase::GetAtomicNum() == OEElemNo::H.8.3.35 IsInRingvirtual bool IsInRing ( )constReturn the Boolean “in ring” property of an atom. The default value is false. The “in ring” property of an atommay be set using the OEAtomBase::SetInRing method. The “in ring” properties of atoms and bonds aretypically set by calling <strong>OEChem</strong>’s OEFindRingAtomsAndBonds function. This is a stored, not a computed,property.To determine whether an atom is a member of a specific ring/cycle size, use the functionOEAtomIsInRingSize().8.3.36 IsMetal


34 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsvirtual bool IsMetal ( )constDetermine whether an atom is a metal atom. This tests whether the atom is not H, He, B, C, N, O, F, Ne, Si, P, S,Cl, Ar, As, Se, Br, Kr, Te, I, Xe, At or Rn.8.3.37 IsNitrogenvirtual bool IsNitrogen ( )constDetermine whether an atom is a nitrogen atom. This method tests whether the atom’s atomic number is 7, and isequivalent to OEAtomBase::GetAtomicNum() == OEElemNo::N.8.3.38 IsOxygenvirtual bool IsOxygen ( )constDetermine whether an atom is an oxygen atom. This method tests whether the atom’s atomic number is 8, and isequivalent to OEAtomBase::GetAtomicNum() == OEElemNo::O.8.3.39 IsPhosphorusvirtual bool IsPhosphorus ( )constDetermine whether an atom is a phosphorus atom. This method tests whether the atom’s atomic number is 15, andis equivalent to OEAtomBase::GetAtomicNum() == OEElemNo::P.8.3.40 IsPolarvirtual bool IsPolar ( )constDetermine whether an atom is neither a carbon nor hydrogen. The method tests whether the atom’s atomic numberis any value other the 1 or 6.8.3.41 IsPolarHydrogenvirtual bool IsPolarHydrogen ( )constDetermine whether an atom is a hydrogen attached to a polar atom. If the atom’s atomic number is not one,OEAtomBase::IsHydrogen() == false, then this method returns false. Otherwise, this method returnstrue if any of its neighbors return true for OEAtomBase::IsPolar().8.3.42 IsSulfurvirtual bool IsSulfur ( )const


8.3. OEAtomBase 35Determine whether an atom is a sulfur (sulphur) atom. This method tests whether the atom’s atomic number is 16,and is equivalent to OEAtomBase::GetAtomicNum() == OEElemNo::S.8.3.43 SetAromaticvirtual bool SetAromatic ( bool arom )Set the Boolean aromatic property of an atom. This value is false by default. The aromatic property of an atommay be retrieved using the OEAtomBase::IsAromatic method. This function is normally only used by thefunctions OEClearAromaticity and OEAssignAromaticityFlags.8.3.44 SetAtomicNumvirtual bool SetAtomicNum ( unsigned int atno )Set the atomic number of an atom. The set of unsigned integer values for this property is specified by theOEElemNo namespace. The default value is specified when an atom is created with MolBase::NewAtom.The atomic number property of an atom may be retrieved using the OEAtomBase::GetAtomicNum method.8.3.45 SetFormalChargevirtual bool SetFormalCharge ( int charge )Set the formal charge of an atom. The default value is zero. The formal charge property may be retrieved using theOEAtomBase::GetFormalCharge method.8.3.46 SetHybvirtual bool SetHyb ( unsigned int hyb )Set the hybridization of an atom. The set of unsigned integer values for this property is specified by theOEHybridization namespace. The default value is zero, OEHybridization::undefined. The hybridizationproperty may be retrieved using the OEAtomBase::GetHybridization method.8.3.47 SetImplicitHCountvirtual bool SetImplicitHCount ( unsigned int imph )Set the implicit hydrogen count of an atom. The default value is zero. The implicit hydrogen count property maybe retrieved using the OEAtomBase::GetImplicitHCount method.8.3.48 SetIntTypevirtual bool SetIntType ( int type )


36 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsSet the integer atom type property of an atom. The default value is zero. The integer atom type property may beretrieved using the OEAtomBase::GetIntType method.8.3.49 SetInRingvirtual bool SetInRing ( bool inring )Set the Boolean “in ring” property of an atom. This property is usually set by the <strong>OEChem</strong> functionOEFindRingAtomsAndBonds. The default value is false. The “in ring” property of an atom may be retrievedusing the OEAtomBase::IsInRing method.8.3.50 SetIsotopevirtual bool SetIsotope ( unsigned int mass )Set the isotopic mass of an atom. The default value is zero, meaning that the atom isn’t a specific single isotope,but a composition of isotopes in their naturally occurring abundances. A non-zero value indicates that the atom isa specific isotope. The “isotopic mass” property may be set using the OEAtomBase::GetIsotope method.8.3.51 SetMapIdxvirtual bool SetMapIdx ( unsigned int mapidx )Set the reaction atom map index of an atom. This integer value is used for tracking equivalent atom positions in areaction molecule/transform. The default value is zero, meaning that the atom isn’t mapped in the reaction. The“reaction map index” property may be retrieved using the OEAtomBase::GetMapIdx method.8.3.52 SetNamevirtual bool SetName ( const std : : string &nam )virtual bool SetName ( const char ∗nam )Set the atom name string of an atom. This property is typically used when reading or writing molecular file formats.For example in PDB files, the atom name “ CA ” is used to denote that the atom is a peptide alpha carbon. Thedefault value is the empty string. The “atom name” property may be retrieved using the OEAtomBase:GetNamemethod.8.3.53 SetPartialChargevirtual bool SetPartialCharge ( double charge )Set the partial charge property of an atom. The default value is 0.0. The partial charge property may be retrievedusing the OEAtomBase::GetPartialCharge method.8.3.54 SetRadiusvirtual bool SetRadius ( double radius )


8.3. OEAtomBase 37Set the “radius” property of an atom. The default value is 0.0. The assigned radius may be retrieved using theOEAtomBase::GetRadius method. The radius property is typically used to hold a Van der Waal’s or ionicradius for a given atom when passing an OEMolBase to an algorithm requiring some form of radii, such as asurface area calculation.8.3.55 SetRxnRolevirtual bool SetRxnRole ( unsigned int role )Set the reaction role of an atom in a reaction molecule/transform. The set of unsigned integer values for thisproperty is defined by the OERxnRole namespace. The default value is zero, OERxnRole::None, which meansthat the atom does have a role, i.e. is part of a normal molecule. Other values include OERxnRole::Reactant,OERxnRole::Agent and OERxnRole::Product which correspond to reactant, agent and product atoms ina reaction or transform. The reaction role property may be retrieved using the OEAtomBase::SetRxnRolemethod.8.3.56 SetStereovirtual bool SetStereo ( const std : : vector &v ,unsigned int c , unsigned int p )Set the chirality (or stereochemistry) annotation of the current atom. This method takes a STL vector of neighboringatoms, v, and a specific stereochemisty class, c and the value for that chirality to be set to. This functionreturns true if the atom chirality was correctly set, and false if the stereochemistry class is invalid, the stereochemistryvalue is invalid for the stereochemistry class, or the vector of neighboring atoms is invalid. The chiralannotation of a atom may be retrieved using the OEAtomBase::GetStereo.If set sucessfully, to a value other than OEAtomStereo::Undefined, future calls toOEAtomBase::HasStereoSpecified with the given stereochemistry class (or OEAtomStereo::All)will return true. If sucessfully set to the value OEAtomStereo::Undefined, future calls toOEAtomBase::HasStereoSpecified will return false.In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for atoms isOEAtomStereo::Tetrahedral which corresponds to sp3 tetrahedral chirality. Valid valuesfor the OEAtomStereo::Tetrahedral stereochemistry class are OEAtomStereo::Left andOEAtomStereo::Right.8.3.57 SetSymmetryClassvirtual bool SetSymmetryClass ( unsigned int symclass )Set the symmetry class of an atom. This routine is normally only called by the <strong>OEChem</strong> functionOEPerceiveSymmetry. The default value is zero, indicating that the symmetry class hasn’t be perceived. Thesymmetry class of an atom may be retrieved by using the OEAtomBase::OEGetSymmetryClass function.8.3.58 SetTypevirtual bool SetType ( const std : : string &typ )virtual bool SetType ( const char ∗typ )


38 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsSet the “atom type name” string property of an atom. This value is typically used when reading and writingmolecular formats. For example, in Sybyl mol2 file, the atom type name “N.pl3” means that the atom should betreated as a three-valent planar nitrogen. The default value is the empty string. The atom type name property maybe retrieved using the OEAtomBase::GetType method.8.4 OEBondBaseclass OEBondBase : public OESystem : : OEBaseThe OEBondBase class is the abstract interface for representing bonds within <strong>OEChem</strong>. OEBondBases arecreated by calling the OEMolBase::NewBond method on the parent molecule.8.4.1 GetBgnvirtual OEAtomBase ∗GetBgn ( )constReturn the “begin” (or “source”) atom of a bond. The begin atom of a bond is defined either when the bond iscreated with OEMolBase::NewBond, or possibly by a call to the OEBondBase::SetBgn method. If thebegin atom was specified as the NULL pointer, (OEAtomBase*)0, when the bond was created, this method mayreturn a NULL pointer.8.4.2 GetBgnIdxvirtual unsigned int GetBgnIdx ( )constReturn the atom index of the “begin” (or “source”) atom of a bond. This method is equivalent toOEBondBase::GetBgn()->GetIdx(). See OEAtomBase::GetIdx for the caveats and restrictions onusing atom indices.8.4.3 GetEndvirtual OEAtomBase ∗GetEnd ( )constReturn the “end” (or “destination”) atom of a bond. The end atom of a bond is defined either when the bond iscreated with OEMolBase::NewBond, or possibly by a call to the OEBondBase::SetEnd method. If the endatoms was specified as the NULL pointer, (OEAtomBase*)0, when the bond was created, this method may returna NULL pointer.8.4.4 GetEndIdxvirtual unsigned int GetEndIdx ( )constReturn the atom index of the “end” (or “destination”) atom of a bond. This method is equivalent toOEBondBase::GetEnd()->GetIdx(). See OEAtomBase::GetIdx for the caveats and restrictions onusing atom indices.8.4.5 GetIdx


8.4. OEBondBase 39virtual unsigned int GetIdx ( )constReturn the bond index of an bond. This value is assigned by <strong>OEChem</strong> when a bond is created. The bond indexis unique for the bonds of a given molecule, and is stable (not reused) for the lifetime of that OEMolBase.These values may not be assigned sequentially, and may contain gaps. Bond indices are guaranteed to be less thanOEMolBase::GetMaxBondIdx. Bond indices are typically only used for efficiently storing data in arrays (orvectors) externally to the OEMolBase. They arrays can be conveniently index via OEBondBase::GetIdx().For iterating across the bonds of a molecule, use OEMolBase::GetBonds() and for keeping track of a particularbond use its OEBondBase*.8.4.6 GetIntTypevirtual unsigned int GetIntType ( )constReturn the integer bond type of a bond. The default value is zero. The “integer bond type” property may be setusing the OEBondBase::SetIntType method.8.4.7 GetNbrvirtual OEAtomBase ∗GetNbr ( const OEAtomBase ∗src ) constReturn the atom across the bond from the specified atom. If the “src” argument represents the begin atom of thebond, i.e. OEBondBase::GetBgn, this method returns the end atom, i.e. OEBondBase::GetEnd, and if the“src” argument is the end atom, this function returns the begin atom. If passed an atom other than the begin or endatoms, this function returns a NULL pointer, (OEAtomBase*)0. This function is often used for traversing theatoms of a molecule.8.4.8 GetOrdervirtual unsigned int GetOrder ( )constReturn the bond order of a bond. The bond order property is one, for single bonds, two for double bonds,three for triple bonds and four for quadruple bonds. The default value is specified when a bond is created usingOEMolBase::NewBond. The bond order property of a bond may be set using the OEBondBase::SetOrdermethod.8.4.9 GetParentvirtual OEMolBase ∗GetParent ( )constReturn the parent molecule of a bond. All OEBondBases are created as a component of an OEMolBase, thismethod can be used to determine the molecule of which an bond is part. The “parent molecule” property of a bondcannot be assigned, as its determined at the point the bond is created.8.4.10 GetStereovirtual unsigned int GetStereo ( const std : : vector &v ,unsigned int c )


40 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsReturn the chirality (or stereochemistry) annotation of the current bond. This method takes a STL vector ofadjacent atoms, v, and a specific stereochemistry class, c, and returns whether that stereochemisty is specifiedat this bond, and if so, what that specified value is. The chiral annotation of an bond may be set using theOEBondBase::SetStereo method. This function returns the value OEBondStereo::Undefined if thestereo chemistry for the given stereochemistry class is unspecified, if the stereo chemistry class is invalid or if thevector of adjacent atoms is invalid.In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for bonds isOEBondStereo::CisTrans which corresponds to conjugated E/Z chirality. Valid return valuesfor the OEBondStereo::CisTrans stereochemistry class are OEBondStereo::Cis andOEBondStereo::Trans.8.4.11 GetTypevirtual const const char ∗GetType ( )constReturn the “bond type name” string of an bond. This value is typically used when reading and writing molecularformats. For example, in Sybyl mol2 file, the bond type name “am” means that the bond should be treatedas an amide bond. The default value is the empty string. The bond type name property may be set using theOEBondBase::SetType method.8.4.12 HasStereoSpecifiedvirtual bool HasStereoSpecified ( unsigned int c=OEBondStereo : : All ) constDetermine whether the given bond has specified stereochemistry. The optional argument specifies the class of stereochemistyto check for. The default value, OEBondStereo::All, checks whether any class of stereochemistryis specified for the current bond.In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for bonds isOEBondStereo::CisTrans which corresponds to conjugated E/Z chirality. If a chiral bond has unspecifiedstereochemistry, and this function returns false, the molecule is assumed to represent either a racemic mixtureor an undetermined isomer of this compound. If this function returns true, this bond has an explicit stereochemistrywhich may be retrieved using the OEBondBase::GetStereo method.This method initially returns false for a newly created bond. The stereochemistry of an bond may be set by callingthe OEBondBase::SetStereo method with the appropriate stereochemistry class, c, and any value other thanOEBondStereo::Undefined. The bond stereochemistry may subsequently be cleared by calling the samemethod, with the appropriate stereochemistry class, but specifying the value OEBondStereo::Undefined.8.4.13 IsAromaticvirtual bool IsAromatic ( )constReturn the Boolean aromatic property of a bond. The default value is false. The aromatic property of a bondcan be set using the OEBondBase::SetAromatic method. The aromatic properties of bonds and atoms in amolecule are typically set by calling either the <strong>OEChem</strong> OEAssignAromaticFlags function, or possibly theOEClearAromaticFlags function.8.4.14 IsChiral


8.4. OEBondBase 41virtual bool IsChiral ( )constDetermine whether the current bond is a stereogenic center. If this method returns true, the bond is a chiral centerand the cis and trans forms of this bond represent two distinct isomers. If this function returns false, this bond isnot a chiral stereocenter.This method/value is independent of the current OEBondBase::HasStereoSpecified setting whichrecords whether a particular cis- or trans- configuration is specified at a particular bond.8.4.15 IsInRingvirtual bool IsInRing ( )Return the Boolean “in ring” property of a bond. The default value is false. The “in ring” property of an bond maybe set using the OEBondBase::SetInRing method. The “in ring” properties of bonds and atoms are typicallyset by calling <strong>OEChem</strong>’s OEFindRingAtomsAndBonds function. This is a stored, not a computed, property.8.4.16 IsRotorvirtual bool IsRotor ( )constDetermine whether a bond is freely rotatable. The definition of a freely rotatable bond is that it is a single, non-ringbond between two non-terminal, non-triple-bonded atoms. An atom is considered non-terminal if it is connected totwo or more non-hydrogen atoms, i.e. OEAtomBase::GetHvyDegree >= 2. Note that the “in ring” propertyof the bond must have previously been set using the OEBondBase::SetInRing method, typically by callingthe function OEFindRingAtomsAndBonds.8.4.17 SetAromaticvirtual bool SetAromatic ( bool arom )Set the Boolean aromatic property of a bond. This value is false by default. The aromatic property of a bondmay be retrieved using the OEBondBase::IsAromatic method. This function is normally only used by thefunctions OEClearAromaticity and OEAssignAromaticFlags.8.4.18 SetBgnvirtual bool SetBgn ( OEAtomBase∗bgn )Define the “begin” (or “source”) atom of a bond. Normally, the begin atom of a bond is defined when the bond iscreated with OEMolBase::NewBond. However, it is occasionally useful to defer this decision, by passing theNULL pointer, (OEAtomBase*)0, as the begin atom to OEMolBase::NewBond. The begin atom should thenlater be specified by calling this method, OEBondBase::SetBgn, to resolve the begin atom before the molecule isused. Note that it is not possible to set/change the begin atom of a bond, once it has been defined. To achieve thesame behavior call the OEMolBase::DeleteBond method, followed by OEMolBase::NewBond, to firstdestroy the original and replace it with a new bond.8.4.19 SetEnd


42 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsvirtual bool SetEnd ( OEAtomBase ∗end )Define the “end” (or “destination”) atom of a bond. Normally, the end atom of a bond is defined when the bond iscreated with OEMolBase::NewBond. However, it is occasionally useful to defer this decision, by passing theNULL pointer, (OEAtomBase*)0, as the end atom to OEMolBase::NewBond. The end atom should thenlater be specified by calling this method, OEBondBase::SetEnd, to resolve the end atom before the moleculeis used. Note that it is not possible to set/change the end atom of a bond, once it has been defined. To achievethe same behavior call the OEMolBase::DeleteBond method, followed by OEMolBase::NewBond, to firstdestroy the original and replace it with a new bond.8.4.20 SetIntTypevirtual bool SetType ( unsigned int typ )Set the integer bond type of a bond. The default value is zero. The “integer bond type” property may be retrievedusing the OEBondBase::GetIntType method.8.4.21 SetInRingvirtual bool SetInRing ( bool inring )Set the Boolean “in ring” property of an bond. This property is usually set by the <strong>OEChem</strong> functionOEFindRingAtomsAndBonds. The default value is false. The “in ring” property of a bond may be retrievedusing the OEBondBase::IsInRing method.8.4.22 SetOrdervirtual bool SetOrder ( unsigned int bo )Set the bond order of a bond. The bond order property is one, for single bonds, two for double bonds,three for triple bonds and four for quadruple bonds. The default value is specified when a bond is createdusing OEMolBase::NewBond. The bond order property of a bond may be retrieved using theOEBondBase::GetOrder method.8.4.23 SetStereovirtual bool SetStereo ( const std : : vector &v ,unsigned int c , unsigned int p )Set the chirality (or stereochemistry) annotation of the current bond. This method takes a STL vector of adjacentatoms, v, and a specific stereochemisty class, c and the value for that chirality to be set to. This function returnstrue if the bond chirality was correctly set, and false if the stereochemistry class is invalid, the stereochemistryvalue is invalid for the stereochemistry class, or the vector of adjacent atoms is invalid. The chiral annotation of abond may be retrieved using the OEBondBase::GetStereo.If set sucessfully, to a value other than OEBondStereo::Undefined, future calls toOEBondBase::HasStereoSpecified with the given stereochemistry class (or OEBondStereo::All)will return true. If sucessfully set to the value OEBondStereo::Undefined, future calls toOEBondBase::HasStereoSpecified will return false.


8.5. OECartesianToInternal 43In the current version of <strong>OEChem</strong>, the only class of stereochemistry supported for bonds isOEBondStereo::CisTrans which corresponds to conjugated E/Z chirality. Valid valuesfor the OEBondStereo::CisTrans stereochemistry class are OEBondStereo::Cis andOEBondStereo::Trans.8.4.24 SetTypevirtual bool SetType ( const std : : string &typ )virtual bool SetType ( const char ∗typ )Set the “bond type name” string of an bond. This value is typically used when reading and writing molecularformats. For example, in Sybyl mol2 file, the bond type name “am” means that the bond should be treated asan amide bond. The default value is the empty string. The bond type name property may be retrieved using theOEBondBase::GetType method.8.4.25 SwapEndsvirtual bool SwapEnds ( )This method swaps the begin and end atoms of a bond. The lists of bonds contained in each of the two atomsare not altered. After calling the SwapEnds method, the atoms returned by the OEBondBase::GetBgn andOEBondBase::GetEnd methods will be interchanged.8.5 OECartesianToInternalclass OECartesianToInternalThe OECartesianToInternal class provides a convenient mechanism for converting a sequence of Cartesian x, y, zcoordinates, to a sequence of Internal coordinates defined as lengths, angles and torsions from the previous threeatoms.8.5.1 resetvoid reset ( )Reset the OECartesianToInternal class to its initial state.8.5.2 updatevoid update ( float ∗coord )Convert the given Cartesian x, y, z coordinates in coord to internal coordinates in-place. On input, coord[0] shouldcontain the x coordinate, coord[1] the y coordinate and coord[2] the z coordinate of an atom position or location.Upon return coord[0] contains the distance to the location, coord[1] contains the angle to the two previous locations


44 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsand coord[2] the signed torsion to the previous three locations.8.6 OECliqueSearchclass OECliqueSearch8.6.1 ConstructorsOECliqueSearch ( )OECliqueSearch ( const char ∗c )OECliqueSearch ( const OEQMolBase &qmol )OECliqueSearch ( const OEMolBase &mol , unsigned int a , unsigned int b )OECliqueSearch ( const OECliqueSearch &cs )8.6.2 AddConstraintbool AddConstraint ( const OEMatchPair &mp )bool AddConstraint ( const OEMatchPair &mp )8.6.3 ClearConstraintsvoid ClearConstraints ( )8.6.4 GetMaxMatchesunsigned int GetMaxMatches ( )const8.6.5 GetMinAtomsunsigned int GetMinAtoms ( )const8.6.6 GetPatternconst OEQMolBase &GetPattern ( )const8.6.7 GetSaveRangeunsigned int GetSaveRange ( )const8.6.8 Init


8.7. OEConfBase 45bool Init ( const char ∗c )bool Init ( const OEQMolBase &qmol )bool Init ( const OEMolBase &mol , unsigned int a , unsigned int b )8.6.9 MatchOESystem : : OEIterBase ∗Match ( const OEMolBase &mol )OESystem : : OEIterBase ∗Match ( const OEQMolBase &qmol )8.6.10 SingleMatchbool SingleMatch ( const OEMolBase &mol )bool SingleMatch ( const OEQMolBase &qmol )8.7 OEConfBasetypedef OEConfBaseT OEConfBase ;OEConfBase is a convenience typedef for the most common OEConfBaseT template instantiation. It is a OEConf-BaseT with coordinate type float and dimensionality of three.8.8 OEConfBaseTtemplateclass OEConfBaseT : public OEMolBaseOEConfBaseT is the generic conformer base class in <strong>OEChem</strong>. It is an abstract base class which defined theinterface for conformer implementations. OEConfBaseT has two template arguments. The first, class C, is thecoordinate representation type. The second, unsigned int dim, is the dimensionality of the representation.8.8.1 coord typetypedef C coord_type ;This typedef allows generic declaration of the coord type for a given conformer type viaOEConfBase::coord type.8.8.2 Copyvirtual bool Copy ( const OEConfBaseT &) = 0Copy is a pure virtual protected helper function which allows operator= to act like it is virtual even though virtualoperators are not possible.8.8.3 Constructors


46 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEConfBaseT ( )OEConfBaseT ( const OEConfBaseT &rhs )OEConfBaseT ( const OESystem : : OEBase &rhs )OEConfBaseT ( const OEConfBaseT &rhc , const C ∗rht )OEConfBaseT has four constructors including the default constructor. All of the constructors are empty functionswhich simply pass the appropriate initialization parameter up the inheritance tree to the OEMolBase constructor.8.8.4 operator=OEConfBaseT& operator= ( const OEConfBaseT &rhs )Appropriate assignment of conformers via this abstract base class is possible using the virtual Copy function.8.8.5 AddAtomvirtual void AddAtom ( OEAtomBase ∗atom ) = 0virtual void AddAtom ( const OEAtomBase ∗rhs , OEAtomBase ∗atom ) = 0AddAtom is a helper function which the MCMolBase can call as an adjunct to NewAtom on the molecule whichcontains the conformers. This should not be called by a primary user.8.8.6 AddBondvirtual void AddBond ( OEBondBase ∗bond ) = 0AddBond is a helper function which the MCMolBase can call as an adjunct to NewBond on the molecule whichcontains the conformers. This should not be called by a primary user.8.8.7 RemoveAtomvirtual bool RemoveAtom ( OEAtomBase ∗atom ) = 0RemoveAtom is a helper function which the MCMolBase can call as an adjunct to DeleteAtom on the moleculewhich contains the conformers. This should not be called by a primary user.8.8.8 RemoveBondvirtual bool RemoveBond ( OEBondBase ∗bond ) = 0RemoveBond is a helper function which the MCMolBase can call as an adjunct to DeleteBond on the moleculewhich contains the conformers. This should not be called by a primary user.8.8.9 MCMolvirtual void SetMCMol ( OEMCMolBaseT &) = 0virtual OEMCMolBaseT &GetMCMol ( ) const = 0


8.8. OEConfBaseT 47These functions set and get the associated MCMol which are serving as the container for the OEConfBaseT.8.8.10 Conformer Indicesvirtual void SetIdx ( unsigned int ) = 0virtual unsigned int GetIdx ( ) const = 0These functions allow access to the unique conformer index. It is not recommended that a user call theOEConfBaseT::SetIdx() function. This value is assigned by <strong>OEChem</strong> when a conformer is created. Theconformer index is unique for the conformers of a given molecule, and is stable (not reused) for the lifetimeof that OEMCMolBase. These values may not be assigned sequentially, and may contain gaps. Conformer indicesare guaranteed to be less than OEMCMolBase::GetMaxConfIdx. Conformer indices are typically only usedfor efficiently storing data in arrays (or vectors) externally to the OEMCMolBase. They arrays can be convenientlyindexed via OEConfBaseT::GetIdx(). For iterating across the conformers of a molecule, use OEMCMol-Base::GetConfs() and for keeping track of a particular conformer use an OEConfBase*.8.8.11 SetCoordsvirtual bool SetCoords ( const float∗) = 0virtual bool SetCoords ( const double∗) = 0Sets the coordinates of a conformer. The coords parameter is expected to be an array of size OEConf-Base::GetMaxAtomIdx()*dim. This array should contain N=dim coordinates for each atom, and they should belocated in the array passed in at coords[atom->GetIdx()*dim+i], where i ranges from 0 to dim. Aninternal copy of the coordinates is stored in the OEConfBaseT which is independent of the array passed.virtual bool SetCoords ( const OEAtomBase∗ atom , const float ∗coords ) = 0virtual bool SetCoords ( const OEAtomBase∗ atom , const double ∗coords ) = 0Sets to coordinates of a single atom in the OEConfBaseT. The array passed in should be of length dim and shouldcontain the new coordinates of the atom. An internal copy of the coordinates is stored in the OEConfBaseT whichis independent of the coords array.8.8.12 GetCoordsvirtual bool GetCoords ( float ∗coords ) const = 0virtual bool GetCoords ( double ∗coords ) const = 0Fills the array passed into the function with a copy of the coordinates of the conformer. The array passed inshould be at least of length OEConfBaseT::GetMaxAtomIdx()*dim. The coordinates of each atom in theconformer will begin at coords[atom->GetIdx()*dim] in the array. Changes made to the array after thisfunction call will have no effect on the conformer.virtual bool GetCoords ( const OEAtomBase ∗atom , float ∗coords ) const = 0virtual bool GetCoords ( const OEAtomBase ∗atom , double ∗coords ) const = 0Fills the coords array with the coordinates of the OEAtomBase atom. The coords array should be at least of lengthdim. Changes made to the coord array after this function call will have no effect on the conformer.8.8.13 Deletion


48 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsvirtual void Delete ( ) = 0virtual bool IsDeleted ( ) const = 0The Delete function is equivalent to call OEMCMolBaseT::DeleteConf from the parent molecule. It removes thecurrent conformer from the OEMCMolBaseT containing it. These functions do not invalidate current OEIters, andall calls to OEMCMolBaseT::GetConfs called after the call to Delete will not contain the deleted conformer.IsDeleted is a helper function which assists other classes in maintaining functionality after an OEConfBaseT hasbeen deleted.8.8.14 TorsionsThese functions remain beta.virtual double GetTorsion ( OETorsion &) const = 0virtual double GetTorsion ( const OEAtomBase ∗a , const OEAtomBase ∗b ,const OEAtomBase ∗c , const OEAtomBase ∗d ) const = 0virtual void SetTorsion ( OETorsion &) = 0virtual void SetTorsion ( OEAtomBase ∗a , OEAtomBase ∗b ,OEAtomBase ∗c , OEAtomBase ∗d , double radians ) = 0These functions can be used to check or set the torsion values on a torsion in the conformer. The torsion can bedefined by either in OETorsion object, or by four OEAtomBase* objects.8.8.15 TransformationsGetTransform is a beta functionvirtual const OETrans &GetTransform ( ) const = 0Returns an OETrans, which is a container of all the transformations which have been applied to the OEConfBaseT.This function is particularly useful when the internal representation of coordinates may not be Cartesian.virtual void Transform ( const OETransBase ∗) = 0virtual void Transform ( const OETrans &) = 0Applies the geometric transformation specified in the OETransBase* object or the series of geometric transformationsspecified in the OETran container to the OEConfBaseT. These functions permanently change the coordinatesof the OEConfBaseT.8.8.16 Titlevirtual bool HasTitle ( ) const = 0virtual const char ∗GetTitle ( ) const = 0OEConfBaseT objects can have their own title. However, if they do not, they will report the title of their parentOEMCMolBase when the OEConfBaseT::GetTitle() function is called.8.8.17 OEMolBaseOEConfBaseT derives publicly from OEMolBase. It supports the full <strong>API</strong> of an OEMolBase, and any functionwhich takes an OEMolBase as an argument (e.g. OECreateSmiString), can be passed an OEConfBaseT.


8.9. OEConfTest 49See the section on OEMolBases for details on this <strong>API</strong>.8.8.18 OEBaseOEConfBaseT derives publicly from OEBase via OEMolBase. The OEConfBaseT objects fully support theOEBase <strong>API</strong>, including all generic data functions (e.g. OEBase::GetData and OEBase::SetData).8.9 OEConfTestclass OEConfTestOEConfTest is the abstract base class which defined the interface for classes used to determine whether consecutivemolecules read from single-conformer file-formats are combined into multi-conformer molecules.For implementations of OEConfTest see OEAbsCanonicalConfTest, OEAbsoluteConfTest,OEDefaultConfTest and OEIsomericConfTest.8.9.1 CompareMolsvirtual bool CompareMols ( const OEMolBase &m1 , OEMolBase &m2 ) const = 0This is the pure virtual function used to determine if two molecules are conformers of the same multi-conformermolecule. Users inheriting from this class must define this function. Note the molecule which is the secondargument is not const. This allows the second molecule to be modified as may be necessary for it to be part of amulti-conformer molecule. It can be assumed that every molecule from an input stream will be used as argumentm2 in this function call at least once.8.9.2 CreateCopyvirtual OEConfTest ∗CreateCopy ( ) const = 0This pure virtual copy constructor should return a deep copy of the OEConfTest object. The copy of the objectreturned is in memory now owned by the user making the function call. Thus if you use this function, you mustsubsequently call delete on the pointer.8.10 OEDefaultConfTestclass OEDefaultConfTest : public OEConfTest


50 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsThis is the default implementation of OEConfTest. It never combines connection tables into multi-conformermolecules. This function is set as the conformer test to use by all of the oemolistream constructors.8.11 OEEulerOEEuler : public OETransBaseThis object is one of the molecular transformation base classes which derive from OETransBase and work withOETrans.OEEuler ( const double ∗angles )OEEuler ( const float ∗angles )OEEuler ( double phi , double theta , double psi )OEEuler ( float phi , float theta , float psi )OEEuler &operator = ( const double ∗rhs )OEEuler &operator = ( const float ∗rhs )This OETransBase object represents rotation about 3 Euler angles. This objects assumes the angles are orderedphi, theta, psi and have radian units.OETransBase ∗CreateCopy ( )constvoid GetAngles ( double ∗angles ) constvoid GetAngles ( float ∗angles ) constdouble GetPhi ( ) constdouble GetTheta ( ) constdouble GetPsi ( ) constvoid SetPhi ( double radians )void SetTheta ( double radians )void SetPsi ( double radians )These methods give access to the angle data.8.12 OEExprBaseclass OEExprBaseOEExprBase is an abstract class which defines an interface through which boolean expressions can test equivalenceof nodes (atoms) and edges (bonds) during graph match processes. The expression class interface simplifies whatis normally a binary tree representation of attributes which atoms and bonds must (not) have in order to be calledequivalent to a corresponding node or edge. Derived classes may be used to extend the graph matching algorithmsin <strong>OEChem</strong> to compare attributes beyond the pre-defined expressions in <strong>OEChem</strong>. In addition, user-defined expressionclasses may take full advantage of the arbitrary data storage mechanism which is part of the OEBase class.Expression equivalence could then be performed on dynamic user-defined data extensions to atoms and bonds.8.12.1 IsEquivalentvirtual const OEFuzzy &IsEquivalent ( const OEAtomBase ∗atom )virtual const OEFuzzy &IsEquivalent ( const OEBondBase ∗bond )These pure virtual methods provide a common interface for testing attributes of atoms and bonds. Any methodwhich does not modify an atom or bond may be called in an implementation of an IsEquivalent method. The return


8.13. OEFuzzy 51value must be one of the OEFuzzy predefined instances of true, false, or maybe. For further details of valid returnvalues for these methods please see the section on the OEFuzzy class.8.12.2 CreateCopyvirtual OEExprBase ∗CreateCopy ( )This pure virtual copy constructor should return a deep copy of the OEExprBase object. The copy of the objectreturned is in memory now owned by the user making the function call. It is the responsibility of the programmerto manage the memory created and returned by this method.8.12.3 GetTypevirtual unsigned int GetType ( )This pure virtual method is designed to return a unique identifier for each OEExprBase implementation. A listingof type identifiers returned by classes in <strong>OEChem</strong> which are derived from the OEExprBase class can be found inthe OEExprType namespace. User-defined implementations of the OEExprBase class should return value for thismethod which does not collide with types returned by implementations provided by <strong>OEChem</strong>.8.13 OEFuzzyclass OEFuzzyClass used to represent fuzzy logic used in expression tests.8.13.1 ConstructorOEFuzzy ( const unsigned int v )Construct an OEFuzzy instance given with an integer value. The integer values should be one of the values give inthe OEFuzzVal namespace. Three pre-defined global constant fuzzy values (FzTrue, FzFalse, and FzMaybe) aredefine in <strong>OEChem</strong> which represent the fuzzy values of true, false, and maybe, respectively.8.13.2 operator booloperator bool ( )constBoolean test operator. Both fuzzy true and maybe values will return boolean true. A fuzzy false value will returnboolean false.8.13.3 operator !const OEFuzzy &operator ! ( )


52 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsNegation operator. Negation of true will return false. Negation of false will return true. Negation of maybe willreturn maybe.8.13.4 operator &&const OEFuzzy &operator&& ( const OEFuzzy&)And operator. Logic values for ”fuzzy and” follow(FzFalse && FzFalse) == FzFalse(FzFalse && FzMaybe) == FzFalse(FzFalse && FzTrue) == FzFalse(FzMaybe && FzFalse) == FzFalse(FzMaybe && FzMaybe) == FzMaybe(FzMaybe && FzTrue) == FzMaybe(FzTrue && FzFalse) == FzFalse(FzTrue && FzMaybe) == FzMaybe(FzTrue && FzTrue) == FzTrue8.13.5 operator ||const OEFuzzy &operator | |( const OEFuzzy&)Or operator. Logic values for ”fuzzy or” follow(FzFalse || FzFalse) == FzFalse(FzFalse || FzMaybe) == FzMaybe(FzFalse || FzTrue) == FzTrue(FzMaybe || FzFalse) == FzMaybe(FzMaybe || FzMaybe) == FzMaybe(FzMaybe || FzTrue) == FzTrue(FzTrue || FzFalse) == FzTrue(FzTrue || FzMaybe) == FzTrue(FzTrue || FzTrue) == FzTrue8.13.6 operator ==bool operator==( const OEFuzzy&) constEquivalence operator. Two OEFuzzy instances are equivalent if their fuzzy logic values are identical.8.13.7 operator !=bool operator!=( const OEFuzzy&) const


8.14. OEInternalToCartesian 53Not equal operator. Two OEFuzzy instances are not equivalent if their fuzzy logic values differ.8.14 OEInternalToCartesianclass OEInternalToCartesianThe OEInternalToCartesian class provides a convenient mechanism for converting a sequence of internal coordinates(defined as lengths, angles and torsions to the previous three atoms) to Cartesian x, y, z coordinates.8.14.1 resetvoid reset ( )Reset the OEInternalToCartesian class to its initial state.8.14.2 updatevoid update ( float ∗coord )Convert the given internal coordinates to Cartesian x, y, z coordinates in-place. On input, coord[0] should containthe distance to the previous atom position or location, coord[1] the angle to the two previous locations and coord[2]the signed torsion to the previous three locations. Upon return, coord[0] contains the x coordinate, coord[1] the ycoordinate and coord[2] the z coordinate in Cartesian space.8.15 OEIsomericConfTestclass OEIsomericConfTest : public OEConfTestThis implementation of OEConfTest combines subsequent connection tables into a multi-conformer molecule ifthey:1. Have the same title (optional)2. Have the same numbers of atoms and bonds in the same order3. Each atom and bond must have identical properties with its order correspondent in the subsequent connectiontable4. Have the same atom and bond stereochemistryNo change to the connection table are made.This ConfTest shouldn’t be used for reading multi-conformer molecules in PDB or XYZ file format. These fileformats typically require the use of OEDetermineConnectivity (and OEPercieveBondOrders) whichmay potentially perceive and create bonds in different orders (or arbitrarily assign bond orders and Kekulé formsdifferently) for different conformers of the same molecule. This disrupts the ordering (and property) constraintsdescribed above. Generally, file formats other than PDB and XYZ should be used for storing multi-conformermolecules (as consecutive connection tables), but if unavoidable, the OEAbsCanonicalConfTest class shouldbe used instead.


54 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEIsomericConfTest ( bool compTitles = true )The constructor for OEIsomericConfTest has a default argument for whether or not to compare titles. If theconstructor is called with no arguments or with the argument true, the titles will be required to be the same.Otherwise, the titles will not be compared. In the latter instance, each conformer will have the individual title ofits original connection table and the multi-conformer molecule will reflect the title of the active conformer.8.16 OELibaryGenclass OELibraryGen8.16.1 ConstructorsOELibraryGen ( )Default constructor.OELibraryGen ( const char ∗smirks , bool strictSmirks=true )Initialize an OELibraryGen instance with a SMIRKS pattern. Success of initialization can be tested using theoperator bool method. The second constructor argument is used to specify whether the SMIRKS stringshould be interpreted using strict SMIRKS semantics. Here strict means in full compliance with the SMIRKSlanguage defined by its originator, Daylight CIS, Inc. If the default value of true is used, the SMIRKS stringmust have corresponding reaction mapped reactant and product atoms. Mapped product atoms that do not havecorresponding mapped reactant atoms are considered invalid SMIRKS and will result in a failure to initialize theOELibraryGen instance. Strict SMIRKS also requires unmapped reactant atoms to be destroyed in the reaction.Passing a boolean value of false to the second method argument will relax both of the strict SMIRKS restrictions.OELibraryGen ( const OELibraryGen &rhs )Copy constructor. Constructs a copy of the OELibraryGen instance given as the argument to the constructor.8.16.2 AddStartingMaterialunsigned int AddStartingMaterial ( OESystem : : OEIter&,unsigned int reacnum ,bool umatch=true )unsigned int AddStartingMaterial ( OESystem : : OEIterBase∗,unsigned int reacnum ,bool umatch=true )unsigned int AddStartingMaterial ( const OEMolBase &mol ,unsigned int reacnum ,bool umatch = true )The AddStartingMaterial methods are used to initialize the starting materials corresponding to a reactioncomponent (reactant). An iterator over molecules or a single molecule may be passed as the first argument to theoverloaded methods. Subsequent calls to the AddStartingMaterial methods append to the list of startingmaterials set in prior calls. The second argument specifies the reactant to which the starting materials correspond.A copy of the staring material molecules are stored internally with the atom maps from the reactant pattern. Thisis done for efficiency, as each product molecule requires very little computational work to be done because of


8.16. OELibaryGen 55the starting material preprocessing. The final argument is used to control the pattern matching of the reactantpattern to the staring material. If the value passed is true, only matches that contain a unique set of atoms relativeto previously identified matches are used. If the value is false, every possible match including those related bysymmetry will be used. Reactant patterns are unique matched by default.8.16.3 operator()bool operator ( ) ( OEMolBase &mol ) constThis method applies the set of transformations stored in the OELibraryGen instance to the molecule passed asthe only argument to the method. The passed molecule must be composed of one reactant molecule per reactantspecified in the reaction with which the OELibraryGen instance was initialized. The passed molecule shouldbe constructed by taking molecules retrieved using the GetReactants method and concatenating them togetherusing either the OEAddMols function or the OEMolBase::operator+= method. Although this interface maybe useful, it is not intended to be the primary interface for molecule construction using the OELibraryGenmethod. The GetProducts method provides a more natural means for iterating or randomly accessing productmolecules.8.16.4 operator booloperator bool ( )constThis method returns boolean true if the OELibraryGen instance has been initialized correctly.OELibraryGen instance has not been initialized properly this method will return boolean false.If the8.16.5 ClearStartingMaterialvoid ClearStartingMaterial ( unsigned reacnum )This methods removes any starting materials previously set by either the AddStartingMaterial andSetStartingMaterial methods corresponding to the reactant pattern number passed as the argument to themethod.8.16.6 GetExplicitHydrogensbool GetExplicitHydrogens ( )constThis method returns current state of the variable that controls the behavior of the OELibraryGen instance withrespect to handling hydrogens during application of reaction transforms. See SetExplicitHydrogens for amore complete explanation of possible hydrogen handling modes.8.16.7 GetProductsOESystem : : OEIterBase ∗GetProducts ( )constThis method is the primary interface for generating a library of products from a reaction and a set of reactants. Thepointer to an iterator base class over molecules must be assigned to an iterator over molecules. The following is anexample assignment:


56 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEIter iter = libgen . GetProducts ( ) ;The returned iterator may be used to generate reaction products in sequence, or by random access using theOEIter::operator+= and OEIter::operator-= methods.8.16.8 GetReactantsOESystem : : OEIterBase ∗GetReactants ( unsigned int rnum ) constThe GetReactants method takes an integer corresponding to the reactant component number as specified inthe reaction with which the OELibraryGen instance was initialized. Reactants are numbered starting from zero,and incremented by one when a reactant atom is found that is disconnected from the first component. For example,in a SMIRKS string the reactants are numbered starting from zero for the leftmost reactant, and increasing by onefor every dot disconnection that isn’t grouped with a previous part using parentheses.8.16.9 GetTitleSeparatorbool GetTitleSeparator ( const char ∗cptr ) constThe GetTitleSeparator method retrieves the string used to separate molecule titles in product moleculesgenerated by the OELibraryGen class. The titles of product molecules are created by concatenating reactantmolecule titles with a delimiter or separator inserted between the reactant molecule titles. The default separator isthe underscore character “ ”. The title separator string may be changed by calling the SetTitleSeparatormethod. The method always returns true.8.16.10 GetValenceCorrectionbool GetValenceCorrection ( )constThe GetValenceCorrection method returns the current valence correction state of the parentOELibraryGen instance. See SetValenceCorrection for a description of possible valence correctionmodes.8.16.11 Initbool Init ( const char ∗smirks , bool strictSmirks=true )This method is used to initialize an OELibraryGen instance with a SMIRKS pattern passed as a pointer to aconstant character string given as the first argument to the method. If the OELibraryGen instance is initializedsuccessfully the method will return boolean true. If the SMIRKS string is invalid or initialization fails the methodwill return boolean false. The second argument to the method is used to specify whether the SMIRKS stringshould be interpreted using strict SMIRKS semantics. By default, the SMIRKS string is interpreted using strictsemantics. Here strict means in full compliance with the SMIRKS language defined by its originator, DaylightCIS, Inc. SMIRKS requires that reactant atoms that are mapped must appear and have corresponding mappedatoms on the product side. In addition, unmapped reactant atoms are destroyed as part of the reaction. Passing aboolean value of false to the second method argument relaxes both of these restrictions. A mapped reactant atomthat does not have a corresponding mapped product atom is valid, and will be destroyed as part of the reaction.Unmapped reactant atoms will be used to match the reactant pattern, but are not destroyed when the reaction isapplied. The resulting SMIRKS like reactions may therefore be more easily readable by humans as fewer atomsmay be required to be mapped.


8.16. OELibaryGen 57bool Init ( const OEQMolBase &qmol , bool strictSmirks=true )This method initializes an OELibraryGen instance with a query molecule. If query molecule is created usingthe OEParseSmirks function, and if the reaction is desired to be interpreted using strict SMIRKS semantics(see Init(const char*, bool strictSmirks for explanation of strict SMIRKS) then the default valuefor the second argument to the method should be used. Passing a boolean value of false to the second argumentwill relax the restrictions imposed by strict SMIRKS semantics.8.16.12 NumReactantsunsigned int NumReactants ( )constThe NumReactants method returns the number of separate reactants that the OELibraryGen instance perceivedduring initialization. The value returned will be equal to the number of graphically disconnected reactantsthat are not grouped together using the SMIRKS parts primitive.8.16.13 SetExplicitHydrogensbool SetExplicitHydrogens ( bool )This variable sets the hydrogen handling mode for the OELibraryGen instance. OELibraryGen instanceare constructed by default with the explicit hydrogen mode set to true. Reactions may be executed using eitherimplicit or explicit hydrogens represented in the starting materials for a reaction. If the value is true, theOELibraryGen instance will add explicit hydrogens to reactant molecules when they are initialized using eitherof the SetStartingMaterial methods. If the value is false, then both of the SetStartingMaterialmethods will suppress any explict hydrogens in the reactant molecules, and simply retain the implicit hydrogencounts for remaining non-hydrogen atoms. The hydrogen handling mode must be assigned prior to callingSetStartingMaterial. Calling SetExplicitHydrogens after SetStartingMaterial will havenot effect. Note that the explicit hydrogen setting in effect modifies the semantics of smirks. If the programmerwishes to implement strict SMIRKS according to the Daylight standard, in full, explicit hydrogens should be seton.8.16.14 SetStartingMaterialunsigned int SetStartingMaterial ( OESystem : : OEIter &moliter ,unsigned int reacnum ,bool umatch=true )unsigned int SetStartingMaterial ( OESystem : : OEIterBase ∗moliter ,unsigned int reacnum ,bool umatch=true )unsigned int SetStartingMaterial ( const OEMolBase &mol ,unsigned int reacnum ,bool umatch = true )The SetStartingMaterial methods are used to initialize the starting materials corresponding to a reactioncomponent (reactant). An iterator over molecules or a single molecule may be passed as the first argument to theoverloaded methods. Subsequent calls to the SetStartingMaterial methods discard starting materials setin prior calls. The second argument specifies the reactant to which the starting materials correspond. A copy ofthe staring material molecules are stored internally with the atom maps from the reactant pattern. This is donefor efficiency, as each product molecule requires very little computational work to be done because of the startingmaterial preprocessing. The final argument is used to control the pattern matching of the reactant pattern to thestaring material. If the value passed is true, only matches that contain a unique set of atoms relative to previously


58 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsidentified matches are used. If the value is false, every possible match including those related by symmetry will beused. Reactant patterns are unique matched by default.8.16.15 SetTitleSeparatorbool SetTitleSeparator ( const char ∗cptr )The SetTitleSeparator method is used to alter the separator or delimiter used by the OELibraryGen classto compose product molecule titles. Product molecule titles are created by concatenating reactant molecule titlesseparated by a title separator or delimiter. The default separator is the underscore character “ ”. This methodallows the title separator to be modified. The method will store the new title separator passed to the method, andreturn true for any valid C style string. The method will return false if a null pointer is passed as the callingargument. The title separator must be set prior to calling GetProducts. Calling SetTitleSeparator aftercalling GetProducts will have no affect on the resultant product molecule titles.8.16.16 SetValenceCorrectionbool SetValenceCorrection ( bool )The SetValenceCorrection method controls the valence correction mode setting of an OELibraryGeninstance. OELibraryGen instances are constructed by default with the valence correction mode set to false.Valence correction mode can be turned on by passing a boolean true value to an OELibraryGen instance usingthis method. When valence correction mode is enabled, the OELibraryGen instance will attempt to adjust thehydrogen count on atoms in the product molecule that are involved in the reaction to match the original valencestate of the reactant. For product atoms that do not undergo a nuclear reaction (atomic number is retained) thehydrogen count is either increased or decreased to match the initial valence state of the corresponding reactantatom. Formal charge is taken into account during the hydrogen count adjustment. Note that valence correction ineffect modifies the semantics of smirks. Thus, if the programmer wishes to implement strict SMIRKS accordingto the Daylight standard, in full, valence correction should be set off.8.17 OELingoSimclass OELingoSimThe OELingoSim object provides generic access to a fast one or more fast implementations of the lingo 2Dsimilarity method (see Grant et al., JCIM, 46(5):1912 2006 and Vidal, Thormann and Pons, JCIM, 45(2):386 2005).The public api allows construction of an OELingoSim object based on a single molecule or string describing themolecule. Similarity between this original molecule and any subsequent molecule can then be rapidly calculatedusing another molecule or string.8.17.1 ConstructorsOELingoSim ( )Default constructor. This constructor results in an object that reports OELingoSim::IsValid as false. Thisconstructor is available as an implicit version of the const char * version below.OELingoSim ( const OEMolBase &mol , unsigned type = OELingoType : : Default )


8.17. OELingoSim 59The molecule api for OELingoSim is provided as a convenience for users. It is significantly slower than usingthe string-based api. It also provides less flexibility because the strings are generated inside the object and thuslimited to a specific string type. That detail aside, they are useful for all but the most cpu demanding tasks and takecare of critical details that must be handled externally by users of the string apis. For the lingo type, please see theOELingoType namespace below.OELingoSim ( const char ∗str=0 , unsigned type = OELingoType : : Default )OELingoSim ( const std : : string &str , unsigned type = OELingoType : : Default )The string api for OELingoSim allows use of any string in both construction and similarity testing. Whilecanonical or isomeric SMILES are the most common string to be used, there is absolutely no requirement to usethese strings in generating lingos comparisons. The one critical point is that care must be taken to assure that youare consistent in the type of string you pass to this api whether it be canonical SMILES, isomeric SMILES, IUPACnames or something else. For the lingo type, please see the OELingoType namespace below.OELingoSim ( const OELingoSim &rhs )Copy constructor.8.17.2 OELingoTypenamespace OELingoType{const unsigned Undefined = 0 ;const unsigned IsoSmiMap = 1 ;const unsigned Default = 1 ;}These namespace memebers can be passed into the OELingoSim constructors to specify the type of implementationused to carry out the lingos comparison. These can be used to determine the type of string used with themolecule api (see below) as well as the mechanism with which the lingos comparisons are calculated.The OELingoType::IsoSmiMap implementation (default) perceives atom and bond stereo on the moleculeand then generates a smiles string with the OECreateIsoSmiString function call when using the moleculeapi.unsigned GetType ( )constThis function returns the unsigned int matching the value from the OELingoType namespace that reflects thetype of implementation being used in the OELingoSim object.8.17.3 operator =OELingoSim& operator = ( const OELingoSim &rhs )Assignment operator. This method makes a copy of an existing OELingoSim instance.8.17.4 IsValidbool IsValid ( )constThis method is used to test for successful initialization of an OELingoSim object. If initialization was attemptedwith an invalid molecule, a string shorter than 4 characters, or was default constructedit will not be valid. Similarity


60 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsof any object to an invalid OELingoSim will always be 0.0.8.17.5 Initbool Init ( const OEMolBase &mol )bool Init ( const char ∗str )bool Init ( const std : : string & str )These three initialization functions are designed to put an OELingoSim object into the same state as though theywere just constructed with the same constructor arguments. The single caveat is that the implementation type,which can be set in the constructor, is unchanged by the OELingoSim::Init functions.8.17.6 Similarityfloat Similarity ( const OEMolBase &mol ) constfloat Similarity ( const char ∗str ) constfloat Similarity ( const std : : string &cansmi ) constThese three functions report the lingos similarity between the molecule or string used to create the OELingoSimobject and the molecule or string passed into the OELingoSim::Similarity function. The OEMolBase apiis provided for convenience, and is suitable for most uses, but is somewhat less efficient than comparing stringsdirectly. Any string may be used (canonical SMILES, isomeric SMILES, IUPAC names) in the string api, but caremust be taken to make sure consistent string types are passed to the constructors and similarity functions!8.17.7 ImplementationOELingoSimImpl ∗GetImpl ( ) ;const OELingoSimImpl ∗GetImpl ( ) const ;void SetImpl ( const OELingoSimImpl &impl ) ;These functions allow access to the private OELingoSimImpl implementation class. The details of this classare private and subject to change. Also see the OELingoSim::GetType and the OELingoType namespaceabove.8.18 OEMatchclass OEMatch : public OEMatchBaseThe OEMatch class is a concrete instance of the OEMatchBase abstract base class. The purpose of an OEMatchis to represent a pairwise correspondence between atoms and/or bonds in two different molecules. The correspondencesare normally generated as the result of graph matching operations such as subgraph isomorphismdetermination, maximal common subgraph search, or supergraph search.8.18.1 OEMatch ConstructorsOEMatch ( const std : : vector &a )This constructor instantiates an OEMatch object by making a copy of the passed STL vector of OEMatchPairobjects which contain atom to atom mappings.


8.18. OEMatch 61OEMatch ( const std : : vector &b )This constructor instantiates an OEMatch object by making a copy of the passed STL vector of OEMatchPairobjects which contain bond to bond mappings.OEMatch ( const std : : vector &a ,const std : : vector &b )This constructor instantiates an OEMatch object by making a copy of the passed STL vectors of OEMatchPairobjects which contain atom to atom and bond to bond mappings.OEMatch ( const OEMatchBase &m )Copy constructor. The contents of the passed OEMatchBase reference are copied into the newly constructedOEMatch instance.8.18.2 operator =const OEMatch& operator=(const OEMatchBase &m )Assignment operator. The contents of the passed OEMatchBase reference are copied into an OEMatch instance.8.18.3 AddPairbool AddPair ( const OEAtomBase ∗pattern , const OEAtomBase ∗target )This method is used to add a matching pair of atoms to an OEMatch instance. The atom pair will be added to theend of any existing atom pairs in the OEMatch instance. No validity checks are performed on the pointers passedto the method. The method will return true if an atom pair is successfully added to the OEMatch instance.bool AddPair ( const OEBondBase ∗pattern , const OEBondBase ∗target )This method is used to add a matching pair of bonds to an OEMatch instance. The bond pair will be added to theend of any existing bond pairs in the OEMatch instance. No validity checks are performed on the pointers passedto the method. The method will return true if a bond pair is successfully added to the OEMatch instance.8.18.4 CreateCopyOEMatchBase ∗CreateCopy ( )constCreate a copy of the contents of an OEMatch instance, and return a pointer to the newly created copy. The newcopy is allocated dynamically and should be deallocated using the C++ delete operator.8.18.5 GetAtomsOESystem : : OEIterBase ∗GetAtoms ( )constThis method returns an iterator over OEMatchPairs which contain the atom to atom correspondences in the OE-Match instance. The returned OESystem::OEIterBase pointer should be assigned to an instance of an OESystem::OEIterto prevent memory leaks.8.18.6 GetBonds


62 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOESystem : : OEIterBase ∗GetBonds ( )constThis method returns an iterator over OEMatchPairs which contain the bond to bond correspondences in the OE-Match instance. The returned OESystem::OEIterBase pointer should be assigned to an instance of an OESystem::OEIterto prevent memory leaks.8.18.7 GetPatternAtomsOESystem : : OEIterBase ∗GetPatternAtoms ( )constThis method returns an iterator over the match-ordered atoms of the pattern molecule.8.18.8 GetPatternBondsOESystem : : OEIterBase ∗GetPatternBonds ( )constThis method returns an iterator over the match-ordered bonds of the pattern molecule.8.18.9 GetTargetAtomsOESystem : : OEIterBase ∗GetTargetAtoms ( )constThis method returns an iterator over the match-ordered atoms of the target molecule.8.18.10 GetTargetBondsOESystem : : OEIterBase ∗GetTargetBonds ( )constThis method returns an iterator over the match-ordered bonds of the target molecule.8.18.11 NumAtomsunsigned int NumAtoms ( )constThis method returns the number of OEMatchPairs of atoms (atom equivalences) in the OEMatch instance.8.18.12 NumBondsunsigned int NumBonds ( )constThis method returns the number of OEMatchPairs of bonds (bond equivalences) in the OEMatch instance.8.19 OEMatchBaseclass OEMatchBase


8.19. OEMatchBase 63The <strong>OEChem</strong> OEMatchBase class is used to represent the equivalences or correspondences found in a substructure(or similar) match. The same OEMatchBase class is used to represent substructure hits, maximal common subgraphfragments, tautomer equivalences, automorphisms and sequence alignments.8.19.1 CreateCopyvirtual OEMatchBase ∗CreateCopy ( )constCreate a copy of the contents of an OEMatch instance, and return a pointer to the newly created copy. The newcopy is allocated dynamically and should be deallocated with the C++ delete operator.8.19.2 GetAtomsvirtual OESystem : : OEIterBase ∗GetAtoms ( )constThis method returns an iterator over OEMatchPairs which contain the atom to atom correspondences in the OE-MatchBase instance. The returned OESystem::OEIterBase pointer should be assigned to an instance of an OESystem::OEIterto prevent memory leaks.8.19.3 GetBondsThis method returns an iterator over OEMatchPairs which contain the bond to bond correspondences in the OE-MatchBase instance. The returned OESystem::OEIterBase pointer should be assigned to an instance of an OESystem::OEIterto prevent memory leaks.virtual OESystem : : OEIterBase ∗GetBonds ( )const8.19.4 GetPatternAtomsOESystem : : OEIterBase ∗GetPatternAtoms ( )constThis method returns an iterator over the match-ordered atoms of the pattern molecule.8.19.5 GetPatternBondsOESystem : : OEIterBase ∗GetPatternBonds ( )constThis method returns an iterator over the match-ordered bonds of the pattern molecule.8.19.6 GetTargetAtomsOESystem : : OEIterBase ∗GetTargetAtoms ( )constThis method returns an iterator over the match-ordered atoms of the target molecule.8.19.7 GetTargetBonds


64 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOESystem : : OEIterBase ∗GetTargetBonds ( )constThis method returns an iterator over the match-ordered bonds of the target molecule.8.19.8 NumAtomsvirtual unsigned int NumAtoms ( )constReturn the number of atom equivalences (atoms) in a match.8.19.9 NumBondsvirtual unsigned int NumBonds ( )constReturn the number of bond equivalences (bonds) in a match.8.20 OEMatchPairfields:template OEMatchPairT ∗patternT ∗target8.20.1 ConstructorsOEMatchPair ( )OEMatchPair ( T ∗pat , T ∗targ )The OEMatchPair template is used to represent both atom-atom and bond-bond equivalences in pattern matching.Each OEMatchPair represents a correspondence (or matching) between a pattern atom or bond in the querymolecule, and a target atom or bond in the target molecule.8.20.2 operator =OEMatchPair& operator = ( const OEMatchPair &mp )Assignment operator. Copy the contents of an OEMatchPair into an existing OEMatchPair instance.8.21 OEMCMolBasetypedef OEMCMolBaseT OEMCMolBase ;


8.22. OEMCMolBaseT 65OEMCMolBase is a convenience typedef for the most common OEMCMolBaseT template instantiation. It is aOEMCMolBaseT with coordinate type float and dimensionality of three.8.22 OEMCMolBaseTtemplateclass OEMCMolBaseT : public OEMolBaseOEMCMolBaseT is the basic multi-conformer molecule in <strong>OEChem</strong>. It is an abstract base class which defined theinterface for multi-conformer molecule implementations. OEMCMolBaseT has two template arguments. The first,class C, is the coordinate representation type. The second, unsigned int dim, is the dimensionality of therepresentation. OEMCMolBaseT have an interface which allow access to conformers in a modal or a non-modalmanner.8.22.1 ConfTypetypedef OEConfBaseT ConfType ;This typedef allows generic declaration of the conformer type contained in the OEMCMolBaseT viaOEMCMolBaseT::ConfType.8.22.2 Copyvirtual bool Copy ( const OEMCMolBaseT &) = 0virtual bool Copy ( const OEConfBaseT &) = 0Copy is a pure virtual protected helper function which allows operator= to act like it is virtual even though virtualoperators are not possible.8.22.3 ConstructorsOEMCMolBaseT ( )OEMCMolBaseT ( const OEMCMolBaseT &rhs )OEMCMolBaseT ( const OESystem : : OEBase &rhs )OEMCMolBaseT has three constructors including the default constructor. All of the constructors are empty functionswhich simply pass the appropriate initialization parameter up the inheritance tree to the OEMolBase constructor.The default constructor and the constructor which takes an OEBase create an OEMCMolBase which hasno atoms or bonds, but which does have a single conformer which is the active conformer. Additional constructorsare described in the OEMolBase and OEBase sections below.8.22.4 operator=OEMCMolBaseT& operator= ( const OEMCMolBaseT &rhs )OEMCMolBaseT& operator= ( const OEConfBaseT &rhs )


66 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsAppropriate assignment of multi-conformer molecules via this abstract base class is possible using the virtual Copyfunction.8.22.5 Active ConformerThis section details the <strong>API</strong> for modal access to conformers.virtual bool SetActive ( OEConfBaseT ∗conf ) = 0virtual OEConfBaseT ∗GetActive ( ) const = 0virtual bool PushActive ( OEConfBaseT∗conf ) = 0virtual void PopActive ( ) = 0These four functions can be used to set the OEMCMolBase into a state where it acts as if it is an OEMolBasewith coordinates the same as the active conformer (e.g. - the OEMCMolBaseT is put in the “mode” of the selectedconformer). SetActive makes the conformer passed in become the active conformer. The conformer passed inmust already be a member of the OEMCMolBase. GetActive() returns the currently active conformer. Thesetwo functions are often sufficient for all the needs of modal access in multi-conformer molecules.In rare cases, it may be important to maintain a stack of active conformers. For these cases, the PushActiveand PopActive functions are defined. PushActive makes the new conf the active conformer and pushed theprevious active conformer down the stack. PopActive removes the top active conformer from the active stackand makes the next highest conformer in the stack active.8.22.6 GetMaxConfIdxvirtual unsigned int GetMaxConfIdx ( ) const = 0Returns the maximum index a conformer of this OEMCMolBaseT will have. Similar to GetMaxAtomIdx()and GetMaxBondIdx() this function is useful for creating temporary external data structures which can holdinformation which can be referenced via the OEConfBaseT::GetIdx() function.8.22.7 NewConfGenerates a new conformer in this OEMCMolBaseT.virtual OEConfBaseT∗ NewConf ( ) = 0virtual OEConfBaseT∗ NewConf ( const C ∗coords ) = 0virtual OEConfBaseT∗ NewConf ( const OEMolBase ∗) = 0virtual OEConfBaseT∗ NewConf ( const OEConfBaseT ∗) = 0virtual OEConfBaseT∗ NewConf ( const OEConfBaseT ∗ ,OETYPENAME std : : vector &t)=0virtual OEConfBaseT∗ NewConf ( const OEConfBaseT ∗ ,const OETrans &) = 0These functions generate a new conformer which is owned by the current OEMCMolBaseT. Each of the functionswill return a pointer to the newly created conformer. The NewConf functions act as virtual constructors of theOEConfBaseT objects. NewConf() constructs a conformer with its default constructor. NewConf(constOEMolBase *) and NewConf(const OEConfBaseT *) copy construct a new conformer withthe coordinates from the object passed into the function. The objects passed in must have the same graph as thecurrent OEMCMolBaseT. NewConf(const C *coords) constructs a new conformer with the coordinatespassed in as coords. The coords array is presumed to be of type float or double. The array must be of lengthGetMaxAtomIdx()*dim, and the coordinates for each atom in the new conformer should be the dim values inthe array starting at coords[atom->GetIdx()].


8.22. OEMCMolBaseT 678.22.8 NumConfsvirtual unsigned int NumConfs ( ) const = 0Returns the number of conformers contained in the OEMCMolBaseT.8.22.9 GetConfvirtual OEConfBaseT∗GetConf ( const OESystem : : OEUnaryPredicate&) constReturns the first conformer in the molecule for which the predicate passed in returns true.8.22.10 Delete Conformersvirtual bool DeleteConf ( OEConfBaseT ∗) = 0virtual void DeleteConfs ( ) = 0The first function deletes the conformer which is passed in from the OEMCMolBase.DeleteConfs() deletes all of the conformers from an OEMCMolBaseT. This is a very useful function forcreating a new transformed OEMCMolBaseT from an untransformed molecule. However, DeleteConfs()leaves the OEMCMolBaseT in an unstable state. It should be used with care an followed shortly with a call toNewConf().8.22.11 SweepConfsvirtual bool SweepConfs ( ) = 0Clean up unused memory and objects which may be associated with the conformers of the OEMCMolBaseT.Renumber the conformer indices sequentially. This function invalidates the conformer indices of all conformersin a molecule. Note that this function doesn’t guarantee that all conformer indices are sequential upon completion(some molecule implementations may treat OEMolBase::Sweep as a no-op).8.22.12 OrderConfsvirtual bool OrderConfs ( const std : : vector&)Reorders the conformers in the molecule to the order specified in the vector argument. If the vector contains anincomplete list, the remaining conformers will come at the end. This function call changes the order in which theconformers are returned by OEMCMolBaseT::GetConfs(), but does not change the conformer indices.8.22.13 GetConfsvirtual OESystem : : OEIterBase∗GetConfs ( ) const = 0virtual OESystem : : OEIterBase∗GetConfs ( const OESystem : : OEUnaryPredicate&) const


68 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsThese functions return an iterator over the conformers in the molecule. The return value of this function shouldalways be assigned to an OEIter. The function which takes no arguments returns an iterator over all of the conformers.The function which takes a predicate returns an iterator which only contains conformers for which thepredicate return true.8.22.14 OEMolBaseOEMCMolBaseT derives publicly from OEMolBase. It supports the full <strong>API</strong> of an OEMolBase, and anyfunction which takes an OEMolBase as an argument (e.g. OECreateSmiString), can be passed anOEMCMolBaseT. See the section on OEMolBases for details on this <strong>API</strong>.8.22.15 OEBaseOEMCMolBaseT derives publicly from OEBase via OEMolBase. The OEMCMolBaseT objects fullysupport the OEBase <strong>API</strong>, including all generic data functions (e.g. OEBase::GetData andOEBase::SetData).8.23 OEMCSFuncOEMCSFunc is an abstract base class that defines the <strong>API</strong> used for scoring subgraph matches. The scores generatedby implementations of OEMCSFunc influence the sorting and retention of maximum common subgraph matchesgenerated by the OEMCSSearch class.8.23.1 operator()double operator ( ) ( const OEMolBase &pattern , const OEMolBase &target ,OEAtomBase ∗∗atoms , OEBondBase ∗∗bonds )Scoring function. This method is called automatically by the OEMCSSearch class when a common subgraph oftwo molecules is identified. The pattern (query) molecule and target molecule currently being matched are passedas the first and second arguments to the function. The arrays of pointers to atoms and bonds hold the atom andbond correspondences between the pattern and target. The arrays are the length of the maximum atom and bondindices of the pattern molecule. The indices of the atoms and bonds in the pattern molecule can be used to lookup the corresponding atoms and bonds in the target molecule. Subgraphs may not include all pattern atoms. Arraypositions for unmatched atoms and bonds are assigned to the hex value 0x0.The integer part of the double precision floating point value returned by the method is used to determine maximalcommon subgraphs. All integer part scores which are smaller than the maximum computed value for any subgraphare discarded by OEMCSSearch. The decimal part of the floating point value returned by the method is used tosort the matches found by OEMCSSearch. For example, by scoring matches using the function (number of atoms+ (number of bonds/100)), all matches which have the same number of subgraph atoms would be retained but the


8.24. OEMCSMaxAtoms 69matches would be returned in order of decreasing number of bonds matched.8.23.2 CreateCopyOEMCSFunc ∗CreateCopy ( )constCreate a copy of an OEMCSFunc instance, and return a pointer to the newly created copy. The new copy isallocated dynamically and should be deallocated using the C++ delete operator.8.24 OEMCSMaxAtomsclass OEMCSMaxAtoms : public OEMCSFuncThe OEMCSMaxAtoms class is an implementation of OEMCSFunc designed to order maximum common substructurematches by the maximum number of atoms included in the graph match. If two common structurematches having the same number of atoms, ties are split based on the number of bonds contained in the match.double operator ( ) ( const OEMolBase &pattern ,const OEMolBase &target ,OEAtomBase ∗∗atoms ,OEBondBase ∗∗bonds )This method is called by its parent OEMCSSearch instance. The method is called with the pattern molecule,target molecule, and arrays and atoms and bonds containing the correspondences found for the a common structurematch. The method computes a value based on the number of atoms and bonds in the common structure matchwhich is used to determine the maximum common structure match.OEMCSFunc ∗CreateCopy ( )constDeep copy constructor. This method returns an OEMCSMaxAtoms instance. The memory for the returned instanceis allocated dynamically. The operator delete method should be called for the returned instance to preventa memory leak.8.25 OEMCSMaxBondsclass OEMCSMaxBonds : public OEMCSFuncThe OEMCSMaxBonds class is an implementation of OEMCSFunc designed to order maximum common substructurematches by the maximum number of bonds included in the graph match. If two common structurematches have the same number of bonds, ties are split based on the number of atoms contained in the match.double operator ( ) ( const OEMolBase &pattern ,const OEMolBase &target ,OEAtomBase ∗∗atoms ,OEBondBase ∗∗bonds )This method is called by its parent OEMCSSearch instance. The method is called with the pattern molecule,target molecule, and arrays and atoms and bonds containing the correspondences found for the a common structurematch. The method computes a value based on the number of atoms and bonds in the common structure matchwhich is used to determine the maximum common structure match.OEMCSFunc ∗CreateCopy ( ) const


70 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsDeep copy constructor. This method returns an OEMCSMaxBonds instance. The memory for the returned instanceis allocated dynamically. The operator delete method should be called for the returned instance to preventa memory leak.8.26 OEMCSMaxAtomsCompleteCyclesclass OEMCSMaxAtomsCompleteCycles : public OEMCSFuncThe OEMCSMaxAtomsCompleteCycles class is an implementation of OEMCSFunc designed to order maximumsubstructure matches by the maximum number of atoms included in the graph match, with a variable prioritygiven to matches which contain complete cycles common to both pattern and target.8.26.1 ConstructorOEMCSMaxAtomsCompleteCycles ( double a = 1 . 0 )The constructor takes a double precision scaling factor as argument, with a default value of ’1.0’. The scaling(or penalty) factor is used to subtract from the total score composed of matching atoms and bonds the number ofpattern ring bonds that are not matches by a target bond. This has the affect of scoring matches more highly whenpattern ring bonds are matched.double operator ( ) ( const OEMolBase &pattern ,const OEMolBase &target ,OEAtomBase ∗∗atoms ,OEBondBase ∗∗bonds )This method is called by its parent OEMCSSearch instance. The method is called with the pattern molecule,target molecule, and arrays and atoms and bonds containing the correspondences found for the a common structurematch. The method computes a value based on the number of atoms and bonds in the common structure matchwhich is used to determine the maximum common structure match.OEMCSFunc ∗CreateCopy ( )constDeep copy constructor. This method returns an OEMCSMaxAtomsCompleteCycles instance. The memoryfor the returned instance is allocated dynamically. The operator delete method should be called for thereturned instance to prevent a memory leak.8.27 OEMCSMaxBondsCompleteCyclesclass OEMCSMaxBondsCompleteCycles : public OEMCSFuncThe OEMCSMaxBondsCompleteCycles class is an implementation of OEMCSFunc designed to order maximumsubstructure matches by the maximum number of bonds included in the graph match, with a variable prioritygiven to matches which contain complete cycles common to both pattern and target.8.27.1 ConstructorOEMCSMaxBondsCompleteCycles ( double a = 1 . 0 )


8.28. OEMCSSearch 71The constructor takes a double precision scaling factor as argument, with a default value of ’1.0’. The scaling(or penalty) factor is used to subtract from the total score composed of matching atoms and bonds the number ofpattern ring bonds that are not matches by a target bond. This has the affect of scoring matches more highly whenpattern ring bonds are matched.double operator ( ) ( const OEMolBase &pattern ,const OEMolBase &target ,OEAtomBase ∗∗atoms ,OEBondBase ∗∗bonds )This method is called by its parent OEMCSSearch instance. The method is called with the pattern molecule,target molecule, and arrays and atoms and bonds containing the correspondences found for the a common structurematch. The method computes a value based on the number of atoms and bonds in the common structure matchwhich is used to determine the maximum common structure match.OEMCSFunc ∗CreateCopy ( )constDeep copy constructor. This method returns an OEMCSMaxBondsCompleteCycles instance. The memoryfor the returned instance is allocated dynamically. The operator delete method should be called for thereturned instance to prevent a memory leak.8.28 OEMCSSearchclass OEMCSSSearchThis class is used to identify a set of maximum substructures common to two molecules. Derivations of theOEMCSFunc can be used to define which substructure is the maximum common substructure.8.28.1 ConstructorOEMCSSearch ( )Default constructor.OEMCSSearch ( const char ∗smarts )Construct an instance of an OEMCSSearch object using a SMARTS pattern. The SMARTS pattern is parsed intoa query molecule (OEQMolBase).OEMCSSearch ( const OEQMolBase &qmol )Construct an instance of an OEMCSSearch object using a query molecule.OEMCSSearch ( const OEMolBase &mol , unsigned int a , unsigned int b )Construct an instance of an OEMCSSearch object using a molecule and expression options. The atom and bondexpression options passed as the second and third arguments to the method are defined in the OEExprOpts namespace.The expression options are used to convert the atom and bond data into expression trees which are usedduring the common subgraph search.OEMCSSearch ( const OEMCSSearch &mcs )


72 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsCopy constructor. Copies the contents of the passed OEMCSSearch object into a newly constructed OEMCSSearchinstance.8.28.2 operator=OEMCSSearch &operator=(const OEMCSSearch &mcs )Assignment operator. Copies the data from the passed OEMCSSearch object into an existing OEMCSSearchinstance.8.28.3 operator booloperator bool ( )constThis method is used to test for successful initialization of an OEMCSSearch object. If initialization was attemptedwith an invalid SMARTS pattern or query molecule then this method will return false. If initialization was completedsuccessfully this method will return true. An instance of OEMCSSearch is considered to be uninitializedwhen constructed with the default constructor.8.28.4 AddConstraintbool AddConstraint ( const OEMatchPair &mp )bool AddConstraint ( const OEMatchPair &mp )The search space of a maximum common subgraph determination can be restricted by constraining pairs of nodesor edges (atoms or bonds) to be mapped onto one another in all subgraph solutions. Failure to satisfy atom or bondpairwise constraints will prevent any subgraph solutions from being identified. Constraints are considered satisfiedin subgraphs which do not contain any constrained atoms or bonds in either the pattern or target molecules.Both AddConstraint methods return true if a constraint is added successfully. If the pattern atom or bond inthe OEMatchPair does not exist as part of the query molecule created in the initialization of the OEMCSSearchobject then AddConstraint will return false. Multiple calls to AddConstraint using the same pattern atomor bond will cause previously stored constraints to be overwritten as constraints are mutually exclusive. It isimpossible to satisfy multiple simultaneous constraints for a single pattern atom or bond, hence the exclusivity.8.28.5 ClearConstraintsvoid ClearConstraints ( )The ClearConstraints method eliminates all prior match constraints set with the AddConstraint methods.8.28.6 GetMaxMatchesunsigned int GetMaxMatches ( )constThis method returns the maximum number of subgraph isomorphism solutions that the instance of OEMCSSearchwill identify before terminating the search. A value of zero indicates that no arbitrary limit has been set on the


8.28. OEMCSSearch 73total number of subgraph isomorphism solutions to be identified. By default, instances of OEMCSSearch set themaximum number of matches to 1024.8.28.7 GetMinAtomsunsigned int GetMinAtoms ( )constThis method is used to set the minimum size of a common subgraph for the subgraph to be returned as a maximumcommon subgraph. In theory, the smallest possible subgraph can consist of a single atom. For many applications,however, the maximum common must reach a user-specified size to be considered useful. Maximum commonsubgraph matches which have fewer than the minimum number of atoms are discarded. By default, the minimumnumber of atoms of a subgraph match is one.8.28.8 GetPatternconst OEQMolBase &GetPattern ( )constA read-only reference to the query molecule contained in an instance of OEMCSSearch can be obtained with thismethod. Const OEQMolBase methods can be used to interrogate the returned OEQMolBase reference. If theinstance of OEMCSSearch has not been initialized, a reference to an empty molecule will be returned.8.28.9 GetSaveRangeunsigned int GetSaveRange ( )constThis method is obsolete and has been retained only to preserve the <strong>API</strong>.8.28.10 Initbool Init ( const char ∗smarts )This method (re)initializes an OEMCSSearch instance using a SMARTS pattern. The smarts pattern is parsedto create a query molecule available for maximum common subgraph matching. The method will return true ifinitialization completes successfully, and false upon failure. Prior state information is cleared before initialization,and is lost even if the method fails to initialize properly.bool Init ( const OEQMolBase &qmol )This method (re)initializes an OEMCSSearch instance using a query molecule (OEQMolBase) reference. Themethod will return true if initialization completes successfully, and false upon failure. Prior state information iscleared before initialization, and is lost even if the method fails to initialize properly.bool Init ( const OEMolBase &mol , unsigned int a , unsigned int b )This method (re)initializes an OEMCSSearch instance using a molecule (OEMolBase) and expression options usedto convert the molecule into a query molecule (OEQMolBase). The atom and bond expression options passed asthe second and third arguments to the method are defined in the OEExprOpts namespace. Expression options areused to convert the atom and bond data into expression trees which are used during the common subgraph search.


74 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsThe method will return true if initialization completes successfully, and false upon failure. Prior state informationis cleared before initialization, and is lost even if the method fails to initialize properly.8.28.11 MatchOESystem : : OEIterBase ∗Match ( const OEMolBase &mol )OESystem : : OEIterBase ∗Match ( const OEQMolBase &qmol )8.28.12 SetMCSFuncbool SetMCSFunc ( const OEMCSFunc &mcsfunc )This method stores a copy of the passed OEMCSFunc functor reference in the OEMCSSearch instance. The copyis then used to evaluate and order subgraphs found during a maximum common subgraph search. Please refer tothe section on OEMCSFunc functors for a detailed description of subgraph evaluation.8.28.13 SetMaxMatchesbool SetMaxMatches ( unsigned int )The SetMaxMatches method alters the maximum number of maximum common subgraph matches that will bereturned by the OEMCSSearch::Match method. The search for maximum common substructures will not terminateimmediately upon reaching this limit. The maximum common subgraph cannot be known unless the MCS iscomposed of all atoms and bonds of at least one of the graphs being compared. The limit of subgraphs to bereturned may be reached with a smaller subgraph than the maximum. In such a case the search continues forlarger subgraphs until the search is exhausted. OEMCSSearch::Match will return the first N maximum commonsubgraphs where N is less than or equal to the maximum match limit. The default limit set upon construction of anOEMCSSearch instance is 1024 matches.8.28.14 SetMinAtomsbool SetMinAtoms ( unsigned int )This method sets the minimum number of atoms required of a subgraph match to be returned a solution by a MCSsearch. A single atom can be a perfectly valid maximum common subgraph, however, for many applications sucha small subgraph may not be considered useful. Setting the minimum number of atoms to a useful size preventsunproductive subgraph matches from being returned by the OEMCSSearch::Match method. The default value forthe minimum number of atoms in a subgraph match is set to one upon construction of an OEMCSSearch instance.8.28.15 SetSaveRangebool SetSaveRange ( unsigned int )This method is obsolete and has been retained only to preserve the <strong>API</strong>.8.28.16 SingleMatch


8.29. OEMol 75bool SingleMatch ( const OEMolBase &mol )bool SingleMatch ( const OEQMolBase &qmol )These methods take a const reference to a molecule (OEMolBase or OEQMolBase) and return true if at leastone common substructure is identified which meets the criteria specified in the OEMCSSearch instance. If atleast subgraph match with greater than or equal to the minimum number of atoms specified in the OEMCSSearchinstance these methods will return true.8.29 OEMolclass OEMolOEMol is a specific implementation of multi-conformer molecules. The OEMol class has the following specificmethods, plus it implements the entire OEMolBase (Section 8.30) <strong>API</strong>.8.29.1 Constructorsexplicit OEMol ( unsigned int type = OEMolType : : OEDefault )//copy ctor from other primary moleculesOEMol ( const OEGraphMol &mol , unsigned int type = OEMolType : : OEDefault )OEMol ( const OEQMol &mol , unsigned int type = OEMolType : : OEDefault )OEMol ( const OEMol &mol , unsigned int type = OEMolType : : OEDefault )//copy ctor from other implementationsOEMol ( const OESystem : : OEBase &base , unsigned int type = OEMolType : : OEDefault )OEMol ( const OEMolBase &mol , unsigned int type = OEMolType : : OEDefault )OEMol ( const OEQMolBase &mol , unsigned int type = OEMolType : : OEDefault )OEMol ( const OEMCMolBase &mol , unsigned int type = OEMolType : : OEDefault )8.29.2 operator =OEMol& operator= ( const OEMol &mol )OEMol& operator= ( const OEMCMolBase &mol )OEMol& operator= ( const OEGraphMol &mol )OEMol& operator= ( const OEMolBase &mol )OEMol& operator= ( const OEQMol &mol )OEMol& operator= ( const OEQMolBase &mol )8.29.3 operator booloperator bool ( )const8.29.4 ConfIdxArraySizeunsigned int ConfIdxArraySize ( )const8.29.5 DeleteConfs


76 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsvoid DeleteConfs ( )8.29.6 DeleteConfbool DeleteConf ( OEConfBase ∗c )8.29.7 GetActiveOEConfBase ∗GetActive ( )const8.29.8 GetConfOEConfBase ∗GetConf ( const OESystem : : OEUnaryPredicate&p ) const8.29.9 GetConfsOESystem : : OEIterBase ∗GetConfs ( )const8.29.10 IsDeletedbool IsDeleted ( OEConfBase ∗c )8.29.11 NewConfOEConfBase ∗NewConf ( )OEConfBase ∗NewConf ( float ∗coords )OEConfBase ∗NewConf ( const OEMolBase ∗m )OEConfBase ∗NewConf ( const OEConfBase ∗c )OEConfBase ∗NewConf ( const OEConfBase ∗c , std : : vector &t )OEConfBase ∗NewConf ( const OEConfBase ∗c , const OETrans &t )8.29.12 NumConfsunsigned int NumConfs ( )const8.29.13 OrderConfsbool OrderConfs ( const std : : vector &vc )8.29.14 PopActive


8.30. OEMolBase 77void PopActive ( )8.29.15 PushActivebool PushActive ( OEConfBase ∗c )8.29.16 ResetConfbool ResetConf ( OEConfBase ∗lhs , OEConfBase ∗rhs )8.29.17 SetActivebool SetActive ( OEConfBase ∗c )8.29.18 SweepConfsbool SweepConfs ( )8.30 OEMolBaseclass OEMolBase : public OESystem : : OEBase8.30.1 operator =OEMolBase& operator = ( const OEMolBase &mol )Make a copy of a molecule. This is a destructive assignment, and the contents of the destination molecule (includingatoms and bonds) are destroyed by the copy.8.30.2 operator +=OEMolBase &operator+=(OEMolBase &lhs , const OEMolBase &rhs )OEQMolBase &operator+=(OEQMolBase &lhs , const OEQMolBase &rhs )OEQMol &operator+=(OEQMol &lhs , const OEQMol &rhs )OEQMol &operator+=(OEQMol &lhs , const OEQMolBase &rhs )8.30.3 operator boolvirtual operator bool ( )const


78 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsDetermine whether the molecule contains any atoms. This function is equivalent to OEMolBase::NumAtoms()!= 0.8.30.4 Clearvirtual void Clear ( )Reset a molecule to its initial state. This method deletes all atoms and bonds that are part of the molecule. Followingan OEMolBase::Clear, the atom and bond indices assigned to new atoms and bonds may not be unique withthose assigned prior to the Clear().8.30.5 Compressvirtual bool Compress ( )8.30.6 DeleteAtomvirtual bool DeleteAtom ( OEAtomBase ∗atm )Delete an atom from a molecule. All bonds connected to the specified atom are also automatically deleted. Followingan atom deletion, the specified OEAtomBase pointer, and the OEBondBase pointers of any incident bonds,are no longer valid and should not be used. The atom index associated with the atom, and the bond indices of anyincident bonds, are no longer recognized by the OEMolBase, but the indices of all other atoms and bonds remainstable, and are unaffected by this call.After deleting atoms or bonds, it may be necessary to call the OEFindRingAtomsAndBonds andOEAssignAromaticFlags functions to update the “in ring” and “aromatic” properties of the atoms and bondsin the modified molecule.8.30.7 DeleteBondvirtual bool DeleteBond ( OEBondBase ∗bnd )Delete a bond from a molecule. Following a bond deletion, the specified OEBondBase pointer is no longer validand should not be used. The bond index associated with the bond is no longer recognized by the OEMolBase, butthe indices of all other bonds remain stable, and are unaffected by this call.After deleting atoms or bonds, it may be necessary to call the OEFindRingAtomsAndBonds andOEAssignAromaticFlags functions to update the “in ring” and “aromatic” properties of the atoms and bondsin the modified molecule.8.30.8 GetAtomvirtual OEAtomBase ∗GetAtom (const OESystem : : OEUnaryPredicate &) const


8.30. OEMolBase 79Retrieve the first atom of a molecule that matches the specified atom atom predicate. If the molecule does notcontain an atom that matches, a NULL pointer, (OEAtomBase*)0, is returned.8.30.9 GetAtomsvirtual OESystem : : OEIterBase ∗GetAtoms ( )constReturn an iterator over all the atoms of a molecule. By default, this returns all the atoms of the moleculein the order they were created. The ordering of the atoms returned by GetAtoms may be modified byOEMolBase::OrderAtoms.virtual OESystem : : OEIterBase ∗GetAtoms (const OESystem : : OEUnaryPredicate &) constReturn an iterator over all of the atoms of a molecule that match the specified atom predicate.8.30.10 GetBondvirtual OEBondBase ∗GetBond (const OESystem : : OEUnaryPredicate &) constRetrieve the first bond of a molecule that matches the specified bond predicate. If the molecule does not contain abond that matches the predicate, a NULL pointer, (OEBondBase*)0, is returned.virtual OEBondBase ∗GetBond ( const OEAtomBase ∗src ,const OEAtomBase ∗dst ) constRetrieve the bond of a molecule between two specified atoms. If the two atoms, “src” and “dst” are not bondedtogether, this function returns the NULL pointer, (OEBondBase*)0.8.30.11 GetBondsvirtual OESystem : : OEIterBase ∗GetBonds ( )constReturn an iterator over all the bonds of a molecule. By default, this returns all the bonds of the molecule in the orderthey were created. The ordering of the bonds returned by GetBonds may be modified by OEMolBase::OrderBonds.virtual OESystem : : OEIterBase ∗GetBonds (const OESystem : : OEUnaryPredicate &) constReturn an iterator over all of the bonds of a molecule that match the specified bond predicate.8.30.12 GetCoordsvirtual bool GetCoords ( const OEAtomBase∗ , float∗) constvirtual bool GetCoords ( const OEAtomBase∗ , double∗) constFill the specified array of floating point values with the Cartesian co-ordinates of the specified atom. This arraymust be large enough to hold at least three values, corresponding to the X, Y and Z values for the given atom.virtual bool GetCoords ( float∗) constvirtual bool GetCoords ( double∗) const


80 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsFill the specified array of floating point values with the Cartesian co-ordinates of all of the atoms in the molecule.The array argument must point to an array of at least 3*OEMolBase::GetMaxAtomIdx() elements. The X,Y and Z coordinates for the atom with index i will be placed at offsets 3*i, 3*i+1 and 3*i+2 respectively.8.30.13 GetDimensionvirtual unsigned int GetDimension ( )constReturn the dimensionality of a molecule. The default value is zero, for unknown or no coordinates, 2 for 2-dimensional co-ordinates (such as depictions) and 3 for 3-dimensional co-ordinates. The dimensionality propertyof a molecule may be set using the OEMolBase::SetDimension method. This property is typically set by theappropriate molecular file format reader (0 for SMILES, 3 for MOL2 and 2 or 3 for MDL SD files etc...) or bycalling the function OESetDimensionFromCoords.8.30.14 GetEnergyvirtual double GetEnergy ( )constReturn the energy of a molecule. The default value is 0.0. The energy property of a molecule may be set usingthe OEMolBase::SetEnergy method. Higher values indicate higher energies and therefore less-favorable or morestrainedstructures.8.30.15 GetMaxAtomIdxvirtual unsigned int GetMaxAtomIdx ( )constReturn a lower bound on the maximum atom index. All atom indices returned by OEAtomBase::GetIdx on atomsbelonging to this molecule are guaranteed to be less than this value. Obviously, the returned result is always greaterthan or equal to OEMolBase::NumAtoms().8.30.16 GetMaxBondIdxvirtual unsigned int GetMaxBondIdx ( )constReturn a lower bond on the maximum bond index. All bond indices returned by OEBondBase::GetIdx on bondsbelonging to this molecule are guaranteed to be less than this value. Obviously, the returned result is always greaterthan or equal to OEMolBase::NumBonds().8.30.17 GetTitlevirtual const char ∗GetTitle ( )constReturn the title string property of a molecule. The default value is the empty string. The title string of a moleculemay be set using the OEMolBase::SetTitle method.8.30.18 IsRxnvirtual bool IsRxn ( )const


8.30. OEMolBase 81Determine whether the molecule represents a reaction/transform. A true value indicates that the molecule representsa reaction, while false indicates the molecule is a simple connection table. The default value is false. Thereaction property of a molecule may be set using the OEMolBase::SetRxn method.8.30.19 NewAtomvirtual OEAtomBase ∗NewAtom ( unsigned int elemno )virtual OEAtomBase ∗NewAtom ( const OEAtomBase &src )Create a new atom. In the first form, the elemno argument specifies the atomic number of the atom to be created,and returns a pointer to the newly created atom. The second form, creates a new atom copying its atomic properties(atomic number, formal charge, implicit hydrogen count, etc...) from the specified atom. This method does notcreate any bonds, and the returned atom is always disconnected.8.30.20 NewBondvirtual OEBondBase ∗NewBond ( OEAtomBase ∗src , OEAtomBase ∗dst ,unsigned int order=0)Create a new bond. The “src”, “dst” and “order” arguments are used to specify the begin atom, the end atom andthe bond order of the new bond. This method returns a pointer to the newly created bond. The atoms specifiedas begin and end atoms must belong to the current molecule. Additionally, a NULL pointer, (OEAtomBase*)0,may be passed as either the begin or end atom (but not both), allowing that atom to be specified later usingOEBondBase::SetBgn or OEBondBase::SetEnd respectively. This helps when creating molecules for applicationsin which the ordering of atoms and/or bonds is significant.After creating new bonds, it may be necessary to call the OEFindRingAtomsAndBonds andOEAssignAromaticFlags functions to update the “in ring” and “aromatic” properties of the atoms and bondsin the modified molecule.8.30.21 NumAtomsvirtual unsigned int NumAtoms ( )constReturn the number of atoms in a molecule.8.30.22 NumBondsvirtual unsigned int NumBonds ( )constReturn the number of bonds in a molecule.8.30.23 OrderAtomsvirtual bool OrderAtoms ( const std : : vector &order )Reorder the atoms of a molecule. This method modifies the order in which the atoms are visited by the iteratorreturned by OEMolBase::GetAtoms. This method does not affect the atom indices of any of the atoms of the


82 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsmolecule. This method does not affect the ordering of any other iterator, including bonds over a molecule, bondsover an atom or neighboring atoms over an atom.8.30.24 OrderBondsvirtual bool OrderBonds ( const std : : vector &order )Reorder the bonds of a molecule. This method modifies the order in which the bonds are visited by the iteratorreturned by OEMolBase::GetBonds. This method does not affect the bond indices of any of the bonds of themolecule. This method does not affect the ordering of any other iterator, including atoms over a molecule, bondsover an atom or neighboring atoms over atom.8.30.25 SetCoordsvirtual bool SetCoords ( const OEAtomBase∗ , const float∗)virtual bool SetCoords ( const OEAtomBase∗ , const double∗)Set the Cartesian co-ordinates of the specified atom to the values specified by the floating point array. The arrayargument must point to array of at least three values, representing the X, Y and Z Cartesian coordinates of theatom, respectively.virtual bool SetCoords ( const float∗)virtual bool SetCoords ( const double∗)Set the Cartesian co-ordinates for all of the atoms in a molecule. The array argument must point to an array of atleast 3*OEMolBase::GetMaxAtomIdx() elements. The X, Y and Z coordinates for the atom with index i,should be placed at offsets 3*i, 3*i+1 and 3*i+2 respectively.8.30.26 SetDimensionvirtual bool SetDimension ( unsigned int dim )Set the dimensionality property of a molecule. The default value is zero. The dimension property of a moleculemay be retrieved using the OEMolBase::GetDimension method. This property is typically set by the appropriatemolecular file format reader, or by calling the function OESetDimensionFromCoords.The **Dimension** property represents the dimensionality of the co-ordinates. This has the default value zero,for unknown or no coordinates, 2 for 2-dimensional co-ordinates (such as depictions) and 3 for 3-dimensionalco-ordinates. This property is typically set by the file format reader indicating the dimensionality of the input file(0 for SMILES, 3 for MOL2 and 2 or 3 for MDL SD files etc...)8.30.27 SetEnergyvirtual bool SetEnergy ( float energy )virtual bool SetEnergy ( double energy )Set the energy of a molecule. The default value is 0.0f. The energy of a molecule may be retrieved using theOEMolBase::GetEnergy method.8.30.28 SetRxn


8.31. oemolistream 83virtual bool SetRxn ( bool rxn )Indicate that the molecule represents a reaction/transform. The default value is false. The reaction property of amolecule may be retrieved using the OEMolBase::IsRxn method.8.30.29 SetTitlevirtual bool SetTitle ( const std : : string title )virtual bool SetTitle ( const char ∗title )Set the title of a molecule. The default value is the empty string. The title property of a molecule may be retrievedusing the OEMolBase::GetTitle method.8.30.30 Sweepvirtual bool Sweep ( )Renumber the atom and bond indices sequentially. This function invalidates the atom and bond indices of allatoms in a molecule. Note that this function doesn’t guarantee that all atom and bond indices are sequential uponcompletion (some molecule implementations may treat OEMolBase::Sweep as a no-op).8.30.31 UnCompressvirtual bool UnCompress ( )8.31 oemolistreamclass oemolistream : public oemolstreambaseThe <strong>OEChem</strong> oemolistream class provides a stream-like abstraction for reading molecules from files, stringsor standard in (std::cin). The oemolistream maintains the format and flavor of molecular reading for thestream. It also manages the conversion between multi-conformer molecules and single conformer molecules incases where the molecule read into is not compatible with the file format (in the sense of a multi-conformer fileformat being read into a single-conformer molecule, or a single-conformer file format being read into a multiconformermolecule). The <strong>OEChem</strong> oemolistreams are capable of uncompressing gzip files while reading.8.31.1 Constructorsoemolistream ( )explicit oemolistream ( const char ∗fname )explicit oemolistream ( const std : : string &fname )explicit oemolistream ( OEPlatform : : oeistream ∗istr , bool owned = true )The oemolistream class supports several forms of constructor. The form without any arguments creates anew oemolistream that is connected to the processes standard in (std::cin). The forms that take a singlestring argument (either a const char* or a const std::string&) open the file specified by thegiven filename. The final form above, that takes a OEPlatform::oeistream can be used to create a newoemolistream from an exisiting oeistream. The second optional argument is used to indicate whether the


84 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsnew oemolistream now “owns” the given oeistream and is therefore responsible for closing and destroyingit when it itself is closed and/or destroyed.To associate a file or a stream with an oemolistream after it has been created, see the oemolistream::openmethod.8.31.2 operator >>bool operator >> ( OEMolBase &mol )bool operator >> ( OEQMolBase &mol )bool operator >> ( OEMCMolBase &mol )bool operator >> ( OEMol &mol )bool operator >> ( OEGraphMol &mol )bool operator >> ( OEQMol &mol )Read a molecule from an input oemolstream. The molecule is read from the input oemolstream in the file formatcurrently associated with that oemolstream. This method is equivalent to the OEReadMolecule function. Thereturn value indicates whether the read operation was successful.This (high-level) method automatically clears the molecule before reading, skips empty or invalidmolecules in the input stream. By default, it automatically calls OEFindRingAtomsAndBonds andOEAssignAromaticFlags to assign the “in ring” and “aromatic” properties of atoms and bonds as a convenienceto the user. <strong>OEChem</strong> also contains low-level file I/O <strong>API</strong>s that allow finer control over the variants ofmolecular file formats read and written. Access to these variants is also available via the SetFlavor method.8.31.3 closevoid close ( )Close an input oemolstream. The oemolistream::close method may be safely called multiple times. Thismethod is called from within the oemolstream destructor and therefore it is not necessary to call this explicitlyunder most circumstances.8.31.4 GetFlavorunsigned int GetFlavor ( unsigned int format ) constReturns the file flavor associated with the format for the input oemolstream. The format arguments are a setof unsigned integers defined by the OEFormat namespace. The flavors are a set of unsigned integer bitmasksdefined in the OEIFlavor namespace. A different set of bitmasks is defined and stored for each input format.The input flavor for any format can be set using the oemolistream::SetFlavor method. The default flavorsare automatically set by the oemolistream constructors.8.31.5 GetFormatunsigned int GetFormat ( )constReturn the file format associated with an input oemolstream. The set of unsigned integer values valid for thisproperty are defined by the OEFormat namespace. By default, when reading from standard in (std::cin),the associated file format is OEFormat::SMILES. The file format property of an input oemolstream may be set


8.31. oemolistream 85using the oemolistream::SetFormat method. Note that the file format property is also set automatically byoemolistream::open based upon the file extension of the specified filename.8.31.6 Getgzbool Getgz ( )Returns whether the stream is reading from a gzip compressed oemolstream. This value can be altered withoemolistream::Setgz function.8.31.7 openbool open ( )bool open ( const char ∗fname )bool open ( const std : : string &fname )Open a file for reading with an input oemolstream. The fname argument specifies the filename of the file tobe opened. The open with no arguments may be used to specify that the input oemolstream should read fromstandard in (std::cin). In this case the format defaults to SMILES. If an argument is used, open sets the fileformat property of the input oemolstream, based upon the extension of the given filename. If the file extensionisn’t recognized, a warning is issued and the file format is set to OEFormat::UNDEFINED. If the filename isappended with “.gz”, the oemolistream will decompress it on-the-fly. The filename-based file format maybe overridden by calling oemolistream::SetFormat explicitly with the desired file format. If only a fileextension is used as the filename (“.oeb.gz”), then std::cin is opened with the format specified by the givenextensions.8.31.8 openstringbool openstring ( const unsigned char ∗buffer , unsigned int len )bool openstring ( const std : : string &str )The openstring methods of an oemolistream allow the input molstream to read from a buffer in memory,instead of from a file or standard in (std::cin). The buffer to be read from is specified either directly by apointer to the input files contents and a length, or as an STL string, const std::string.If the contents of the buffer have been compressed with gzip, the Setgz method should be called before callingopenstring.Internally, the openstring methods make a copy of the specified file contents, allowing the oemolistreamto continue to function independently of whether the original buffer is later modified or deallocated.8.31.9 SetConfTestbool SetConfTest ( const OEConfTest &)Sets the functor class which is used to compare incoming graphs to determine whether they should be placed asconformers of a multi-conformer molecule or be returned individually as single molecules. The default conformertest never places separate graphs into a multi-conformer molecule. There are several pre-defined OEConfTest


86 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsobjects, including OEAbsoluteConfTest, OEIsomericConfTest and OEAbsCanonicalConfTest.8.31.10 SetFlavorbool SetFlavor ( unsigned int format , unsigned int flavor )Set the file flavor for a given format associated with this input oemolstream. The set of unsigned integer formatsare defined by the OEFormat namespace. The set of unsigned integer bitmasks flavors are defined by theOEIFlavor namespace. The current flavor can be queried using the oemolistream::GetFlavor method.Each format has its own specific flavor which must be set separately. The oemolistream constructors set theflavors for all of the formats to their default state.8.31.11 SetFormatbool SetFormat ( unsigned int format )Set the file format associated with an input oemolstream. The set of unsigned integer values valid for this propertyare defined by the OEFormat namespace. By default, when reading from standard in (std::cin), the associatedfile format is OEFormat::SMILES. The file format property of an input oemolstream may be retrieved usingthe oemolistream::GetFormat method. Note that the file format property is also set automatically byoemolistream::open based upon the file extension of the specified filename.8.31.12 Setgzbool Setgz ( bool gz )Specify that the contents of the input molstream are to be treated as compressed by GNU gzip, and decompressedon-the-fly. Usually the “gz” property of an oemolistream is implied automatically from the file extension usedto open the stream for reading. The current “gz” property of a oemolistream can be retrieved using the Getgzmethod.8.31.13 seekvoid seek ( oefpos_t pos}Moves the position of the next valid read to the position indicated. This function takes account of gzip streams andmolecule caching.8.31.14 sizeoefpos_t size ( )Fuction returns the size of the input stream if applicable to the current stream. The return type is a portablefile-system pointer type.8.31.15 telloefpos_t tell ( )


8.32. oemolostream 87Returns the current position of the next read. This function accounts for molecular caching. Note: If you are readingan “oeb” file that was written as multiconformer molecules and is being read with single conformer molecules,all of the conformers are read into cache at once, and the pointer will point to the beginning of a multi-conformermolecule rather than to a conformer inside a molecule.8.32 oemolostreamclass oemolostream : public oemolstreambaseThe <strong>OEChem</strong> oemolostream class provides a stream-like abstraction for writing molecules to files, streamsor standard out (std::cout). The oemolostream maintains the format and flavor of the writer used whenwriting molecules. It also manages gzip compression of the output stream.8.32.1 Constructorsoemolostream ( )explicit oemolostream ( const char ∗fname )explicit oemolostream ( const std : : string &fname )explicit oemolostream ( OEPlatform : : oeostream ∗ostr , bool owned = true )The oemolostream class supports several forms of constructor. The form without any arguments creates anew oemolostream that is connected to the processes standard out (std::cout). The forms that take asingle string argument (either a const char* or a const std::string&) open the file specified by thegiven filename. The final form above, that takes a OEPlatform::oeostream can be used to create a newoemolostream from an exisiting oeostream. The second optional argument is used to indicate whether thenew oemolostream now “owns” the given oeostream and is therefore responsible for closing and destroyingit when it itself is closed and/or destroyed.To associate a file or a stream with an oemolostream after it has been created, see the oemolostream::openmethod.8.32.2 operator


88 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsClose an output oemolstream. The oemolostream::close method may be safely called multiple times.8.32.4 GetFlavorunsigned int GetFlavor ( unsigned int format ) constReturns the file flavor associated with the format for the output molstream. The format arguments are a set ofunsigned integers defined by the OEFormat namespace. The flavors are a set of unsigned integer bitmasks definedin the OEOFlavor namespace. A different set of bitmasks is defined and stored for each output format. Theoutput flavor for any format can be set using the oemolostream::SetFlavor method. The default flavorsare automatically set by the oemolostream constructors.8.32.5 GetFormatunsigned int GetFormat ( )constReturn the file format associated with an output oemolstream. The set of unsigned integer values valid for thisproperty are defined by the OEFormat namespace. By default, when writing to standard out (std::cout), theassociated file format is OEFormat::SMILES. The file format property of an output oemolstream may be setusing the oemolostream::SetFormat method. Note that the file format property is also set automatically byoemolostream::open based upon the file extension of the specified filename.8.32.6 Getgzbool Getgz ( )Returns whether the stream is writing to a gzip compressed oemolstream.oemolostream::Setgz function.This value can be altered with8.32.7 GetStringstd : : string GetString ( void )Return the contents of the in-memory buffer associated with the output molstream. The oemolostream mustpreviously have been opened for writing to an in-memory buffer using the openstring method.8.32.8 Getgzbool Getgz ( )Returns whether the stream is writing to a gzip compressed oemolstream.oemolostream::Setgz function.This value can be altered with8.32.9 openbool open ( )bool open ( const char ∗fname )bool open ( const std : : string &fname )


8.32. oemolostream 89Create (or overwrite) a file for writing with an output oemolstream. The fname argument specifies the filenameof the file to be created. The open with no argument may be used to specify that the output oemolstream shouldwrite to standard out (std::cout). This method sets the file format property of the output oemolstreambased upon the extension of the given filename. Additionally, if the filename end with “.gz”, the file is written ingzip compressed format. If the file extension isn’t recognized, the file format is set to OEFormat::UNDEFINED.The filename based file format may be overridden by calling oemolostream::SetFormat explicitly with thedesired file format. If the filename is only a file extension (e.g. “.oeb.gz”), then std::cout will be opened withthe format appropriate to the given extension.8.32.10 openstringbool openstring ( )bool openstring ( bool gzip )The openstring method allows the oemolostream to be used to writing to an in memory buffer insteadof directly to a file or standard out. Calling openstring instructs the output molstream to start accumulatingoutput in a buffer, which can later be retrieved by calling the oemolostream::GetString method. The formthat accepts a Boolean argument can be used to instruct the output molstream to compress the contents of thein-memory buffer.8.32.11 SetFlavorbool SetFlavor ( unsigned int format , unsigned int flavor )Set the file flavor for a given format associated with this output molstream. The set of unsigned integer formatsare defined by the OEFormat namespace. The set of unsigned integer bitmasks flavors are defined by theOEOFlavor namespace. The current flavor can be queried using the oemolostream::GetFlavor method.Each output format has its own specific flavor which must be set separately. The oemolostream constructorsset the flavors for all of the formats to their default state.8.32.12 SetFormatbool SetFormat ( unsigned int fmt )Set the file format associated with an output molstream. The set of unsigned integer values valid for this propertyare defined by the OEFormat namespace. By default, when writing to standard out (std::cout), the associatedfile format is OEFormat::SMILES. The file format property of an output molstream may be retrieved usingthe oemolostream::GetFormat method. Note that the file format property is also set automatically byoemolostream::open based upon the file extension of the specified filename.8.32.13 Setgzbool Setgz ( bool gz )Specify that the desired contents of the output molstream should be GNU gzip compressed, and compressed onthe-fly.Usually the “gz” property of a oemolostream is determined implicitly from the file extension used toopen the stream for writing. The current “gz” property of a oemolostream can be retrieved using the Getgz


90 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsmethod.8.32.14 SetStringvoid SetString ( const char ∗c )void SetString ( const unsigned char ∗c , unsigned int size )The oemolostream::SetString methods allow an output molstream to be opened for writing to a bufferand specify the initial contents of the buffer. The contents of in-memory buffer when writing to a string may beobtained using the GetString method.8.33 oemolstreambaseclass oemolstreambaseThe <strong>OEChem</strong>::oemolstreambase is the abstract base class parent of the oemolistream andoemolostream classes.8.34 OEQAtomBaseclass OEQAtomBase : public OEAtomBase , public OEQBaseThe OEQAtomBase class is the abstract interface for representing atoms and atom expressions within <strong>OEChem</strong>.For a description of query expressions and their utility in graph matching refer to (Section 8.3). OEQAtomBasesare created by calling the OEQMolBase::NewAtom method. Please refer to the OEAtomBase (Section 8.3) andOEQBase sections for descriptions of the methods inherited by OEQAtomBase.8.34.1 GetQAtomsvirtual OESystem : : OEIterBase ∗GetQAtoms ( )virtual OESystem : : OEIterBase ∗GetQAtoms (const OESystem : : OEUnaryPredicate &predicate )Return an OEQAtomBase iterator of the neighboring atoms of the requested atom instance. The returned iteratortraverses only the explicit atoms that are bonded to the OEQAtomBase. The number of neighbors in the iterator isidentical to OEQAtomBase::GetExplicitDegree. The method which takes an atom predicate as an argument willreturn an iterator over the connected atoms which match the predicate.8.34.2 GetQBondsvirtual OESystem : : OEIterBase ∗GetQBonds ( )virtual OESystem : : OEIterBase ∗GetQBonds (const OESystem : : OEUnaryPredicate &predicate )Return an OEQBondBase iterator of the bonds connected to the requested atom instance. The returned iteratortraverses only the explicit bonds that are attached to the OEAtomBase. The number of bonds in the iterator is


8.35. OEQBase 91identical to OEAtomBase::GetExplicitDegree. The method which takes a bond predicate as an argument willreturn an iterator over the connected bonds which match the predicate.8.35 OEQBaseclass OEQBaseOEQBase is the abstract class which defines the <strong>API</strong> for storage and retrieval of expressions used in graph matchingoperations.8.35.1 SetExprvirtual bool SetExpr ( OEExprBase ∗expr )This pure virtual method defines the interface for storage of an expression. The parent class instance takes ownershipof the memory associated with the expression pointer. Any existing expressions stored in the parent instancewill be destroyed. Stored expressions are destroyed along with their parent OEQBase instance.8.35.2 GetExprvirtual OEExprBase ∗GetExpr ( )constThis pure virtual method defines the interface for retrieving a stored expressions from a OEQBase parent classinstance. If no expression was stored previously a zero-value pointer may be returned. The pointer returned fromthis method should therefore be checked before use.8.36 OEQBondBaseclass OEQBondBase : public OEBondBase , public OEQBaseThe OEQBondBase class is the abstract interface for representing bonds and bond matching expressions within<strong>OEChem</strong>. For a description of query expressions and their utility in graph matching refer to (Section 8.3). OE-QBondBases are created by calling the OEQMolBase::NewBond method. Please refer to the OEBondBase (Section8.4) and OEQBase sections for descriptions of the methods inherited by OEQBondBase.8.37 OEQMolclass OEQMol


92 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEMol is a specific implementation of query molecules. The OEQMol class has the following specific methods,plus it implements the entire OEQMolBase (Section 8.30) <strong>API</strong>.8.37.1 ConstructorsAll query molecule constructors provide the ability to specify the implementation type through the unsigned integer”type” argument. The default implementation type is provided as a default argument when not explicitly specified.If additional query molecule implementations exist they will be listed in the OEQMolType namespace. Copy constructorswhich take a non-query molecule type as an argument do not, by default, build atom and bond expressionsused in graph matching. The OEQMolBase::BuildExpressions (Section 8.38.3) method should be called to buildquery expressions after copy constructing a molecule using something other than a query molecule.explicit OEQMol ( unsigned int type = OEQMolType : : OEDefault )Default constructor.OEQMol ( const OEQMol &mol , unsigned int type = OEQMolType : : OEDefault )Copy construct a query molecule. Atom and bond expressions will be copied from the source molecule.OEQMol ( const OEGraphMol &mol , unsigned int type = OEQMolType : : OEDefault )Construct a query molecule from a base molecule.OEQMol ( const OEMol &mol , unsigned int type = OEQMolType : : OEDefault )Construct a query molecule from a multi-conformer molecule.OEQMol ( const OEMolBase &mol , unsigned int type = OEQMolType : : OEDefault )Construct a query molecule from a base molecule.OEQMol ( const OEQMolBase &, unsigned int type = OEQMolType : : OEDefault )Copy construct a query molecule. Atom and bond expressions will be copied from the source molecule.OEQMol ( const OEMCMolBase &, unsigned int type = OEQMolType : : OEDefault )Construct a query molecule from a multi-conformer molecule.8.37.2 operator +=OEQMol &operator+=(OEQMol &lhs , const OEQMol &rhs )OEQMol &operator+=(OEQMol &lhs , const OEQMolBase &rhs )These methods concatenate a query molecule given on the right hand side of the operator onto the end of the querymolecule on the left hand side of the operator.8.37.3 operator OEMolBaseoperator OEMolBase& ( )const


8.38. OEQMolBase 93This method returns the query molecule as an OEMolBase reference.8.37.4 operator OEQMolBaseoperator OEQMolBase& ( )constThis method returns a query molecule instance as an OEQMolBase reference.8.37.5 SCMolOEMolBase& SCMol ( )constThis method returns a query molecule instance as an OEMolBase instance. When passing an OEQMol to a functionwhich is overloaded to take either an OEMolBase or OEQMolBase instance it is necessary to explicitly specifywhich overloaded method is desired. This method is equivalent to the cast operator OEQMol::operator OEMol-Base&.8.37.6 QMolOEQMolBase& QMol ( )constThis method returns a query molecule instance as an OEQMolBase instance. When passing an OEQMol to afunction which is overloaded to take either an OEMolBase or OEQMolBase instance it is necessary to explicitlyspecify which overloaded method is desired. This method is equivalent to the cast operator OEQMol::operatorOEQMolBase&.8.38 OEQMolBaseclass OEQMolBase : public OEMolBaseOEQMolBase is an abstract class that extends OEMolBase and provides facilities useful in graph matching. Querymolecules are used in matching operations such as substructure search, clique detection, and maximum commonsubstructure search. Query expressions (Section 8.12) stored in query atoms and query bonds are used to representthe boolean logic used in graph matching operations. Query molecules conveniently collect query atoms and querybonds into a molecule suitable for use as a query graph in matching operations. As a derived type of OEMolBase,query molecules are valid arguments for functions which take a base molecule class as an argument.8.38.1 operator=OEQMolBase &operator= ( const OEMolBase &m )OEQMolBase &operator= ( const OEQMolBase &m )Assignment operator. Copies the information contained in the molecule on the right hand side of the operator intothe query molecule instance.8.38.2 operator +=


94 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEQMolBase &operator+=(OEQMolBase &lhs , const OEQMolBase &rhs )This method concatenates a query molecule given on the right hand side of the operator onto the end of the querymolecule on the left hand side of the operator.8.38.3 BuildExpressionsvirtual bool BuildExpressions ( unsigned int atomopts , unsigned int bondopts )This method builds query expressions for the atoms and bonds contained in a query molecule instance. Anypre-existing query expressions are destroyed by this method. The bits in the unsigned integers passed to themethod define how query expressions will be built based on the attributes of each atom and bond instance. Thebitwise options are stored in the OEExprOpts namespace. Please refer to (Section 13.4) for a complete explanationof the query options. This method provides the ability to convert attributes of base atoms and bonds to queryexpressions that are consistent with the semantics desired for a graph match procedure. Each requested expressionis constructed, using data from the parent atom or bond if necessary. During a graph match procedure, the resultingexpression composition will be used to evaluate atom and bond graph component equivalences.It is important to note that BuildExpressions uses the data present in a query molecule only when it is called.Subsequent modifications to atom and bond data to not cause the expressions to be updated to reflect changes. Anadditional call to BuildExpressions must be made to synchronize expressions with atom and bond data.8.38.4 GetQAtomsvirtual OESystem : : OEIterBase ∗GetQAtoms ( )Return an iterator over all the query atoms of a molecule. By default, this returns all the atoms of the moleculein the order they were created. The ordering of the atoms returned by GetQAtoms may be modified byOEMolBase::OrderAtoms.virtual OESystem : : OEIterBase ∗GetQAtoms (const OESystem : : OEUnaryPredicate &predicate )Return an iterator over all of the query atoms of a molecule that match the specified atom predicate.8.38.5 GetQBondsvirtual OESystem : : OEIterBase ∗GetQBonds ( )Return an iterator over all the query bonds of a molecule. By default, this returns all the bonds of the moleculein the order they were created. The ordering of the bonds returned by GetBonds may be modified by OEMol-Base::OrderBonds.virtual OESystem : : OEIterBase ∗GetQBonds (const OESystem : : OEUnaryPredicate &predicate )Return an iterator over all of the query bonds of a molecule that match the specified atom predicate.8.39 OEQuaternionOEQuaternion : public OETransBase


8.40. OERotMatrix 95This object is one of the molecular transformation base classes which derive from OETransBase and work withOETrans.OEQuaternion ( double angle , double ∗vec )OEQuaternion ( float angle , float ∗vec )OEQuaternion ( double ∗quat )OEQuaternion ( float ∗quat )OEQuaternion &operator=(const double ∗quat )OEQuaternion &operator=(const float ∗quat )void GetQuaternion ( double ∗quat ) constvoid GetQuaternion ( float ∗quat ) constOETransBase ∗CreateCopy ( )constThis OETransBase object represents a quaternion rotation transformation. This quaternion object does notinclude a translation, thus the vec arrays are assumed to be of length three and the quat arrays of length four.8.40 OERotMatrixOERotMatrix : public OETransBaseThis object is one of the molecular transformation base classes which derive from OETransBase and work withOETrans.OERotMatrix ( const double ∗mat )OERotMatrix ( const float ∗mat )//copy ctor, op=//OERotMatrix is POD!OERotMatrix &operator= ( const double ∗mat )OERotMatrix &operator= ( const float ∗mat )//data accessvoid GetRotMatrix ( double ∗mat ) constvoid GetRotMatrix ( float ∗mat ) constOETransBase ∗CreateCopy ( )constThis OETransBase object allows high level rotation of molecules with a rotation matrix. The mat array in theconstructors is assumed to be of length nine.8.41 OEResidueclass OEResidueThe OEResidue class in <strong>OEChem</strong> is used to attach biopolymer information to each OEAtomBase. This classcontains a number of fields specific to processing macromolecules, such as proteins and nucleic acids. Each atommay be annotated with a unique OEResidue, hence OEResidue instances are not shared between different atoms.If the fields of an OEResidue associated with a single atom are updated, only that atom is affected.8.41.1 operator =


96 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsOEResidue& operator = ( const OEResidue &res )The assignment operator may be used to copy all of the fields of an OEResidue.8.41.2 operator booloperator bool ( )constDetermine whether any field of an OEResidue has a non-default value.8.41.3 GetAlternateLocationchar GetAlternateLocation ( )constReturn the alternate location character property of an atom in a residue. The “alternate location” property may beset using the OEResidue::SetAlternateLocation method.8.41.4 GetBFactorfloat GetBFactor ( )constReturn the crystallographic B-factor property of an atom in a residue. The “b-factor” property may be set usingthe OEResidue::SetBFactor method.8.41.5 GetChainIDchar GetChainID ( )constReturn the chain identifier character property of a residue. The “chain identifier” property may be set using theOEResidue::SetChainID method.8.41.6 GetFragmentNumberint GetFragmentNumber ( )constReturn the fragment number property of a residue. Fragment numbers are integer indices that define connectedcomponents of a macromolecule. When reading from a PDB file, the first atom is placed in fragment number1. Each time a “TER”, “END” or “ENDM” record is encountered within a single connection table, the fragmentnumber is incremented. Similarly, when writing a PDB file, a TER record is written between any consecutivepair of atoms with different fragment numbers. The fragment number property may be set using theOEResidue::SetFragment number property.8.41.7 GetInsertCodechar GetInsertCode ( )const


8.41. OEResidue 97Return the insertion code character of a residue. Insertion codes are single character suffixes used to distinguishinsertions when using a standardized residue numbering system. By default, this property contains a single spacecharacter, ’ ’. The insertion code property of a residue may be set using the OEResidue::SetInsertCode method.8.41.8 GetModelNumberint GetModelNumber ( )constReturn the model number property of a residue. For NMR or molecular dynamics files, the model number containsthe index of the NMR model or dynamics time-step within a file. The “model number” property may be set usingthe OEResidue::SetModelNumber method.8.41.9 GetNameconst char ∗GetName ( )constReturn the residue name property of a residue.OEResidue::SetName method.The “residue name” property may be set using the8.41.10 GetOccupancyfloat GetOccupancy ( )constReturn the crystallographic “occupancy” floating point property of an atom in a residue. The default value is 1.0.The “occupancy” property may be set using the OEResidue::SetOccupancy method.8.41.11 GetResidueNumberint GetResidueNumber ( )constReturn the residue number property of a residue.OEResidue::SetResidueNumber method.The “residue number” property may be set using the8.41.12 GetSecondaryStructureint GetSecondaryStructure ( )constReturn the protein secondary structure class property of a residue. The default value is zero. The secondarystructure property of a residue may be set using the OEResidue::SetSecondaryStructure method.8.41.13 GetSerialNumberint GetSerialNumber ( )constReturn the atom serial number property of an atom in a residue. The “atom serial number” property may be setusing the OEResidue::SetSerialNumber method.8.41.14 IsHetAtom


98 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsbool IsHetAtom ( )constReturn the boolean “hetero atom” property of an atom in a residue. The “hetero atom” property may be set usingthe OEResidue::SetHetAtom method.8.41.15 SetAlternateLocationbool SetAlternateLocation ( char alt )Set the alternate location character property of an atom in a residue. The default value is a space character. Thealternate location property of an atom in a residue may be retrieved using the OEResidue::GetAlternateLocationmethod.8.41.16 SetBFactorbool SetBFactor ( float temp )Set the crystallographic B-factor property of an atom in a residue. The default value is 0.0. The b-factor propertyof an atom in a residue may be retrieved using the OEResidue::GetBFactor method.8.41.17 SetChainIDbool SetChainID ( char ch )Set the chain identifier character property of a residue. The default value is a space character. The chain identifierproperty of a residue may be retrieved using the OEResidue::GetChainID method.8.41.18 SetFragmentNumberbool SetFragmentNumber ( int frag )Set the fragment number property of a residue. Fragment numbers are integer indices that define the connectedcomponents of a macromolecule. When reading from a PDB file, the first atom is placed in fragment number1. Each time a “TER”, “END” or “ENDM” record is encountered within a single connection table, the fragmentnumber is incremented. Similarly, when writing a PDB file, a TER record is written between any consecutive pairof atoms with different fragment numbers. The default value is zero. The fragment number property of a residuemay be retrieved using the OEResidue::GetFragmentNumber method.8.41.19 SetHetAtombool SetHetAtom ( bool het )Set the boolean “hetero atom” property of an atom in a residue. The default value is false. The hetero atom propertyof an atom in a residue may be retrieved using the OEResidue::IsHetAtom method.8.41.20 SetInsertCodebool SetInsertCode ( char ins )


8.41. OEResidue 99Set the insertion code character of a residue. Insertion codes are single character suffices used to distinguishinsertions when using a standardized residue numbering system. By default, this property contains a single spacecharacter. ’ ’. The insertion code property of a residue may be retrieved using the OEResidue::GetInsertCodemethod.8.41.21 SetModelNumberbool SetModelNumber ( char model )Set the model number property of a residue. For NMR or molecular dynamics files, the model number containsthe index of the NMR model or dynamics time-step within a file. The default value is zero. The “model number”property of a residue may be retrieved using the OEResidue::GetModelNumber method.8.41.22 SetNamebool SetName ( const std : : string name )bool SetName ( const char ∗name )Set the residue name property of a residue. The default value is “MOL”. The residue name property of a residuemay be retrieved using the OEResidue::GetName method.8.41.23 SetOccupancybool SetOccupancy ( float occup )Set the crystallographic occupancy property of an atom in a residue. The default value is 1.0. The occupancyproperty of an atom in a molecule may be retrieved using the OEResidue::GetOccupancy method.8.41.24 SetResidueNumberbool SetResidueNumber ( int resno )Set the residue number property of a residue. The default value is one. The residue number property of a residuemay be retrieved using the OEResidue::GetResidueNumber method.8.41.25 SetSecondaryStructurebool SetSecondaryStructure ( int secstr )Set the protein secondary structure class property of a residue. The default value is zero. The secondary structureproperty of a residue may be retrieved using the OEResidue::GetSecondaryStructure method.8.41.26 SetSerialNumberbool SetSerialNumber ( int serno )


100 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsSet the atom serial number property of an atom in a residue. The default value is zero. The atom serial numberproperty may be retrieved using the OEResidue::GetSerialNumber method.8.42 OESubSearchclass OESubSearchThe OESubSearch class performs substructure searches, also known as subgraph isomorphism determination,on molecular graphs. In a molecular graph, atoms are considered nodes and bonds are edges. The OESubSearchclasses is capable of performing both colored and uncolored graph comparison. The ’color’ properties of a querygraph are stored as expression trees associated with atoms and bonds of a query molecule.8.42.1 ConstructorsOESubSearch ( )Default constructor.OESubSearch ( const char ∗smarts , bool reorder=true )Construct an instance of an OESubsearch object using a SMARTS pattern. The SMARTS pattern is passed asthe first argument to the constructor. The Boolean reorder flag determines the match order of the query atoms andbonds. If reorder is set to true then the atoms and bonds will be matched in an arbitrary order. If false, atoms andbonds will be matched using the input order of the SMARTS pattern.OESubSearch ( const OEQMolBase &qmol , bool reorder=true )Construct an instance of an OESubSearch object using a query molecule (OEQMolBase). The query moleculeis passed as the first argument to the constructor. Query molecules must have atom and bond expressions (seeOEQMolBase::BuildExpressions) built for the entire molecule before being passed to this constructor.Failure to do so will result in the OESubSearch instance being constructed as uninitialized. The Boolean reorderflag determines the match order of the query atoms and bonds. If reorder is set to true then the atoms and bondswill be matched in an arbitrary order. If false, atoms and bonds will be matched in the order that they appear in thequery molecule.OESubSearch ( const OESubSearch &ss )Copy constructor.8.42.2 operator =OESubSearch& operator = ( const OESubSearch &ss )Assignment operator. This method makes a copy of an existing OESubSearch instance.8.42.3 operator booloperator bool ( )const


8.42. OESubSearch 101This method is used to test for successful initialization of an OESubSearch object. If initialization was attemptedwith an invalid SMARTS pattern or query molecule then this method will return false. If initialization was completedsuccessfully this method will return true. An instance of OESubSearch is considered to be uninitializedwhen constructed with the default constructor.8.42.4 AddConstraintbool AddConstraint ( const OEMatchPair &ac )bool AddConstraint ( const OEMatchPair &bc )The search space of a subgraph isomorphism determination can be restricted by constraining pairs of nodes oredges (atoms or bonds) to be mapped onto one another in all valid subgraph solutions. Failure to satisfy atom orbond pairwise constraints will prevent any subgraph solutions from being identified by any of the match methodsin OESubSearch. Both AddConstraint methods return true if a constraint is added successfully. If the patternatom or bond in the OEMatchPair does not exist as part of the query molecule created in the initialization of theOESubSearch object then AddConstraint will return false. Multiple calls to AddConstraint using the same patternatom or bond will cause previously stored constraints to be overwritten as constraints are mutually exclusive. It isimpossible to satisfy multiple simultaneous constraints for a single pattern atom or bond, hence the exclusivity.8.42.5 AtomMatchbool AtomMatch ( const OEAtomBase ∗atm ) constbool AtomMatch ( const OEQAtomBase ∗atm ) constThe AtomMatch method is the effective combination of sequential calls to AddConstraint followed by SingleMatch.AtomMatch searches for a single valid subgraph isomorphism starting with the passed target atommapped to the first pattern atom with which the OESubSearch was initialized. The method can be called usingeither an OEAtomBase or OEQAtomBase pointer. If a valid subgraph is identified the method will return true.8.42.6 ClearConstraintsvoid ClearConstraints ( )The ClearConstraints method eliminates all prior match constraints set with the AddConstraint methods.8.42.7 GetMaxMatchesunsigned int GetMaxMatches ( )constThis method returns the maximum number of subgraph isomorphism solutions that the instance of OESubSearchwill identify before terminating the search. A value of zero indicates that no arbitrary limit has been set on thetotal number of subgraph isomorphism solutions to be identified. By default, instances of OESubSearch set themaximum number of matches to 1024.8.42.8 GetPatternconst OEQMolBase &GetPattern ( )


102 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsA read-only reference to the query molecule contained in an instance of OESubSearch can be obtained with thismethod. Const OEQMolBase methods can be used to interrogate the returned OEQMolBase reference. If theinstance of OESubSearch has not been initialized, a reference to an empty molecule will be returned.8.42.9 Initbool Init ( const char ∗smarts , bool reorder = true )This method (re)initializes an OESubSearch instance with a SMARTS pattern, which is parsed to create a querymolecule available for substructure search. The method will return true if initialization completes successfully,and false upon failure. Prior state information is cleared before initialization, and is lost even if the methodfails to initialize properly. The second argument of the method determines the traversal order used in subgraphisomorphism detection. This argument is currently not used, therefore the traversal order always reflects the atomand bond ordering of the passed SMARTS pattern.bool Init ( const OEQMolBase &qmol )This method (re)initializes an OESubSearch instance with a query molecule (OEQMolBase) reference. Themethod will return true if initialization completes successfully, and false upon failure. Prior state information iscleared before initialization, and is lost even if the method fails to initialize properly.bool Init ( const OEMolBase &mol , unsigned int , unsigned int )This method (re)initializes an OESubSearch instance using a molecule (OEMolBase) and expression optionsused to convert the molecule into a query molecule (OEQMolBase). The atom and bond expression options passedas the second and third arguments to the method are defined in the OEExprOpts namespace. Expression optionsare used to convert the atom and bond data into expression trees which are used during the substructure search tomap atoms and bonds. The method will return true if initialization completes successfully, and false upon failure.Prior state information is cleared before initialization, and is lost even if the method fails to initialize properly.8.42.10 MatchOESystem : : OEIterBase ∗Match ( const OEMolBase &mol ,bool uniq = false ) constOESystem : : OEIterBase ∗Match ( const OEQMolBase &mol ,bool uniq = false ) constThese methods perform subgraph isomorphism determination for instances of OEMolBase or OEQMolBase. Subgraphswhich are isomorphic to the graph with which an instance of OESubSearch was initialized are identified.Subgraph matches are returned as a pointer to an OESystem::OEIterBase, and shouldbe assigned to an OESystem::OEIter in order to prevent memory leaks. By default allpossible subgraphs up to and including the maximum number of matches are returned by these methods. If theboolean argument passed to the methods is true then only the unique matches will be included in the iterator overthe matches. A match or subgraph is considered unique if it differs from all other subgraphs found previously by atleast one atom or bond. Two subgraph matches which cover the same atoms and bonds, albeit in different orders,will be called duplicates and the subgraph found later in the search will be discarded.8.42.11 SingleMatchbool SingleMatch ( const OEMolBase &mol ) constbool SingleMatch ( const OEQMolBase &mol ) const


8.43. OETrans 103The SingleMatch methods return true if a single subgraph isomorphism is detected in the molecule passed as thefunction argument. If no subgraph isomorphism is detected the method will return false.8.42.12 SetMaxMatchesbool SetMaxMatches ( unsigned int max )This method sets the maximum number of subgraphs to be determined by the OESubSearch::Match methods. Oncethe maximum number of subgraphs have been found the search for additional subgraphs is terminated. By default,instances of OESubSearch are constructed with a maximum number of matches set to 1024. The constraint on themaximum number of matches can be removed by calling this method with a value of zero.8.43 OETransThis class is a contianer of high-level molecular transformations. It can be used to hold and wrap a series ofmolecular transformations, which can be applied to OEConfBase objects with a single function call. The OETranscontainer keeps its own copies of the OETransBases.8.43.1 Construction and InitializationOETrans ( )OETrans ( const OETransBase ∗)OETrans ( const OETransBase &)OETrans ( const OETrans&)void Clear ( )The OETrans container can be constructed with no OETransBase objects or can be copy constructed from andexisting OETransBase or OETrans.The Clear function resets the OETrans to the same state it was in after default construction.8.43.2 Adding Transformationsvoid PushFront ( const OETransBase &t )void PushBack ( const OETransBase &t )These functions copy a new molecular transformation into the container.8.43.3 OETransBase AccessOEIterBase ∗GetTransforms ( )Generates an iterator over the OETransBases in the container.8.43.4 Transform


104 Chapter 8. <strong>OEChem</strong> Classes and Member Functionstemplatevoid Transform ( OEConfBaseT ∗) consttemplatevoid Transform ( C ∗coords , unsigned int rows ) constThese template functions call the underlying template function in each of the OETransBase objects in theOETrans container.8.44 OETransBaseThis is the abstract base class which describes the interface for all of the high-level molecular transformationobjects. It allows generic application of many manipulations (Translation, Euler Rotation, Rotation Matrix,Quaternion) to conformers. All of the default transformation currently provided carry out rigid transformationsof molecule positions rather than conformational modifications. These are provided in the OEMath namespacedescribed below.8.44.1 CreateCopyvirtual OETransBase ∗CreateCopy ( ) const = 0This virtual constructor for generating copies of the transformations when the programmer only has access to thebase class.8.44.2 Transformtemplatevoid Transform ( OEConfBaseT ∗) consttemplatevoid Transform ( C ∗coords , unsigned int rows ) constThese are the two primary member functions for manipulation of molecular coordinates. The first template functiontakes a OEMCMolBase or OEMol’s conformer. This function will apply the transformation specified by theOETransBase object to the conformer which is passed to the function. Similarly, the secont function takes a pointerto a set of coordinates and an unsigned int which specifies the number of rows of coordinates to transform. Thisfunction presumes that coords is a pointer to an array of type C which is at least rows*dim long. Both functionsmodify the coordinates in place.Even though the first function is a template function, it can be called without any explicit template argumentsbecause the C and dim parameters are already specified by the conformer which is passed to the function. Thesecond template function does not have the dim parameter specified in the function areguments, so it must be calledwith explicit function arguments trans.Transform(coords,mol.GetMaxAtomIdx).8.44.3 Protected Transformationsvirtual void OETransform3D ( double ∗ , unsigned int rows ) const = 0virtual void OETransform3D ( float ∗ , unsigned int rows ) const = 0virtual void OETransform2D ( float ∗ , unsigned int rows ) const = 0


8.45. OETranslation 105These three pure-virtual functions are implemented by the derived classes in order to provide implementations tothe public template functions in the base class. They provide implementations for transforming three-dimensionalcoordinate data stored as floats or doubles and two-dimensional data (depictions) stored as floats.8.45 OETranslationOETranslation : public OETransBaseThis object is one of the molecular transformation base classes which derive from OETransBase and work withOETrans.OETranslation ( const double∗ vec )OETranslation ( const float∗ vec )OETranslation ( double dx , double dy , double dz )OETranslation ( float dx , float dy , float dz )//arithmetic operatorsOETranslation &operator += ( const OETranslation &rhs )//data accessvoid GetTranslation ( double ∗vec ) constvoid GetTranslation ( float ∗vec ) constOETransBase ∗CreateCopy ( )constThis OETransBase object stores a Cartesian molecular translation.8.46 OEUniMolecularRxnclass OEUniMolecularRxnThe OEUniMolecularRxn class is designed to apply a (set of) chemical transformation(s) to a molecule. Asthe name indicates, the OEUniMolecularRxn class is only designed to apply a set of chemical transformationdefined by a uni-molecular reaction. The primary purpose of the class is to provide an efficient means of applyingnormalization reactions, although there is no restriction on the types of chemical transformations that can beapplied. Reactions with which the class is initialized must only contain a single reactant for the initialization tocomplete correctly.Reactions are applied iteratively until no further reactant patterns are matched. It is possible to write a reaction thatwill cause OEUniMolecularRxn to iteratively apply a reaction until memory is exhausted. Reaction for whichthe reactant pattern matches the product molecule must therefore be avoided when using OEUniMolecularRxn.8.46.1 ConstructorsOEUniMolecularRxn ( )Default constructor.OEUniMolecularRxn ( const char ∗smirks , bool strictSmirks=true )This method is used to initialize a OEUniMolecularRxn instance with a SMIRKS pattern. Attempts to initializean OEUniMolecularRxn instance with a reaction that has more than one reactant will result in an initialization


106 Chapter 8. <strong>OEChem</strong> Classes and Member Functionsfailure. Success of initialization can be tested using the operator bool method. The second argument tothe constructor is used to specify the interpretation of the SMIRKS semantics. By default, the SMIRKS string isinterpreted using strict semantics. SMIRKS requires that reactant atoms that are mapped must appear and havecorresponding mapped atoms on the product side. In addition, unmapped reactant atoms are destroyed as part ofthe reaction. Passing a boolean value of false to the second method argument relaxes both of these restrictions. Amapped reactant atom that does not have a corresponding mapped product atom is valid, and will be destroyed aspart of the reaction. Unmapped reactant atoms will be used to match the reactant pattern, but are not destroyedwhen the reaction is applied. The resulting SMIRKS like reactions may therefore be more easily readable byhumans as fewer atoms may be required to be mapped.OEUniMolecularRxn ( const OEUniMolecularRxn &rhs )Copy constructor.8.46.2 Initbool Init ( const char ∗c , bool strictSmirks=true )This method initializes an OEUniMolecularRxn instance with a SMIRKS pattern. By default, the SMIRKSstring is interpreted using strict semantics. SMIRKS requires that reactant atoms that are mapped must appear andhave corresponding mapped atoms on the product side. In addition, unmapped reactant atoms are destroyed as partof the reaction. Passing a boolean value of false to the second method argument relaxes both of these restrictions.A mapped reactant atom that does not have a corresponding mapped product atom is valid, and will be destroyedas part of the reaction. Unmapped reactant atoms will be used to match the reactant pattern, but are not destroyedwhen the reaction is applied. The resulting SMIRKS like reactions may therefore be more easily readable byhumans as fewer atoms may be required to be mapped.bool Init ( const OEQMolBase &, bool strictSmirks=true )This method initializes an OEUniMolecularRxn instance with a query molecule. If query molecule is createdusing the OEParseSmirks function, and if the reaction is desired to be interpreted using strict SMIRKS semantics(see Init(const char*,bool strictSmirks) for explanation of strict SMIRKS) then the defaultvalue for the second argument to the method should be used. Passing a boolean value of false to the secondargument will relax the restrictions imposed by strict SMIRKS semantics.8.46.3 operator()bool operator ( ) ( OEMolBase &mol ) constThis method applies the set of transformations with which the OEUniMolcularRxn object has been initialized.The method will return true if the reactant pattern matches at least one time in the passed molecule instance. Ifthe OEUniMolecularRxn fails to apply any transformations because the reactant pattern failed to match themolecule, the method will return false.8.46.4 operator booloperator bool ( )constThis method will return true if the OEUniMolecularRxn was initialized with no failures using either the initializationconstructors or one of the OEUniMolecularRxn::Init methods. The method will return false when


8.47. OEVectorBindings 107the OEUniMolecularRxn instance has not been properly initialized as it will be unable to apply transformoperations to molecules.8.47 OEVectorBindingsclass OEVectorBindingsThe OEVectorBindings class is used to store a set of vector bindings or lexigraphic replacements that mayappear in a SMARTS pattern. A vector binding is a SMARTS pattern bound to a name. For example, the name”[$HALO]” can be used to represent the pattern ”[$(F,Cl,Br,I)] in order to make a pattern more human readable.The OEVectorBindings class converts SMARTS patterns written using vector bindings (human readable form) tothe corresponding machine readable form by performing a name to pattern replacement.8.47.1 ConstructorsOEVectorBindings ( )Default constructorOEVectorBindings ( const OEVectorBindings&)Copy constructor8.47.2 operator=OEVectorBindings &operator=(const OEVectorBindings &rhs )Assignment operator. Copies a set of vector bindings from the right hand side of the assignment, to the OEVectorBindingsinstance on the left hand side of the assignment.8.47.3 Addbool Add ( const char ∗label , const char ∗pattern )This method addes one vector binding to an OEVectorBindings instance. The ”label” given as the first methodargument is the name that appears in the human readable version of a SMARTS, while the ”pattern” given as thesecond method argument is the SMARTS that should be used to replace the ”label”. If the pattern is parsedcorrectly and the association is made in the OEVectorBindings instance, the method will return boolean true.If the SMARTS pattern is invalid or the association cannot be made the method will return boolean false. Allattempts to associate a SMARTS pattern with a particular ”label” after the first association succeeds will resultsubsequent failures to create new assocations.8.47.4 Getbool Get ( const OEExprBase ∗&expr ,const char ∗&label ,const char ∗smarts ) const


108 Chapter 8. <strong>OEChem</strong> Classes and Member FunctionsThis method retrieves the ”label” and corresponding OEExprBase pointer reference as the first and secondmethod arguments, respectively, given a pointer to a position within a SMARTS string given as the final argument.If the SMARTS string position points to the beginning of a vector bound ”label” contained in theOEVectorBindings instance then the method will return boolean true. If the vector binding cannot be identifiedthen the method will return boolean false.


CHAPTERNINE<strong>OEChem</strong> Functions9.1 OE3DToAtomStereobool OE3DToAtomStereo ( OEMolBase &mol )Set the stereochemistry at the chiral atoms of a molecule, as specified by the molecule’s 3D coordinates. Theaffected atoms are those with a “chiral” atom property of true, as discovered by a call to OEPerceiveChiral,or set manually by the user calling the OEAtomBase::SetChiral method. If no chirality has been perceivedon the molecule, OEPerceiveChiral will be called inside this function.9.2 OE3DToBondStereobool OE3DToBondStereo ( OEMolBase &mol )Set the stereochemistry at the chiral bonds of a molecule, as specified by the molecule’s 3D (or possibly 2D)coordinates. The affected bonds are those with a “chiral” bond property of true, as discovered by a call toOEPerceiveChiral, or set manually by the user calling OEBondBase::SetChiral method. If no chiralityhas been perceived or set on the molecule, OEPerceiveChiral will be called inside this function.9.3 OE3DToInternalStereobool OE3DToInternalStereo ( OEMolBase &mol )Assigns the stereochemistry of molecule from its 3D coordinates. It perceives both the tetrahedral chiralityaround atomic centers, and the EZ chirality around double bonds. This function is equivalentto the sequence OEPerceiveChiral(mol) followed by both OE3DToAtomStereo(mol) andOE3DToBondStereo(mol).9.4 OEAddExplicitHydrogens109


110 Chapter 9. <strong>OEChem</strong> Functionsvoid OEAddExplicitHydrogens ( OEMol &mol ,bool polarOnly=false , bool set3D=true )void OEAddExplicitHydrogens ( OEMCMolBase &mol ,bool polarOnly=false , bool set3D=true )void OEAddExplicitHydrogens ( OEMolBase &mol ,bool polarOnly=false , bool set3D=true )Convert the implicit hydrogens on the atoms of a molecule to explicit hydrogen atoms. Zero or more new atomsare created with atomic number OEElemNo::H, and new bonds are created to connect these to the parent atomwith a single bond. This function also resets the implicit hydrogen count to zero. If the “polar only” argument istrue, this function does nothing if the atom is not polar, i.e. when OEAtomBase::IsPolar returns false.The sprouted hydrogens are initially given the same co-ordinates as their parent atom. However, if the“set3D” parameter is true, the default, and the given molecule has three dimensional co-ordinates (i.e.OEMolBase::GetDimension returns a value of three or more), this routine automatically calls theOESet3DHydrogenGeom function.bool OEAddExplicitHydrogens ( OEMolBase &mol , OEAtomBase ∗atm ) ;The form of the OEAddExplicitHydrogens function operates only on the specified OEAtomBase.This function creates a new OEAtomBase for every implicit hydrogen on “atm”, as given byatm->GetImplicitHCount(). The new hydrogen atoms are given the same co-ordinates as their parent,“atm”. This function currently always returns true. To set the 3D geometry of these atoms, call theOESet3DHydrogenGeom function.9.5 OEAddMolsbool OEAddMols ( OEMolBase &lhs , const OEMolBase &rhs ,OEAtomBase ∗∗aa = 0 , OEBondBase ∗bb = 0)bool OEAddMols ( OEMolBase &lhs , const OEMolBase &rhs ,const char ∗titleDelimiter ,OEAtomBase ∗∗aa = 0 , OEBondBase ∗bb = 0)OEAddMols is a function used to add the data from the rhs molecule to the lhs molecule. For historical reasons,there are two <strong>API</strong> points, the function call without a titleDelimiter argument uses ” ” as the title delimiter. Thefunction with a titleDelemiter concatenated the title of the rhs molecule onto the lhs molecules using the delimiterpassed. The empty string (eg ””) is a valid argument, and causes a direct concatenation of the two titles. If (char*)0 is passed as the arguement, no concatenation of titles occurs.In both functions, there are two arguments with defaults of 0. These arguments can be used to obtain mappings betweenthe atoms and bonds in the original rhs molecule and the newly created atoms and bonds in the lhs molecule.It is assumed that arguments passed to aa are arrays of atom pointers of at least rhs.GetMaxAtomIdx() in sizeand that arguments passed to bb are arrays of bond pointers of at leasts rhs.GetMaxBondIdx() in size. Afterthe function has been called, for any atom rhsAtom from the rhs molecule, the corresponding new atom in the lhsmolecule can be obtained by an atom index lookup into the array.OEAtomBase ∗rhsAtom , ∗lhsAtom ;lhsAtom = atomMap [ rhsAtom−>GetIdx ( ) ] ;where atomMap was passed as the aa argument to the OEAddMols function. Bond maps work in a similar manner.9.6 OEAssignAromaticFlags


9.7. OEAssignBondiVdWRadii 111void OEAssignAromaticFlags ( OEMolBase &mol ,const OEAroModel model = OEAroModelOpenEye ,bool clearflags = true ,unsigned int maxpath = 0 ,bool prune = false )Determine the aromatic atoms and bonds of a molecule. The aromaticity model to be used is specified by the“model” parameter, which defaults to the OpenEye model of aromaticity. Other predefined aromaticity modelsprovided by <strong>OEChem</strong> include OEAroModelDaylight, OEAroModelTripos, OEAroModelMMFF and OEAroModelMDLthat represent the Daylight, Tripos, MMFF and MDL definitions respectively. The “clearflags” parameteris used to specify whether this call needs to clear the aromaticity flags first, using OEClearAromaticFlags. Newlycreated molecules that have not had their aromaticity assigned yet can specify false, for a very small performanceadvantage.The “maxpath” parameter allows the user to specify the maximum path length to consider an aromatic cycle, orzero (the default) to specify no upper bound on aromatic cycle length. Some formal models of aromaticity use thevalue six, limiting aromaticity to six membered rings like benzene or pyridine.The “prune” parameter is used to specify whether or not to run a post-processing step to consider rings withexo-double bonds as not aromatic. This is also required by some formal models of aromaticity.9.7 OEAssignBondiVdWRadiivoid OEAssignBondiVdWRadii ( OEMolBase &mol )Assigns radii to all in atom in the given OEMolBase using calls to OEGetBondiVdwRadius.9.8 OEAssignCovalentRadiivoid OEAssignCovalentRadii ( OEMolBase &mol )Assigns radii to all in atom in the given OEMolBase using calls to OEGetCovalentRadius.9.9 OEAssignDelphiRadiivoid OEAssignDelphiRadii ( OEMolBase &mol )Assigns radii to all in atom in the given OEMolBase using calls to OEGetDelphiRadius.9.10 OEAssignFormalChargesvoid OEAssignFormalCharges ( OEMolBase &mol )void OEAssignFormalCharges ( OEAtomBase ∗atm )Set the formal charge property of each atom in the molecule, based upon a simplistic valence model. This functionassumes that the bond orders and implicit hydrogen counts have been set on a molecule. For example, this function


112 Chapter 9. <strong>OEChem</strong> Functionswill place a single positive charge on a neutral four-valent nitrogen. Note that this function only modifies neturalatoms, with zero formal charge. This preserves any formal charges previously assigned, but requires the charge tobe reset to zero in order to force a reassignment.9.11 OEAssignHybridizationbool OEAssignHybridization ( OEMolBase &mol )Predict the electronic hybridization/geometry of each atom from simple connectivity. This function updatesthe hybridization property of each atom in the molecule. See the OEAtomBase::GetHybridization andOEAtomBase::SetHybridization methods.9.12 OEAssignImplicitHydrogensvoid OEAssignImplicitHydrogens ( OEMolBase &mol )void OEAssignImplicitHydrogens ( OEAtomBase ∗atm )Set the implicit hydrogen count property of each atom in the molecule, based upon a simplistic valencemodel. This function assumes that the formal charges may be incorrect or haven’t been assigned yet.This function should be followed with a call to the function OEAssignFormalCharges. This functioncalls the OEAtomBase::SetImplicitHCount method on each atom with the value returned byOEDefaultImplicitHCount. If the charge state is correctly set on each atom, you should call theOEAssignMDLHydrogens function instead.9.13 OEAssignMDLHydrogensvoid OEAssignMDLHydrogens ( OEMolBase &mol )void OEAssignMDLHydrogens ( OEAtomBase ∗atm )Set the implicit hydrogen count property of each atom in the molecule, based upon the MDL valencemodel. This function assumes the that the formal charges are correctly set. This functioncalls the OEAtomBase::SetImplicitHCount method on each atom with the value returned byOEDefaultMDLHCount. If the charge state of each atom has not been assigned, you should call theOEAssignImplicitHydrogens and OEAssignFormalCharges functions instead.9.14 OEAssignPaulingVdWRadiivoid OEAssignPaulingVdWRadii ( OEMolBase &mol )Assigns radii to all in atom in the given OEMolBase using calls to OEGetPaulingVdWRadius.9.15 OEAssignResidueNumbers


9.16. OEAssignSerialNumbers 113void OEAssignResidueNumbers ( OEMolBase &mol )This function assigns sequential residue numbers to the residues of a molecule, as currently ordered in the OEMol-Base. The residue number is stored in the OEResidue property associated with each OEAtomBase.9.16 OEAssignSerialNumbersvoid OEAssignSerialNumbers ( OEMolBase &mol )The function assigns sequential atom serial numbers to the atoms of a molecule, as currently ordered in the OE-MolBase. The atom serial number is stored in the OEResidue property associated with each OEAtomBase.9.17 OEAssignZap9Radiivoid OEAssignZap9Radii ( OEMolBase &mol )Implements the atomic radii used in Nicholls et al., JMC 51(4):769-779 2008. Assigns radii to all atoms in thegiven OEMolBase. These radii include minor atom-typing for oxygen and nitrogen and are not a simple atomicnumber mapping. These radii are suitable for use in calculating transfer energies when used with a surface-areacoefficient of 6.3cal per square Angstrom.9.18 OEAtomGetMDLParityunsigned int OEAtomGetMDLParity ( const OEAtomBase ∗atm )This function is used to retrieve the “MDL Parity” value associated with an atom. The interpretation ofthis unsigned integer is described in the MDL file format documentation, and will appear in the appropriateatom parity column of the atom connection tables in MDL file formats. This value may be set using theOEAtomSetMDLParity function.9.19 OEAtomGetResidueconst OEResidue& OEAtomGetResidue ( const OEAtomBase ∗atom )This function is used to retrieve the OEResidue associated with an OEAtomBase. The OEResidue class isused to store information used in biopolymer processing, e.g. proteins and nucleic acids, on a per-atom basis. Theresidue properties of an atom may be set using the OEAtomSetResidue function.9.20 OEAtomGetSmallestRingSizeunsigned int OEAtomGetSmallestRingSize ( const OEAtomBase ∗atm )


114 Chapter 9. <strong>OEChem</strong> FunctionsDetermine the size of the smallest ring that an atom is in. The function OEFindRingAtomsAndBonds shouldhave been called before calling this function. If the atom is not in a ring, i.e. OEAtomBase::IsInRing returnsfalse, the value zero is returned.9.21 OEAtomIsInAromaticRingSizebool OEAtomIsInAromaticRingSize ( const OEAtomBase ∗atm , unsigned int size )Determine whether the given atom is in an aromatic cycle of the specified size. The functionOEFindRingAtomsAndBonds should have been called before calling this function. If the atom is not aromatic,i.e. OEAtomBase::IsAromatic returns false, then this function also returns false.9.22 OEAtomIsInRingSizebool OEAtomIsInRingSize ( const OEAtomBase ∗atm , unsigned int size )Determine whether the given atom is in a cycle of the specified size. The functionOEFindRingAtomsAndBonds should have been called before calling this function. If the atom is notin a ring, i.e. OEAtomBase::IsInRing returns false, then this function also returns false. This functionreturns false for all values of size less than three.9.23 OEAtomSetMDLParitybool OEAtomSetMDLParity ( OEAtomBase ∗atm , unsigned int parity )This function may be used to set the “MDL parity” value associated with an atom. The interpretation of thisunsigned integer is described in the MDL file format documentation, and will appear in the appropriate atomparity column of the atom connection tables in MDL file formats. This value may be retrieved using theOEAtomGetMDLParity function.Typically, these values is either read from MDL connection tables or set by <strong>OEChem</strong> via theOEMDLPerceiveParity and OEMDLClearParity functions.9.24 OEAtomSetResiduebool OEAtomSetResidue ( OEAtomBase ∗atom , OEResidue &res )This function is used to set the OEResidue associated with an OEAtomBase. The OEResidue class is used tostore information used in biopolymer processing, e.g. proteins and nucleic acids, on a per-atom basis. The residueproperties of an atom may be retrieved using the OEAtomGetResidue function.9.25 OEBondGetSmallestRingSize


9.26. OEBondIsInAromaticRingSize 115unsigned int OEBondGetSmallestRingSize ( const OEBondBase ∗bnd )Determine the size of the smallest ring that a bond is in. The function OEFindRingAtomsAndBonds shouldhave been called before calling this function. If the bond is not in a ring, i.e. OEBondBase::IsInRing returnsfalse, the value zero is returned.9.26 OEBondIsInAromaticRingSizebool OEBondIsInAromaticRingSize ( const OEBondBase ∗bnd , unsigned int size )Determine whether the given bond is in an aromatic cycle of the specified size. The functionOEFindRingAtomsAndBonds should have been called before calling this function. If the bond is not aromatic,i.e. OEBondBase::IsAromatic returns false, then this function also returns false.9.27 OEBondIsInRingSizebool OEBondIsInRingSize ( const OEBondBase ∗atm , unsigned int size )Determine whether the given bond is in a cycle of the specified size. The functionOEFindRingAtomsAndBonds should have been called before calling this function. If the bond is notin a ring, i.e. OEBondBase::IsInRing returns false, then this function also returns false. This functionreturns false for all values for size less than three.9.28 OECalcCartesianCoordvoid OECalcCartesianCoord ( float ∗a , float ∗b , float ∗c , float ∗z ,float ∗x )Given the Cartesian co-ordinates of the three reference atoms, in the arrays a, b and c, convert the internal coordinatespecified by z, to a Cartesian coordinate in the buffer pointed to by x.9.29 OECalcInternalCoordvoid OECalcInternalCoord ( float ∗a , float ∗b , float ∗c , float ∗x ,float ∗z )Given the Cartesian co-ordinates of the three reference atoms, in the arrays a, b and c, convert the Cartesiancoordinate specified by x, to an internal coordinate in the buffer pointed to by z.9.30 OECalculateMolecularWeightdouble OECalculateMolecularWeight ( const OEMolBase &mol , bool iso = false )


116 Chapter 9. <strong>OEChem</strong> FunctionsThis function calculates the molecular weight of the given molecule. By default, all atoms are assumed theiraverage atomic weight, as returned by the OEGetAverageWeight function. If the ‘iso’ parameter is true, andatom of the molecule that has a specified (non-zero) isotopic mass, as returned by OEAtomBase::GetIsotope,instead uses the isotopic weight as returned by the OEGetIsotopicWeight function.9.31 OECanonicalOrderAtomsvoid OECanonicalOrderAtoms ( OEMolBase &mol )Reorder the atoms of the molecule into canonical order. This function uses the OEMolBase::OrderAtomsmethod to change the order in which the iterator returned by OEMolBase::GetAtoms traverses the atoms of amolecule. This function does not affect the atom indices. See also the OEPDBOrderAtoms function.9.32 OECanonicalOrderBondsvoid OECanonicalOrderBonds ( OEMolBase &mol )Reorder the bonds of a molecule canonically with respect to the current atom order. This functionuses the OEMolBase::OrderBonds method to change the order in which the iterator returned byOEMolBase::GetBonds and OEAtomBase::GetBonds traverses the bonds of a molecule. This functiondoes not affect the bond indices.9.33 <strong>OEChem</strong>GetPlatformconst char ∗<strong>OEChem</strong>GetPlatform ( )Return the internal build string used by OpenEye Scientific Software to identify a platform. The format of thesestrings may change over time, and future distributions may contain different values even when using the sameoperating system, compiler and processor. For example, on a x86 64 Red Hat Enterprise Linux box this wouldreturn “redhat-RHEL5-g++4.1-x64”.9.34 <strong>OEChem</strong>GetReleaseconst char ∗<strong>OEChem</strong>GetRelease ( )Return the release name of the <strong>OEChem</strong> library being used. This returns a value similar to “1.0” for productionversions of the library, and “1.0 debug” for the checking version of the library.See also: <strong>OEChem</strong>GetVersion(9.35).9.35 <strong>OEChem</strong>GetVersionunsigned int <strong>OEChem</strong>GetVersion ( )


9.36. <strong>OEChem</strong>IsLicensed 117Return the version number of the library being used. This is an unsigned integer value indicating the date on whichthe library was built, for example 20020903, for the 3rd of September 2002. This value should be used whenreporting problems, and unlike the release string, may be used in comparisons if needed.9.36 <strong>OEChem</strong>IsLicensedbool <strong>OEChem</strong>IsLicensed ( const char ∗feature=0 , unsigned int ∗expdate = 0)Determine whether a valid license file is present. This function may be called without a legitimate run-time licenseto determine whether it is safe to call any <strong>OEChem</strong>, OESystem or OEPlatform functionality.The “features” argument can be used to check for a valid license to <strong>OEChem</strong> along with that feature. For example,to verify that <strong>OEChem</strong> can be used from Python:if ( ! <strong>OEChem</strong>IsLicensed ( "python" ) )OEThrow . Warning ( "<strong>OEChem</strong> is not licensed for the python feature" ) ;The second argument can be used to get the expiration date of the license. This is an array of size three with thedate returned as {day, month, year}. Even if the function returns false due to an expired license, the expdatewill show that expiration date. A value of a zeroes implies that no license or date was found.unsigned int expdate [ 3 ] ;if ( <strong>OEChem</strong>IsLicensed ( 0 , expdate ) ){OEThrow . Info ( "License expires: day: %d month: %d year: %d" ,expdate [ 0 ] , expdate [ 1 ] , expdate [ 2 ] ) ;}9.37 OECentervoid OECenter ( OEMolBase &mol , double ∗t = 0)void OECenter ( OEConfBaseT &conf , double ∗t = 0)void OECenter ( OEMCMolBaseT &mcmol , double ∗t = 0)The OECenter function moves the molecule so that its center of mass is located at the Cartesian position origin.An optional array t can be passed in, which will be filled with the vector which describes the translation to movethe molecule back to its original position. For the OEMolBase and OEConfBaseT overloads, the t array, if present,is assumed to be at least of length three. For the OEMCMolBaseT overload, the t array is assumed to be at least oflength OEMCMolBaseT::GetMaxConfIdx()*3. In this case, the vector to move and conformer back to itsoriginal position would be located at t[OEConfBaseT::GetIdx()*3].9.38 OEClearAromaticFlagsOEClearAromaticFlags ( OEMolBase &mol )This function clears the aromatic property of all atoms and bonds in the molecule. This function effectivelyKekulizes the molecule, if a Kekulé form has already been perceived by the OEKekulize function. Note this


118 Chapter 9. <strong>OEChem</strong> Functionsfunction does not affect the integer types or the type names of the atom or bond of the molecule.9.39 OEClearPartialChargesvoid OEClearPartialCharges ( OEMolBase &mol )This function clears the partial charge property of all atoms in a molecule, setting the partial charge on each atomof a molecule to 0.0.9.40 OECreateAbsSmiStringvoid OECreateAbsSmiString ( std : : string &str , const OEMolBase &mol )Create a SMILES string representing a given molecule, without isotopic labelling or stereochemistry, andin arbitrary output order (i.e. not necessarily canonical). This function is just a special case of theOECreateSmiString function.This function doesn’t correspond to any of the forms (flavors) of SMILES string produced by Daylight ChemicalInformation Systems, c.f. the OECreateCanSmiString and OECreateIsoSmiString functions. Notethat confusingly OpenEye and Daylight use conflicting definitions of the terms “absolute” and “unique”.9.41 OECreateCanSmiStringvoid OECreateCanSmiString ( std : : string &str , const OEMolBase &mol )Create a “canonical” SMILES string representing a given molecule, but without isotopic labeling or stereochemistry.This function is just a special case of the OECreateSmiString function, called with the flavorsOESMILESFlag::Canonical, OESMILESFlag::AtomMaps and OESMILESFlag::RGroups.This function produces what Daylight Chemical Information Systems term a “Unique” SMILES, c.f. theOECreateCanSmiString and OECreateAbsSmiString functions. Note that confusingly OpenEye andDaylight use conflicting definitions of the terms “absolute” and “unique”.Note that the canonical SMILES generated by this function remains dependent on the state of the molecule, esp. itsaromaticity state. Thus, to generate a canonical smiles suitable for purposes such as a database key, the programmermust assure that the state of the molecule has been standardized. In particular, aromaticity should be perceivedaccording to the preferred model. The SMILES canonicalization flag OESMILESFlag::Canonical refersspecifically to canonical ordering of atoms. In contrast, the high-level output function OEWriteMolecule,when writing the canonical SMILES format (OEFormat::CAN) does invoke OEFindRingAtomsAndBondsOEAssignAromaticFlags.9.42 OECreateIsoSmiStringvoid OECreateIsoSmiString ( std : : string &str , const OEMolBase &mol )


9.43. OECreateSlnString 119Create an “isomeric” SMILES string representing a given molecule. This function is just a specialcase of the OECreateSmiString function, called with the flavors OESMILESFlag::Isotopes,OESMILESFlag::AtomStereo, OESMILESFlag::BondStereo, OESMILESFlag::Canonical,OESMILESFlag::AtomMaps and OESMILESFlag::RGroups.This function produces what Daylight Chemical Information Systems term an “Absolute” SMILES, c.f. theOECreateCanSmiString and OECreateAbsSmiString functions. Note that confusingly OpenEye andDaylight use conflicting definitions of the terms “absolute” and “unique”.Note that the canonical SMILES generated by this function remains dependent on the state of the molecule, esp. itsaromaticity state. Thus, to generate a canonical smiles suitable for purposes such as a database key, the programmermust assure that the state of the molecule has been standardized. In particular, aromaticity should be perceivedaccording to the preferred model. The SMILES canonicalization flag OESMILESFlag::Canonical refersspecifically to canonical ordering of atoms. In contrast, the high-level output function OEWriteMolecule,when writing the canonical SMILES format (OEFormat::ISM) does invoke OEFindRingAtomsAndBondsOEAssignAromaticFlags.Furthermore, whether OEWriteMolecule or OECreateIsoSmiString is used, the canonical SMILESgenerated depends on the current stereo specifications for the molecule. If the goal is a canonicalisomeric SMILES which is unique for all representations of an equivalent stereoisomer, i.e., foruse as a database key, it is the programmer’s responsibility to assure that the stereochemical stateof the molecule has been rationalized and standardized, using methods such as OEPerceiveChiral,OE3DToAtomStereo, OE3DToBondStereo, OEAtomBase::IsChiral, OEAtomBase::SetStereo,OEBondBase::IsChiral, OEBondBase::SetStereo, and others. Moreover, it should well be consideredthat there are limitations to the classes of stereochemistry (esp. ”extended” or ”relative”) which <strong>OEChem</strong> canrationalize and thereby canonicalize. One example is the chirality of para-substituted cyclohexane. Unfortunatelythis also reflects a limitation in the state of the art in chemoinformatics and chemistry at the time of this writing.9.43 OECreateSlnStringvoid OECreateSlnString ( std : : string &str , const OEMolBase &mol ,unsigned int flavor = OESLNFlag : : DEFAULT )Create a Tripos SLN string representing a given molecule. Several variants of SLN format are supported by usingdifferent bits of the “flavor” parameter. These bits are specified by the OESLNFlag namespace.The OESLNFlag::Isotopes flag controls whether isotopic mass is written to the generated SLN strings.The OESLNFlag::Hydrogens flag controls whether explicit hydrogens are automatically suppressed and writtento the SLN string as part of an atom’s implicit hydrogen count.The OESLNFlag::Canonical flag controls whether we attempt to generate canonical SLN strings.The OESLNFlag::Kekule flag controls whether we generate Kekulé or aromatic SLN strings. TheOECreateSlnString function uses the currently assigned aromaticity model. Ideally, from compatabilitywith Tripos generated SLN, the user should assign Tripos aromaticity to the molecule when writing aromatic SLN,using the function call OEAssignAromaticFlags(mol,OEAroModelTripos).The OESLNFlag::Name flag controls whether we append the SLN name attribute to the end of each SLN string.The OESLNFlag::FCharge flags controls whether we output the partial charge on each atom.


120 Chapter 9. <strong>OEChem</strong> FunctionsThe default value, OESLNFlag::DEFAULT, currently contains the flavor OESLNFlag::Name.9.44 OECreateSmiStringvoid OECreateSmiString ( std : : string &str , const OEMolBase &mol ,unsigned int flavor = OESMILESFlag : : DEFAULT )Create a SMILES string representing a given molecule. Several variants of SMILES format are supported by usingdifferent bits of the “flavor” parameter. These bits are specified by the OESMILESFlag namespace.The OESMILESFlag::Isotopes flag controls whether isotopic mass is written to the generated SMILESstrings.The OESMILESFlag::Hydrogens flag controls whether explicit hydrogens are automatically suppressed andwritten to the SMILES string as part of an atom’s implicit hydrogen count.The OESMILESFlag::RGroups flag controls whether atoms with atomic number zero (as determinedby the OEAtomBase::GetAtomicNum method), and a non-zero map index (as determined by theOEAtomBase::GetMapIdx method) should be displayed using the ‘[R1]’ notation. In this notation, theinteger value following the ‘R’ corresponds to the atom’s map index. When this flag isn’t set, such atoms arewritten in the Daylight convention ‘[*:1]’.The OESMILESFlag::AtomStereo flag controls whether the specified chirality at tetrahedral atomic stereocentersshould be written to the generated SMILES string.The OESMILESFlag::BondStereo flag controls whether the specified cis/trans chirality at bond stereocentersshould be written to the generated SMILES string.The OESMILESFlag::AtomMaps flag controls whether atom map indices are written to the generated SMILESstring. <strong>OEChem</strong> allows the use of atom map indices on molecules other than reactions, e.g. the SMILES[CH4:1]. This flag controls whether these map indices should be suppressed in the output SMILES string.The OESMILESFlag::Canonical flag controls whether we attempt to generate canonical SMILES strings.The canonical SMILES strings generated by <strong>OEChem</strong> are not canonicalized by the same algorithm used by DaylightChemical Information Systems, and hence some molecules will be assigned a different unique representationby each toolkit. Indeed, the algorithms used both by OpenEye and Daylight evolve and improve over time, soSMILES should always be recanonicalized by the same version of a toolkit, before comparing them for equivalence.Like the Daylight algorithms, there are known issues with canonicalization of relative stereochemistriesin the current version <strong>OEChem</strong>, however the canonicalization of SMILES without specified atom or bond stereochemistryis currently believed to be flawless.The OESMILESFlag::Kekule flag controls whether we generate Kekulé or aromatic SMILES strings. TheOECreateSmiString function uses the currently assigned aromaticity model. There are known portabilityproblems with different SMILES parsers having varying degrees of ability in parsing aromatic systems, hencewriting Kekulé SMILES or using a simple model of aromaticity (see the function OEAssignAromaticFlags)can be used to improve interoperability with non-OpenEye software.The OESMILESFlag::SuperAtoms flag controls whether atoms with atomic number zero (as determined bythe OEAtomBase::GetAtomicNum method), and a non-empty name string property (as determined by theOEAtomBase::GetName) should be displayed in SMILES superatom notation, rather than just ‘[*]’. Forexample, this can be used to generate the SMILES ‘[Asp][Gly][Lys]’.The OESMILESFlag::ExtBonds flag controls whether atoms with atomic number zero (as determinedby the OEAtomBase::GetAtomicNum method), and a non-zero map index (as determined by theOEAtomBase::GetMapIdx method) should be generated the external bond ‘&1’ notation. In this notation,


9.45. OEDefaultImplicitHCount 121the integer value following the ‘&’ corresponds to the atom’s map index. When this flag isn’t set, such atoms arewritten in the Daylight convention ‘[*:1]’.The default value, OESMILESFlag::DEFAULT, currently contains the flavors OESMILESFlag::RGroups,OESMILESFlag::AtomMaps and OESMILESFlag::Canonical.9.45 OEDefaultImplicitHCountunsigned int OEDefaultImplicitHCount ( const OEAtomBase ∗atm )Determine the default number of implicit hydrogens on an atom using OpenEye’s simple valence model. Thiscount assumes that it is free to change the formal charge of an atom. If the charge state is correctly set on eachatom, you should call the OEDefaultMDLHCount function instead.9.46 OEDefaultMDLHCountunsigned int OEDefaultMDLHCount ( const OEAtomBase ∗atm )Determine the default number of implicit hydrogens on an atom using MDL’s valence model. This count assumesthat the formal charge on an atom has been correctly set. If the formal charge on each atom is not know ‘a priori’,the OEDefaultImplicitHCount function may be more suitable.9.47 OEDeleteEverythingExceptTheFirstLargestComponentbool OEDeleteEverythingExceptTheFirstLargestComponent ( OEMolBase &mol )9.48 OEDetermineComponentsunsigned int OEDetermineComponents ( OEMolBase &mol , unsigned int ∗parts )This function determines the connected components of a molecule. The return value is the number of connectedcomponents found in the molecule. If the molecule contains a single discrete molecule, the return value is one.The “parts” array must contain at least OEMolBase::GetMaxAtomIdx elements, and upon return it contains amapping indexed by OEAtomBase::GetIdx of which part or connected component each atom is in. The partsare numbered from one, up to and including the return value of the function.9.49 OEDetermineConnectivityvoid OEDetermineConnectivity ( OEMolBase &mol )Perceive the covalent bonds of a molecule from 3D coordinates. This routine creates a bond between any pair ofatoms that are closer than the sum of their covalent radii plus a slop factor of 0.45 Angstroms. The covalent radii


122 Chapter 9. <strong>OEChem</strong> Functionsof each atom are as defined by the Cambridge Crystallographic Database, and are those returned by the <strong>OEChem</strong>function OEGetCovalentRadius. Bonds are not created by atoms separated by less than 0.4A. All bondsare created with bond order 1. The <strong>OEChem</strong> function OEPerceiveBondOrders may be used to assign bondorders from the 3D geometry and connectivity.9.50 OEDetermineRingSystemsunsigned int OEDetermineRingSystems ( OEMolBase &mol , unsigned int ∗rings )This function determines the ring systems of a molecule. The return value is the number of connected componentsfound in the molecule. If the molecule is acyclic, the return value is zero. The “rings” array mustcontain at least OEMolBase::GetMaxAtomIdx elements, and upon return it contains a mapping indexedby OEAtomBase::GetIdx of which ring system each atom is in. The ring systems are numbered fromone, up to an including the return value of the function. Atoms that aren’t contained in a ring, i.e. for whichOEAtomBase::IsInRing returns false, are mapped to the value zero.9.51 OEDoubleBondCountunsigned int OEDoubleBondCount ( const OEAtomBase ∗atm )Return the number of double bonds connected to an atom.9.52 OEEulerRotatevoid OEEulerRotate ( OEMolBase &mol , const double ∗angles )void OEEulerRotate ( OEConfBaseT &conf , const double ∗angles )void OEEulerRotate ( OEMCMolBaseT &mcmol , const double ∗angles )Rotates the the molecules about the z, x’, and z’ axes in order. It is assumed that the angles array is at least of length3. The angles array should contain the z rotation in radians in angles[0], the x’ rotation in radians in angles[1], andthe z’ rotation in radians in angles[2]. The overloads for OEConfBaseT and OEMCMolBaseT are for efficiency.9.53 OEExactGraphMatchbool OEExactGraphMatch ( const OEMolBase &x , const OEMolBase &y )Determine whether two molecules, x and y, have exactly the same graph. This function effectively compares theabsolute canonical SMILES of both molecules, using string equality.9.54 OEExpandSuperAtomsbool OEExpandSuperAtoms ( OEMolBase &mol )


9.55. OEFindRingAtomsAndBonds 123The OEExpandSuperAtoms function expands (or instantiates) the recognized super-atoms in a connection table.Superatoms are commonly found in MDL mol files and some SMILES variants as a way of specifying a commonfunctional group by a single superatom. This function replaces each pseudo atom with the set of atoms and bondsit represents.Currently this function expands the 20 naturally occuring amino acids and “Abu” (2-amino butyric acid). Additionalsuperatoms, such as common protecting groups, may be supported in the future. Unrecognized superatomsare unmodified by this function.This function determines connectivity for multi-valent superatoms from 2D co-ordinates when available, and failingthat from atom indices, i.e. the order in which atoms are created. These heuristics allow correct interpretationof most common uses of superatoms, such as the SMILES variant “[Ala][Asn][Thr]”.9.55 OEFindRingAtomsAndBondsvoid OEFindRingAtomsAndBonds ( OEMolBase &mol )Determine which atoms and bonds of a molecule are contained in rings, and set their “in ring” property appropriately.9.56 OEFormalPartialChargesvoid OEFormalPartialCharges ( OEMolBase &mol )Set the partial charge property of each atom in a molecule to its formal charge. This is equivalent ofcalling the OEAtomBase::SetPartialCharge method on every atom with the value returned fromOEAtomBase::GetFormalCharge.9.57 OEGasteigerInitialChargesbool OEGasteigerInitialCharges ( OEMolBase &mol )Calculate the seed charge partial charges used by the Marsilli-Gasteiger partial charge algorithm. It is not necessaryto call this function prior to calling OEGasteigerPartialCharges.Gasteiger initial charges assign the partial charge of -0.5 to atoms of type OETriposType::Oco2, i.e. carboxylateoxygens, and use the formal charge as the partial charge on all other atoms except those in conjugated rings.For conjugated ring systems, consisting of Tripos atom types C.2, C.ar, N.2, N.ar, N.pl3 and N.am, the sum ofthe formal charges of the atoms in the ring system are divided equally amongst all atoms in the ring system. Forexample, the five heavy atoms in imidazolium (“[nH+]1c[nH]cc1”), each get a partial charge of 0.2.9.58 OEGasteigerPartialChargesbool OEGasteigerPartialCharges ( OEMolBase &mol )


124 Chapter 9. <strong>OEChem</strong> FunctionsCalculate Marsilli-Gasteiger partial charges for a molecule. The results of the calculation are placed in the partialcharge property of each atom using OEAtomBase::SetPartialCharge.9.59 OEGetAbsTorsiondouble OEGetAbsTorsion ( const OEMolBase &,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c ,const OEAtomBase ∗d )double OEGetAbsTorsion ( const OEConfBaseT &,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c ,const OEAtomBase ∗d )Returns the absolute value of the torsion defined by atoms a, b, c, and d. The return value is in radians and variesfrom 0 to +PI. This function returns the same value as fabs(OEGetTorsion()), yet it is more efficient. Thesefunctions assume that the four atoms are members of the molecule or conformer which is passed to the function.The OEConfBaseT overload is strictly for efficiency.9.60 OEGetAminoAcidCodechar OEGetAminoAcidCode ( unsigned int idx ) ;The OEGetAminoAcidCode function returns the single character amino acid code corresponding to the specifiedresidue (using the OEResidueIndex namespace format). The character ’X’ is returned for the residueOEResidueIndex::UNK and the NULL character (0) is returned for all other non-amino acid residues.9.61 OEGetAngledouble OEGetAngle ( const OEMolBase &,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c )double OEGetAngle ( const OEMolBase &ma , const OEAtomBase ∗a ,const OEMolBase &mb , const OEAtomBase ∗b ,const OEMolBase &mc , const OEAtomBase ∗c )double OEGetAngle ( const OEConfBaseT &conf ,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c )double OEGetAngle ( const OEConfBaseT &ca , const OEAtomBase ∗a ,const OEConfBaseT &cb , const OEAtomBase ∗b ,const OEConfBaseT &cc , const OEAtomBase ∗c )Returns the angle formed by three atoms where the atom passed in as the b argument is the vertex. The functionwhich takes a single OEMolBase argument assumes that all three atoms are contained in the single molecule. The


9.62. OEGetAtomComment 125OEConfBaseT overload functions are not strictly necessary, but are useful for efficiency.9.62 OEGetAtomCommentconst char ∗OEGetAtomComment ( const OEAtomBase ∗atm ) ;Used to retrieve the text comment associated with an individual atom. This field is used to manipulate the atomalias information in MDL file formats. This property may be set using the OESetAtomComment function.9.63 OEGetAtomicNumunsigned int OEGetAtomicNum ( const char ∗symb )Return the atomic number associated with the specified atomic symbol. The specified buffer “symb” must containa string terminated by either a space or a NUL, ’\0’, character. Zero-length strings, strings longer than twocharacters or unrecognized symbols all return the value zero. The comparison is case insensitive, such that the firstcharacter need not be uppercase, and the second character (if one exists) need not be lower case.This function returns the value 1 for symbols ’H’, ’D’ and ’T’.9.64 OEGetAtomicSymbolconst char∗ OEGetAtomicSymbol ( unsigned int elemno )Return the atomic symbol associated with the specified atomic number. This function returns a validpointer to a NUL-character, ’\0’, if elemno is not greater than zero and less than the symbolic constantOEElemNo::MAXELEM. Otherwise all returned values are NUL-terminated, with the first character uppercase,and the second either a NUL, or a lowercase character (in which case the third character is always the NULterminator).9.65 OEGetAutomorphsOESystem : : OEIterBase ∗OEGetAutomorphs ( const OEMolBase&,bool includeH=false )9.66 OEGetAverageWeightdouble OEGetAverageWeight ( unsigned int elemno )Return the average atomic weight of an element, based upon the naturally occurring abundancesof its isotopes. To return the “monoisotopic” weight for a particular element use the call:


126 Chapter 9. <strong>OEChem</strong> FunctionsOEGetIsotopicWeight(elemno,OEGetDefaultMass(elemno)).9.67 OEGetBondiVdWRadiusdouble OEGetBondiVdWRadius ( unsigned int elemno )Return the Van der Waals radius for a particular atomic number as tabulated in A. Bondi, “Van der Waals Volumesand Radii”, Journal of Physical Chemistry, Vol. 68, No. 3, pp. 441, 1964. There are several experimental valuesfor Van der Waals radii (see also OEGetPaulingVdWRadii) and many additional values used in molecularmechanics forcefields (including united-atom VdW radii), so there is often no definitive notion of Van der Waalsradius.9.68 OEGetCommentconst char ∗OEGetComment ( const OEMolBase &mol )Return a pointer to the text comment attached to a molecule. These comments are written to the commentfield of .sdf and .mol2 formats and are also stored in OEBinary format. This property may be set using theOESetComment function.9.69 OEGetCovalentRadiusdouble OEGetCovalentRadius ( unsigned int elemno )Return the covalent radius of the element specified by the given atomic number. The covalent radius of an atomis typically used in bonding calculations, such as the function OEDetermineConnectivity. A value of zerois returned for elements other than those commonly found in organic molecules. The actual values are thoseprescribed by the Cambridge Crystallographic Database.9.70 OEGetDefaultMassunsigned int OEGetDefaultMass ( unsigned int elemno )The OEGetDefaultMass function returns the most abundant isotope for the given atomic number. For example,for OEElemNo::C this function returns the value 12. For input value of zero and for values greater than or equalto OEElemNo::MAXELEM, this function returns zero.This function returns the same values as required by the MDL file format. In MDL SD files, non-natural isotopesare represented as a delta from the most commonly occuring isotope for a particular element/atomic number.9.71 OEGetDelphiRadiusdouble OEGetDelphiRadius ( unsigned int elemno )


9.72. OEGetDistance 127Return the radius of the element specified by the given atomic number. The value is based on values used in Delphiand Zap.9.72 OEGetDistancedouble OEGetDistance ( const OEMolBase &,const OEAtomBase ∗a ,const OEAtomBase ∗b )double OEGetDistance ( const OEMolBase &ma ,const OEAtomBase ∗a ,const OEMolBase &mb ,const OEAtomBase ∗b )double OEGetDistance ( const OEConfBaseT &conf ,const OEAtomBase ∗a ,const OEAtomBase ∗b )double OEGetDistance ( const OEConfBaseT &ca ,const OEAtomBase ∗a ,const OEConfBaseT &cb ,const OEAtomBase ∗b )These four <strong>API</strong> points calculate the distance between two atoms. The two functions which take a single molecule(either OEMolBase& or OEConfBaseT&) assume that the two atoms are both in the single molecule. If the atomsare in different molecules, the function which takes two molecule arguments should be used. OEConfBaseTinherits from OEMolBase and strictly speaking the overload is not necessary. However, the specific OEConfBaseTimplementation can be more efficient.9.73 OEGetDistance2double OEGetDistance2 ( const OEMolBase &,const OEAtomBase ∗a ,const OEAtomBase ∗b )double OEGetDistance2 ( const OEMolBase &ma ,const OEAtomBase ∗a ,const OEMolBase &mb ,const OEAtomBase ∗b )double OEGetDistance2 ( const OEConfBaseT &conf ,const OEAtomBase ∗a ,const OEAtomBase ∗b )double OEGetDistance2 ( const OEConfBaseT &ca ,const OEAtomBase ∗a ,const OEConfBaseT &cb ,const OEAtomBase ∗b )These four functions are almost identical to the OEGetDistance function. However, they return the square of thedistance between two atoms rather than distance. When it is possible to use the square of the distance, this is moreefficient.9.74 OEGetFileExtensionconst char ∗OEGetFileExtension ( const char ∗fname )


128 Chapter 9. <strong>OEChem</strong> FunctionsReturn the file extension for the file name fname.9.75 OEGetFileTypeunsigned int OEGetFileType ( const char ∗ext )Returns a constant from the OEFormat namespace for the file extension ext.9.76 OEGetFormatExtensionconst char ∗OEGetFormatExtension ( unsigned int tag )Returns a comma-separated list of possible file extensions corresponding to the specified parameter. The parameter,tag, should be drawn from the OEFormat namespace.9.77 OEGetFormatStringconst char ∗OEGetFormatString ( const unsigned int tag )Returns the name of the file format associated with the symbolic constant tag from the OEFormat namespace.9.78 OEGetHybridizationunsigned int OEGetHybridization ( const OEAtomBase ∗atom )This function predicts the atomic hybridization/geometry of an atom given its immediate connectivity. The returnvalue is taken from the namespace OEHybridization.9.79 OEGetIsotopicWeightdouble OEGetIsotopicWeight ( unsigned int elemno , unsigned int mass )Returns the atomic weight for a specific isotope. The isotope is specified by the parameters “elemno”, the atomicnumber or number of protons in the nucleus, and “mass”, the total number of protons and neutrons in the nucleus.To get the average atomic weight of an element, based upon typically occuring abundances of its natural isotopes,use the <strong>OEChem</strong> OEGetAverageWeight function.9.80 OEGetPackedCoords


9.81. OEGetPaulingVdWRadius 129void OEGetPackedCoords ( const OEMolBase &mol , float ∗coords )void OEGetPackedCoords ( const OEMolBase &mol , double ∗coords )Fills an array with the coordinates of a molecule. The coordinates will be packed into an array of sizeOEMolBase::NumAtoms()*3 which is passed in as the coords array. The coordinates of the atoms will bein the array in the same order as the atoms come out of the iterator generated by OEMolBase::GetAtoms().9.81 OEGetPaulingVdWRadiusdouble OEGetPaulingVdWRadius ( unsigned int elemno )Return the Van der Waals radius for a particular atomic number as tabulated in Linus Pauling, “The Nature ofthe Chemical Bond”, 3rd Edition, 1960. There are several experimental values for Van der Waals radii (see alsoOEGetBondiVdWRadii) and many additional values used in molecular mechanics forcefields (including unitedatomVdW radii), so there is often no definitive notion of Van der Waals radius.9.82 OEGetPDBAtomIndexunsigned int OEGetPDBAtomIndex ( const OEAtomBase ∗atm )The OEGetPDBAtomIndex function takes a OEAtomBase as an argument and returns an unsigned integer indexencoding the atom name. The atom name is the value returned by the OEAtomBase::GetName method and theresulting index corresponds to a value in the OEPDBAtomName namespace.The PDB atom name index returned by this function may be converted back into a string using theOEGetPDBAtomName function.9.83 OEGetPDBAtomNameconst char∗ OEGetPDBAtomName ( unsigned int idx )The OEGetPDBAtomName function converts an <strong>OEChem</strong> PDB atom name index, as returned by theOEGetPDBAtomIndex function, back into a string representation. Valid indices are specified in <strong>OEChem</strong>’sOEPDBAtomName namespace.A NULL pointer, (char*)0, is returned for invalid or unrecognized argument values. All other returned stringconstants are guaranteed to be four characters long. For example, the input value OEPDBAtomName::CA returnsthe string value " CA ".9.84 OEGetPathLengthunsigned int GetPathLength ( const OEAtomBase ∗src , const OEAtomBase ∗dst ,unsigned int max=0)This function returns the shortest path length between the ‘src’ and ‘dst’ atoms. If the ‘src’ and ‘dst’ atoms are thesame OEAtomBase, or have different parent MolBases or are disconnected, this function returns the value zero.


130 Chapter 9. <strong>OEChem</strong> FunctionsThe “max” parameter may be used to specify a maximum path length to consider before terminating the search. Ifthis value is zero, the default, the is no upper bound on the returned path length. Otherwise, if the shortest patchbetween the two atoms is greater than “max” bonds, this function returns the value zero.9.85 OEGetResidueIndexunsigned int OEGetResidueIndex ( const OEResidue &res )unsigned int OEGetResidueIndex ( const OEAtomBase ∗atm )The OEGetResidueIndex function returns the <strong>OEChem</strong> PDB residue name index for the given OEResidueor OEAtomBase. The resulting value is specified by the OEResidueIndex namespace. If the residue nameis not recognized internally by <strong>OEChem</strong> this function returns the value zero. For OEAtomBase arguments, thisfunction simply use the OEResidue returned by the OEAtomGetResidue function.9.86 OEGetResidueNameconst char ∗OEGetResidueName ( unsigned int idx )The OEGetResidueName function converts an <strong>OEChem</strong> residue index, as returned by theOEGetResidueIndex function, back into a three-character string representation. Valid indices are specifiedin <strong>OEChem</strong>’s OEResidueIndex namespace.A NULL pointer, (char*)0, is returned for invalid or unrecognized argument values. All other returned stringconstants are guaranteed to be three characters long. For example, the input value OEResidueIndex::ALAreturns the string value "ALA".9.87 OEGetSmallestSubtreeOESystem : : OEIterBase∗OEGetSmallestSubtree ( const OEBondBase ∗bond )This function traverses the subgraph of all connected atoms on one end of a bond passed as the argument withoutcrossing the bond itself. If the number of contiguous atoms connected to the beginning atom of the bond exceedshalf of the atoms in the molecule, that subtree is discarded and a new traversal begins starting with the end atom ofthe bond. The bond itself may not be crossed in the second traversal. An iterator over the atoms that are membersof the smallest subgraph is returned. The root atom of the bond from which the smallest subtree originates isincluded in the atom iterator returned.9.88 OEGetSubtreeOESystem : : OEIterBase ∗OEGetSubtree ( const OEAtomBase ∗exclude ,const OEAtomBase ∗root )This function traverses the subgraph of all atoms connected to the ’root’ atom passed as the second argument. Thetraversal is not allowed to cross the ’exclude’ atom passed as the first argument. An iterator over the atoms that


9.89. OEGetTorsion 131are members of the subgraph is returned, including the ’root’ atom. The subgraph will include all atoms for whichthere is a path to the ’root’ atom which does not pass through the ’exclude’ atom.OESystem : : OEIterBase ∗OEGetSubtree ( const OEBondBase ∗bond ,const OESystem : : OEUnaryPredicate &excludeAtoms )This function traverses the subgraph from the beginning atom of the bond passed as the first argument withoutcrossing the bond itself. If the subgraph traversal does not cross any atoms which return true when tested with the’excludeAtoms’ predicate, then an iterator over the atoms contained in the subgraph is returned. If excluded atomsare encountered in the subgraph traversal, the subgraph is discarded and a new traversal begins from the end atomof the bond. If the new traversal fails to encounter excluded atoms then an iterator over the atoms contained inthe subgraph is returned. The iterator over atoms includes the atom of the bond from which the returned traversaloriginated. If both traversals fail then an iterator over an empty set of atoms is returned.9.89 OEGetTorsiondouble OEGetTorsion ( const OEMolBase &,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c ,const OEAtomBase ∗d )double OEGetTorsion ( const OEConfBaseT &,const OEAtomBase ∗a ,const OEAtomBase ∗b ,const OEAtomBase ∗c ,const OEAtomBase ∗d )Functions which return the torsion formed by the four atoms a, b, c, and d. The return value is in radians and variesfrom +PI to -PI. All of the atoms must be contained in the molecule (or conformer) which is passed to the function.The OEConfBaseT is strictly for efficiency. If the absoluted value of the torsion can be used instead, the functionOEGetAbsTorsion is much more effcient than calculating the absolute value of the return of this function.9.90 OEHasDoubleBondbool OEHasDoubleBond ( const OEAtomBase ∗atom )Determine whether an atom is connected by one or more double bonds.9.91 OEHasExplicitHydrogensbool OEHasExplicitHydrogens ( const OEMolBase &mol )Determine whether a molecule has any explicit hydrogens. A return value of true indicates that one or more of theOEAtomBases of the given molecule has an atomic number of one (OEElemNo::H).9.92 OEHasImplicitHydrogens


132 Chapter 9. <strong>OEChem</strong> Functionsbool OEHasImplicitHydrogens ( const OEMolBase &mol )Determine whether a molecule as any implicit hydrogens. A return value of true indicates that one or more of theOEAtomBases of the given molecule has an “implicit hydrogen count” property greater than or equal to one.9.93 OEHasMultipleBondbool OEHasMultipleBond ( const OEAtomBase ∗atom )Determine whether an atom is connected by any bonds with whose bond order, as returned byOEBondBase::GetOrder, is greater than one.9.94 OEHasPartialChargesbool OEHasPartialCharges ( const OEMolBase &mol )Return true if any of the atoms of a molecule have a non-zero partial charge.9.95 OEHasStereoHydrogensbool OEHasStereoHydrogens ( const OEAtomBase ∗atom )Returns whether the heavy atom passed in the argument has a hydrogen attached that is required to properly specifya stereo-center.9.96 OEHasResiduebool OEHasResidue ( const OEAtomBase ∗atom )Check whether an atom has any biopolymer residue information associated with it.9.97 OEHasResiduesbool OEHasResidues ( const OEMolBase &mol )Check whether any of the atoms of a molecule have any biopolymer residue information associated with them.9.98 OEHasSingleBondbool OEHasSingleBond ( const OEAtomBase ∗atom )


9.99. OEHasTripleBond 133Determine whether an atom is connected by one or more single bonds. This function returns true if the atomsimplicit hydrogen count is non-zero.9.99 OEHasTripleBondbool OEHasTripleBond ( const OEAtomBase ∗atom )Determine whether an atom is connected by one or more triple bonds.9.100 OEInvertCenterbool OEInvertCenter ( OEMolBase &mol , const OEAtomBase ∗atom )bool OEInvertCenter ( OEMolBase &mol ,const OEAtomBase ∗atom ,const OEAtomBase ∗ref1 ,const OEAtomBase ∗ref2 )These functions perform a geometric inversion around the atom passed as the second argument. The secondoverloaded function allows the reference atoms that are held fixed during the inversion to be specified as the thirdan fourth arguments. The functions return true if inversion completes successfully. The functions return false ifthe center is not either degree or degree four, if the reference atoms are invalid, if the center to invert has more thantwo rings bonds, or if a geometric inversion is ill defined.9.101 OEIsBinarybool OEIsBinary ( unsigned int format )Returns true if the specified file format is a binary format.OEFormat namespace.The parameter value should be drawn from the9.102 OEIsCommonIsotopebool OEIsCommonIsotope ( unsigned int elemno , unsigned int mass )Determine whether the isotope specified by the atomic number elemno, and atomic mass mass is a valid combination.This list is derived from high-energy physics experiments, and is useful for checking whether the massesprovided on radioisotopes are within the expected range.9.103 OEIsReadablebool OEIsReadable ( const std : : string &filename )bool OEIsReadable ( unsigned int format )


134 Chapter 9. <strong>OEChem</strong> FunctionsReturn true if the supplied file format is readable by <strong>OEChem</strong>. The filename can be a file name or a fileextension. The unsigned int parameter value should be drawn from the OEFormat namespace.9.104 OEIsWriteablebool OEIsWriteable ( const std : : string &filename )bool OEIsWriteable ( unsigned int format )Return true if the supplied file format is writable by <strong>OEChem</strong>. The filename can be a file name or a fileextension. The unsigned int parameter value should be drawn from the OEFormat namespace.9.105 OEKekulizebool OEKekulize ( OEMolBase &mol )Determine a valid Kekulé form for a molecule. On input, the integer bond types of each bond should be set to 1for single, 2 for double, 3 for triple, 4 for quadruple and 5 for an aromatic (or resonant bond). On output, the bondorder property of each bond is set to the integer bond types, except for bonds marked type 5, which are assignedas either single or double as required. The formal charges and implicit hydrogen counts of each atom must becorrectly specified prior to calling this function.Note that this function will not clear the aromatic flags associated with atoms and bonds. These flags may affectresulting output (e.g. SMILES) or downstream processing. So, if these effects are not desired, the functionOEClearAromaticFlags should be used.9.106 OEMacroModelAtomTypesbool OEMacroModelAtomTypes ( OEMolBase &mol )This function sets the integer atom type property of every atom in a molecule to its MacroModel atom type. Theinteger atom type indices are defined in the OEMModTypes namespace, and each atom is assigned a value usingthe OEAtomBase::SetIntType method. The OEMacroModelAtomTypes function returns false if anyatom was assigned type zero, i.e. unknown, and returns the value true otherwise.9.107 OEMacroModelAtomTypeNamesbool OEMacroModelAtomTypeNames ( OEMolBase &mol )This function sets the string atom type property of every atom in a molecule to its MacroModel atom type. Thestring atom type property is set using the OEAtomBase::SetType method. This function returns false if anyatom was assigned “00”, i.e. unknown, and returns the value true otherwise.9.108 OEMacroModelTypeElement


9.109. OEMacroModelTypeName 135unsigned int OEMacroModelTypeElement ( OEMolBase &mol )The OEMacroModelTypeElement function returns the atomic number/element represented by the given Macro-Model atom type index, as encoded by the OEMModTypes namespace.9.109 OEMacroModelTypeNameconst char ∗OEMacroModelTypeName ( unsigned int type )This function returns the symbolic atom type name that corresponds to the given MacroModel atom type index, asencoded by the OEMModTypes namespace.9.110 OEMacroModelTypeNamesbool OEMacroModelTypeNames ( OEMolBase &mol )This function loops through the atoms of the molecule, setting the string atom type property of each atom, to atomtype name of the MacroModel atom type encoded in the atoms integer atom type property. This is approximatelyequivalent to following operation:atm−>SetType ( OEMacroModelTypeName ( atm−>GetIntType ( ) ) )If both the string and integer atom types are required, it is faster to call OEMacroModelAtomTypes and thenOEMacroModelTypeNames (which reuses the results of the first call) than it is to call OEMacroModelAtomTypesand OEMacroModelAtomTypeNames.9.111 OEMDLClearParityvoid OEMDLClearParity ( OEMolBase &mol )This function clears the MDL atom stereo parity fields from all atoms of a molecule.9.112 OEMDLCorrectBondStereobool OEMDLCorrectBondStereo ( OEMolBase &mol )This function tries to correct the wedge/hash bond assignment of the molecule, inverting or removing wedges andhashes from the connection table to avoid inconsistent or ambiguous stereochemistry assignment. This functionrequires that the molecule have 2D co-ordinates.9.113 OEMDLHasIncorrectBondStereobool OEMDLHasIncorrectBondStereo ( const OEMolBase &mol )


136 Chapter 9. <strong>OEChem</strong> FunctionsThis function checks whether the wedge/hash bond assignment of the molecule is inconsistent or ambiguous. Thisfunction requires that the molecule have 2D co-ordinates.9.114 OEMDLHasParitybool OEMDLHasParity ( const OEMolBase &mol )This function checks the MDL ”ischiral” flag on a molecule. After reading from an MDL connection table thisvalue is true, if the chiral flag was set in the header. After calling the OEMDLPerceiveParity function thisvalue is true, if a non-zero stereo parity value was assigned to any atom.9.115 OEMDLPerceiveBondStereobool OEMDLPerceiveBondStereo ( OEMolBase &mol )This function assigns wedge and hash bonds to a connection table from the <strong>OEChem</strong> stereochemistry of each atom.This function requires that the molecule have 2D co-ordinates.This function is the opposite of the OEMDLStereoFromBondStereo function.9.116 OEMDLPerceiveParityvoid OEMDLPerceiveParity ( OEMolBase &mol )This function sets the MDL stereo parity information for each atom from the <strong>OEChem</strong> stereochemistry. Any atomthat has tetrahedral stereo specified, has the appropriate value, one or two, placed in its “MDLParity” generic data,with type “unsigned int”. This MDL stereo parity is relative to the current order of atoms returned by an iteratorof atoms across a molecule. All other atoms, non-chiral or without stereo specified, have their MDL stereo parityset to zero.OEMDLPercieveParity internally calls the OEPerceiveChiral function, so there’s no need to explicitlycall OEPerceiveChiral on a molecule prior to calling OEMDLPercieveParity.This function is the opposite of the OEMDLStereoFromParity function.9.117 OEMDLStereoFromBondStereobool OEMDLStereoFromBondStereo ( OEMolBase &mol )This functions sets the <strong>OEChem</strong> stereochemistry of each atom from the wedge and hash bonds in the connectiontable. This function requires that the molecule have 2D co-ordinates.


9.118. OEMDLStereoFromParity 137This function is the opposite of the OEMDLPerceiveBondStereo function.9.118 OEMDLStereoFromParityvoid OEMDLStereoFromParity ( OEMolBase &mol )This function sets the <strong>OEChem</strong> stereochemistry for each atom from the MDL stereo parity information.This function is the opposite of the OEMDLPerceiveParity function.9.119 OEMMFFRemapElementvoid OEMMFFRemapElement ( unsigned int from_element ,unsigned int to_element ) ;Map a particular element to another element for purposes of the OEMMFF functions.NOTE: This function is not thread-safe. It should only be called when it is assured not to race with any otherOEMMFF functions.9.120 OEMMFFClearRemappedElementsvoid OEMMFFClearRemappedElements ( ) ;Removes any mappings created by calling OEMMFFRemapElement.NOTE: This function is not thread-safe. It should only be called when it is assured not to race with any otherOEMMFF functions.9.121 OEMolecularFormulavoid OEMolecularFormula ( std : : string &str , const OEMolBase &mol )This function calculates the molecular formula for the given molecule, return the result in the str argument. Thecomponent elements of the molecular formula are listed in Hill order. This function determines the cummulativemolecular formula, so elements from different connected components are summed. To generate a ”dot disconnected”molecular formula, this function should be used to generate the formula for each component or part, andthe results concatenated together as appropriate.9.122 OEMultipleBondCountunsigned int OEMultipleBondCount ( const OEAtomBase ∗atm )


138 Chapter 9. <strong>OEChem</strong> FunctionsReturn the number of bonds connected to an atom, with bond order greater than one. The bond order is as determinedby OEBondBase::GetOrder.9.123 OENetChargeint OENetCharge ( const OEMolBase &mol )Determine the net charge on a molecule. If the molecule has specified partial charges, see <strong>OEChem</strong>’sOEHasPartialCharges function, this function returns the sum of the partial charges rounded to an integer.Otherwise this function returns the sum of the formal charges on each atom of the molecule.9.124 OENewMCMolBaseOEMCMolBase ∗OENewMCMolBase ( unsigned int type=OEMCMolType : : OEDefault )OEMCMolBase ∗OENewMCMolBase ( const OEMolBase &mol ,unsigned int type=OEMCMolType : : OEDefault )OEMCMolBase ∗OENewMCMolBase ( const OEMCMolBase &mol ,unsigned int type=OEMCMolType : : OEDefault )The OENewMCMolBase factory methods allocate an implementation of an OEMCMolBase based on the integer’type’ argument. The ’type’ argument specifies the implementation type to be allocated, and should be one of thevalues listed in namespace OEMCMolType. An OEMolBase or OEMCMolBase may be passed in order tocopy construct the OEMCMolBase instance. The pointer to the OEMCMolBase memory returned by the functionis allocated dynamically. The OEMCMolBase::delete operator must be called for all returned instances toprevent memory leaks.9.125 OENewMolBaseOEMolBase ∗OENewMolBase ( unsigned int type=OEMolBaseType : : OEDefault )OEMolBase ∗OENewMolBase ( const OEMolBase &mol ,unsigned int type=OEMolBaseType : : OEDefault )The OENewMolBase factory methods allocate an implementation of an OEMolBase based on the the integer’type’ argument. The ’type’ argument specifies the implementation type to be allocated, and should be one ofthe values listed in namespace OEMolBaseType. The returned molecule may be copy constructed from anexisting OEMolBase instance. The pointer to the OEMolBase memory returned by the function is allocateddynamically. The OEMolBase::delete operator must be called for all returned instances to prevent memoryleaks.9.126 OENewQMolBaseOEQMolBase ∗OENewQMolBase ( unsigned int type=OEQMolType : : OEDefault )OEQMolBase ∗OENewQMolBase ( const OEMolBase &mol ,unsigned int type=OEQMolType : : OEDefault )OEQMolBase ∗OENewQMolBase ( const OEQMolBase &mol ,unsigned int type=OEQMolType : : OEDefault )


9.127. OEParseSmarts 139The OENewQMolBase factory methods allocate an implementation of an OEQMolBase based on the integer’type’ argument. The ’type’ argument specifies the implementation type to be allocated, and should be one ofthe values listed in namespace OEQMolType. An OEMolBase or OEQMolBase may be passed in order tocopy construct the OEQMolBase instance. The pointer to the OEQMolBase memory returned by the function isallocated dynamically. The OEQMolBase::delete operator must be called for all returned instances to preventmemory leaks.9.127 OEParseSmartsbool OEParseSmarts ( OEQMolBase &qmol , const char ∗smarts ,unsigned int opt=OESmartsParseOpts : : Default )bool OEParseSmarts ( OEQMolBase &qmol , const char ∗smarts ,const OEVectorBindings &vecbind ,unsigned int opt=OESmartsParseOpts : : Default )These functions take a SMARTS string represented as a pointer to a constant character string passed as the secondargument to the function, parse the string, and populate the query molecule passed as the first function argument.If the SMARTS string passed to the function is valid and is parsed correctly the function will return a booleanvalue of true. If the SMILES string is invalid, or any failure occurs during the process of parsing, the functionwill return a boolean value of false. The second of the two methods provides a mechanism for parsing a SMARTSpattern that contains vector bindings. An OEVectorBindings object containing the complete set of possiblevector bindings that may be contained in a SMARTS pattern, including recursive vector bindings, and passed tothe OEParseSmarts function. Vector bindings will be resolved while the SMARTS pattern is being parsed. Thefinal argument is currently unused, but allows for future extension and control of the SMARTS parser.9.128 OEParseSmilesbool OEParseSmiles ( OEMolBase &mol , const char ∗str ,bool canon=false , bool strict=false )bool OEParseSmiles ( OEMolBase &mol , const std : : string &str ,bool canon=false , bool strict=false )The OEParseSmiles function takes a SMILES string represented as a constant character string passed as thesecond argument, and populates the molecule instance passed as the first function argument. If the SMILES stringis invalid, or any failure occurs during the parse or perception processes, the function will return a boolean valueof false. If the string is parsed correctly, the function will return a boolean value of true.The canon argument to this function can be used to circumvent the post-processing kekulization test. Passing aBoolean true value to this argument indicates to the parser that the SMILES string should be assumed to be wellformedand the usual Kekulization step may be omitted. This can be used to speed-up parsing of a large database,but has the side-effect that bond orders are not correctly assigned for aromatic molecules.The final strict argument of this function controls whether the parser should operate in strict mode. By default,the SMILES parser attempts to process any reasonably formed SMILES string. If the strict argument is true,the parser applies more rigorous sanity checking. For example, the SMILES “C==C” is accepted by the defaultnon-strict parser, but rejected by the strict parser.9.129 OEParseSmirks


140 Chapter 9. <strong>OEChem</strong> Functionsbool OEParseSmirks ( OEQMolBase &qmol , const char ∗smirks ,unsigned int opt=OESmartsParseOpts : : Default )bool OEParseSmirks ( OEQMolBase &qmol , const char ∗smirks ,const OEVectorBindings &vecbind ,unsigned int opt=OESmartsParseOpts : : Default )These functions take a SMIRKS string represented as a pointer to a constant character string passed as the secondargument to the function, parse the string, and populate the query molecule passed as the first function argument.If the SMIRKS string passed to the function is valid and is parsed correctly the function will return a boolean valueof true. If the SMILES string is invalid, or any failure occurs during the parse or perception processes, the functionwill return a boolean value of false. The second of the two methods provides a mechanism for parsing a SMIRKSpattern that contains vector bindings. An OEVectorBindings object containing the complete set of possiblevector bindings that may be contained in a SMIRKS pattern, including recursive vector bindings, and passed tothe OEParseSmirks function. Vector bindings will be resolved while the SMIRKS pattern is being parsed. Thefinal argument is currently unused, but allows for future extension and control of the SMIRKS parser.OEParseSmirks is functionally nearly identical to OEParseSmarts. The only significant difference in howSMARTS and SMIRKS are parsed is the handling of the ”[H]” expression. SMARTS interprets ”[H]” as anatom that has a total hydrogen count of exactly one. SMIRKS interprets ”[H]” as an explicit hydrogen. TheOEParseSmirks function therefore parses ”[H]” differently than would OEParseSmarts, and performs additionalvalidity checks of the SMIRKS string.9.130 OEPDBOrderAtomsbool OEPDBOrderAtoms ( OEMolBase &mol )Reorder the atoms of a molecule into PDB order, using the residue information associated with each atom.9.131 OEPerceiveBondOrdersvoid OEPerceiveBondOrders ( OEMolBase &mol )This function attempts to determine bond orders from the 3D geometry and connectivity of a molecule. If theconnectivity is unspecified, the <strong>OEChem</strong> function OEDetermineConnectivity must be called prior to thisfunction.This function invalidates the aromaticity flags of the molecule’s atoms and bonds. If necessary, thesearomaticity flags may either be cleared using OEClearAromaticFlags or set appropriately by callingOEAssignAromaticFlags, after calling this function.9.132 OEPerceiveChiralbool OEPerceiveChiral ( OEMolBase &mol )This function determines the stereocenters of a molecule. This function uses symmetry classes of a molecule, todetermine which atoms and bonds are chiral. This function updates the “chiral” Boolean property of atoms and


9.133. OEPerceiveResidues 141bonds. As a side-effect it also sets the “symclass” property of all the atoms the molecule to be their “explicit hydrogensuppressed” symmetry class, by calling the <strong>OEChem</strong> function OEPerceiveSymmetry(mol,false).9.133 OEPerceiveResiduesvoid OEPerceiveResidues ( OEMolBase &mol ,unsigned stable = OEPreserveResInfo : : None )Recognize the protein and nucleic acid chains of a molecule and set the residue information for each atom appropriately.The stable parameter is a bit-mask defined in the <strong>OEChem</strong>::OEPreserveResInfo namespace thatindicates if the residue numbers, residue names, or chain ID’s should be preserved during the perception routine.By default, no prior information is preserved.9.134 OEPerceiveSymmetrybool OEPerceiveSymmetry ( OEMolBase &mol , bool includeH=true )Set the structural symmetry class of each atom of the given OEMolBase. Symmetry classes are numbered sequentiallyfrom 1 up to the maximum number of atoms in the molecule for totally assymetric molecules. The assignedsymmetry class for each OEAtomBase may be retrieved using the OEAtomBase::GetSymmetryClassmethod.The “includeH” parameter is used to specify whether implicit hydrogens should be considered distinct from explicithydrogens. Normally, a molecule will have all hydrogens either implicitly represented or explicitly represented sothis option shouldn’t affect symmetries.9.135 OERandomizeTorsionsbool OERandomizeTorsions ( OEMolBase &, double maxRadians )bool OERandomizeTorsions ( OEMolBase &, double maxRadians ,const OESystem : : OEUnaryPredicate &isRotor )This function modifies each of the torsions in a molecule by a random value between +maxRadians and -maxRadians. While most people think about this sort of function in degrees, all angles in <strong>OEChem</strong> aremeasures in radians. The following simple constants may be used OEMath::Pi, OEMath::Rad2Deg andOEMath::Deg2Rad to generate the appropriate value. There are two <strong>API</strong> points, the one with two argumentsapplies the random torsion adjustment to every bond for which the <strong>OEChem</strong> bond predicate IsRotor returnstrue. The second <strong>API</strong> point has an additional argument in which the user can specify a functor which defineswhich bonds are rotatable. If the user’s functor causes the function to attempt to apply a random rotation on aring bond, no change in the internal coordinates will occur, however, the frame of reference of the molecule maychange.9.136 OEReadCDXFilebool OEReadCDXFile ( oemolistream &ifs , OEMolBase &mol )


142 Chapter 9. <strong>OEChem</strong> FunctionsRead the contents of a ChemDraw CDX file into the specified OEMolBase.9.137 OEReadFASTAFilebool OEReadFASTAFile ( oemolistream &ifs , OEMolBase &mol )Read the contents of a FASTA sequence file into the specified OEMolBase. The amino acid residues of thesequence file are automatically expanded to an all atom representation.9.138 OEReadMacroModelFilebool OEReadMacroModelFile ( oemolistream &ifs , OEMolBase &mol )bool OEReadMacroModelFile ( oemolistream &ifs , OEMCMolBase &mol )Read the contents of the Schrodinger MacroModel format file into the specified OEMolBase.9.139 OEReadMDLFilebool OEReadMDLFile ( oemolistream &ifs , OEMolBase &mol ,const char ∗id = "" )Read the contents of the MDL mol or SDF file into the specified OEMolBase.9.140 OEReadMol2Filebool OEReadMol2File ( oemolistream &ifs , OEMolBase &mol , bool m2h = false )Read the contents of the Tripos Sybyl mol2 file into the specified OEMolBase. The Boolean m2h parameterindicates whether the connection table already has all hydrogen atoms explicit, informing the <strong>OEChem</strong> mol2 filereader not to adjust implicit hydrogen counts to satify valence and formal charge rules.9.141 OEReadMoleculebool OEReadMolecule ( oemolistream &ifs , OEMCMolBase &mol )bool OEReadMolecule ( oemolistream &ifs , OEQMolBase &mol )bool OEReadMolecule ( oemolistream &ifs , OEMolBase &mol )bool OEReadMolecule ( oemolistream &ifs , OEMol &mol )bool OEReadMolecule ( oemolistream &ifs , OEQMol &mol )bool OEReadMolecule ( oemolistream &ifs , OEGraphMol &mol )Read the contents of the input molstream into the specified molecule using the file format currently associatedwith the oemolistream. The assumed file format may be specified using the oemolistream::SetFormat


9.142. OEReadMOPACFile 143method.9.142 OEReadMOPACFilebool OEReadMOPACFile ( oemolistream &ifs , OEMolBase &mol )Read the contents of the MOPAC output file into the specified OEMolBase.9.143 OEReadOldBinarybool OEReadOldBinary ( oemolistream &ifs , OEMCMolBase &mol )9.144 OEReadPDBFilebool OEReadPDBFile ( oemolistream &ifs , OEMolBase &mol ,unsigned int flavor = OEPDBIFlag : : DEFAULT )Read a molecule from the specified input stream, ifs, in Brookhaven PDB file format. A number of differentPDB format variants are supported by the use of the bits in the “flavor” parameter. This function returns true if theoperation was successful, and false if an end-of-file was encountered.The OEPDBIFlag::TER, OEPDBIFlag::END and OEPDBIFlag::ENDM flags are used to inform the<strong>OEChem</strong> PDB file reader of the records used to separate consecutive molecules in a single PDB file. The flagscorrespond to the PDB file format’s TER, END and ENDMOD records respectively. If all of these flags are turnedoff, all of the ATOM and HETATM records in a single PDB file will be read into a single OEMolBase. By default,only OEPDBIFlag::END and OEPDBIFlag::ENDM are on (and OEPDBIFlag::TER is off), meaning thatdifferent chains are read into the a single molecule, but different NMR models and concatenated PDB files aretreated as sequential molecules.The OEPDBIFlag::ALL flag is used to indicate that all of the atom records in the input file should be readinto the OEMolBase. By default, the OEReadPDBFile function ignores/omits ATOM and HETATM recordsthat represent pseudo or dummy atoms and/or alternate conformations. Without OEPDBIFlag::ALL, the PDBfile reader ignores all atoms whose alternate location indicator is other than ’ ’, A or 1, all atoms with atomnames begining " Q", all atoms with residue name "DUM", and all atoms with co-ordinates 9999.000, 9999.000,9999.000 (as used by XPLOR/CNS to represent dummy atoms).The OEPDBIFlag::DATA flag is used to instruct the <strong>OEChem</strong> PDB file reader to preserve the PDB file’s headerdata in the OEMolBase’s generic data. This option currently preserves AUTHOR, CAVEAT, COMPND, CRSYT1,EXPDTA, FORMUL, HEADER, HELIX, HET, HETNAM, HETSYM, JRNL, KEYWDS, MODRES, OBSLTE,ORIGX1, ORIGX2, ORIGX3, REMARK, REVDAT, SCALE1, SCALE2, SCALE3, SEQRES, SHEET, SITE,SOURCE, SPRSDE, SSBOND, TITLE and TURN records. Note that modifying or reordering the molecule mayinvalidate the atom serial numbers used in some of the PDB records.The OEPDBIFlag::CHARGE flag is used to indicate that the contents of the b-factor column in the input PDB filecontains a partial charge, and should be stored in the ‘partial charge’ property of an atom, instead of the ‘b-factor’property. This value can then be retrieved using the OEAtomBase::GetPartialCharge method.The OEPDBIFlag::RADIUS flag is used to indicate the the contents of the occupancy column in the input PDBfile contains a radius, and should be stored in the ‘radius’ property of an atom instead of the ‘occupancy’ property.


144 Chapter 9. <strong>OEChem</strong> FunctionsThis value can then be retrieved using the OEAtomBase::GetRadius method.The OEPDBIFlag::DELPHI flag is just the combination of the OEPDBIFlag::CHARGE andOEPDBIFlag::RADIUS flags above.9.145 OEReadSketchFilebool OEReadSketchFile ( oemolistream &ifs , OEMolBase &mol )Read the contents of the MDL ISIS sketch file into the specified OEMolBase.9.146 OEReadXYZFilebool OEReadXYZFile ( oemolistream &ifs , OEMolBase &mol )Read the contents of the XMol XYZ format file into the specified OEMolBase.9.147 OEResidueHydrogensvoid OEResidueHydrogens ( OEMolBase &mol )This function sets the residue information associated with each explicit hydrogen in a molecule, from the residueinformation of its parent.9.148 OERMSD9.148.1 Array-Based OERMSDdouble OERMSD ( const float ∗ref , const float ∗fit , unsigned int size ,bool overlay = false , double ∗rot = 0 , double ∗trans = 0)double OERMSD ( const double ∗ref , const double ∗fit , unsigned int size ,bool overlay = false , double ∗rot = 0 , double ∗trans = 0)Returns the root mean squared deviation between two sets of Cartesian coordinates. The two arrays passed in as refand fit should be of length size*3, and should contain the Cartesian coordinates of the two objects being assesed.The boolean flag overlay indicates whether the RMSD of the two arrays in their current position is desired (false),or whether the lowest possible RMSD for the two arrays should be returned (true). If an overlay calculation iscarried out, the functions can report the rotation and translation required to give this minimum RMSD. An arrayof length nine should be passed to the rot argument and an array of length three should be passed as the transargument.9.148.2 Full Molecule-Based OERMSD


9.149. OERotate 145double OERMSD ( const OEMolBase &ref , const OEMolBase &fit ,bool automorph = true , bool heavyOnly = true ,bool overlay = false , double ∗rot = 0 , double ∗trans = 0)bool OERMSD ( const OEMolBase &ref , const OEMCMolBase &fit , double ∗rmsds ,bool automorph = true , bool heavyOnly = true ,bool overlay = false , double ∗rot = 0 , double ∗trans = 0)Functions to calculate the root mean squared deviation between two molecules. This function is overloaded forcomparisions of an OEMolBase ref molecule with either OEMolBases or OEMCMolBases as fit molecule. Forthe OEMolBase vs OEMolBase comparison, the RMSD is the return value. For the OEMolBase vs OEMCMol-Base case, the RMSDs are returned in the rmsds array. The rmsds array passed to this function should be oflength fit.GetMaxConfIdx() for the OEMolBase vs OEMCMolBase overload. The automorph flag indicateswhether automorphisms should be taken into account during the RMSD calculation. Automorphisms arethe symmetry related transformations of a molecule which can result in anamolously high RMSDs if not properlytreated. For instance, t-butyl-benzene has a three-fold automorphism around the t-butyl group and a two-fold automorphismaround the benzene ring. The heavyOnly flag indicates whether only heavy atoms should be consideredor hydrogen atoms should be considered as well. It is strongly recommended that one should consider carefullybefore setting the automorph flag to true and the heavyOnly flag to false due to the increased computationalcost. The overlay, rot, and trans arguments are identical to those described in the preceeding section.9.148.3 Partial Molecule-Based OERMSDdouble OERMSD ( const OEMolBase &ref , const OEMolBase &fit ,const OEMatchBase &match , bool overlay = false ,double ∗rot = 0 , double ∗trans = 0)bool OERMSD ( const OEMolBase &ref , const OEMCMolBase &fit ,const OEMatchBase &match , bool overlay = false ,double ∗rot = 0 , double ∗trans = 0)These <strong>API</strong> points are quite similar to the previous three. However, rather than considering automorphisms andheavy atoms, these functions allow a programmer to explicity determine which substructure of the two moleculesshould be used to determine the RMSD. The match can be generated by hand, or with any of <strong>OEChem</strong>’s matchingalgorithms. The overlay, rot, and trans arguments are identical to those described in the preceeding section.9.149 OERotatevoid OERotate ( OEMolBase &mol , const double ∗m )void OERotate ( OEMolBase &mol , const float ∗m )void OERotate ( OEConfBaseT &conf , const double ∗m )void OERotate ( OEConfBaseT &conf , const float ∗m )void OERotate ( OEMCMolBaseT &mcmol , const double ∗m )void OERotate ( OEMCMolBaseT &mcmol , const float ∗m )These functions rotate a molecule by the rotation matrix passed as the m argument. The rotation is defined as xyz’= m x xyz, where m is the rotation matrix, xyz is the original vector, and xyz’ is the new vector. The overloads forOEConfBaseT and OECMMolBaseT are for efficiency.9.150 OESameChain


146 Chapter 9. <strong>OEChem</strong> Functionsbool OESameChain ( const OEResidue &res1 , const OEResidue &res2 )This function determines whether two OEResidues are in the same chain. This returns true if both residueshave the same NMR model number, OEResidue::GetModelNumber, and the same chain identifier,OEResidue::GetChainID.9.151 OESameResiduebool OESameResidue ( const OEResidue &res1 , const OEResidue &res2 )This function determines whether two OEResidues represent the same residue. This returns truewhen both residues are in the same chain (see OESameChain), have the same residue number,OEResidue::GetResidueNumber, the same sequence insertion code, OEResidue::GetInsertCode,and the same name, OEResidue::GetName.9.152 OEScrambleMoleculebool OEScrambleMolecule ( OEMolBase &mol )This function randomly reorders the atoms and bonds of a molecule. Like OEMolBase::OrderAtoms andOEMolBase::OrderBonds, this function modifies the order in which atoms and bonds are visited by theiterator returned by OEMolBase::GetAtoms and OEMolBase::GetBonds respectively. This function doesnot affect the atom or bond indices of any of the atoms or bonds of the molecule.9.153 OESet3DHydrogenGeombool OESet3DHydrogenGeom ( OEMolBase &mol )bool OESet3DHydrogenGeom ( OEMolBase &mol , const OEAtomBase ∗hatom ) ;These functions assign approximate 3D co-ordinates to explicit hydrogen atoms. For the first form of this function,that operates on an entire molecule, only explicit hydrogen atoms with identical co-ordinates to their parent atomsare updated. The second form of this function only affects the specified hydrogen atom, which should initiallyhave the same co-ordinates as its ‘parent’.9.154 OESetAtomCommentvoid OESetAtomComment ( OEAtomBase ∗atm , const char ∗c )void OESetAtomComment ( OEAtomBase ∗atm , const std : : string &c )Attaches a text comment to an individual atom. This function is used to manipulate atom alias information in MDLfile formats. This property may be retrieved using the OEGetAtomComment function.9.155 OESetComment


9.156. OESetDimensionFromCoords 147void OESetComment ( OEMolBase &mol , const char ∗c )void OESetComment ( OEMolBase &mol , const std : : string &c )Attaches a text comment to a molecule. This comment will be written to the comment field of the .mol2 and.sdf molecular formats. It will also be conserved in OEBinary format. This property may be retrieved using theOEGetComment function.9.156 OESetDimensionFromCoordsvoid OESetDimensionFromCoords ( OEMolBase &mol )This function assigns the molecule’s dimension property from the co-ordinates of the active conformer using theOEMolBase::SetDimension method. The dimension property is set to the value 0, 1, 2 or 3 depending uponthe number of ordinates for which any atom has a non-zero value.9.157 OESetPackedCoordsvoid OESetPackedCoords ( OEMolBase &mol , const float ∗coords )void OESetPackedCoords ( OEMolBase &mol , const double ∗coords )Sets the coordinates of the molecule to the coordinates passed in the coords argument. The coords array must beat least of size OEMolBase::NumAtoms()*3. The atom coordinates in the coords array should be packed andthey should be in the same order as the atoms in the iterator returned by OEMolBase::GetAtoms().9.158 OESetTorsionbool OESetTorsion ( OEMolBase &,OEAtomBase ∗a ,OEAtomBase ∗b ,OEAtomBase ∗c ,OEAtomBase ∗d ,double radians )bool OESetTorsion ( OEConfBaseT &,OEAtomBase ∗a ,OEAtomBase ∗b ,OEAtomBase ∗c ,OEAtomBase ∗d ,double radians )This function sets torsion angle defined by atoms a, b, c and d to the angle in the argument radians. It is presumedthat each of these atoms are members of the molecules passed to the function. All atoms which are attached to c(excluding b) are rotated. If the bond defined by atoms b and c are in a ring, no change to the torsion will occur.However, an overall rotation of the molecule may be a side effect.9.159 OESingleBondCount


148 Chapter 9. <strong>OEChem</strong> Functionsunsigned int OESingleBondCount ( const OEAtomBase ∗atm )Return the number of single bonds connected to an atom. The return value includes the number of implicit hydrogensattached to an atom, as returned by the OEAtomBase::GetImplicitHCount method.9.160 OESmilesAtomCountunsigned int OESmilesAtomCount ( const std : : string &str )unsigned int OESmilesAtomCount ( const char ∗str )This function efficiently determines the number of explicit atoms in a SMILES string, without converting it intoan OEMolBase.9.161 OESubsetMolbool OESubsetMol ( OEMolBase &dst , const OEMolBase &src ,const OESystem : : OEUnaryPredicate &atomfcn ,const OESystem : : OEUnaryPredicate &bondfcn ,bool adjustHCount=false )bool OESubsetMol ( OEMolBase &dst , const OEMatchBase ∗match ,bool adjustHCount=false )bool OESubsetMol ( OEMCMolBase &dst , const OEMCMolBase &src ,const OESystem : : OEUnaryPredicate &atomfcn ,bool adjustHCount=false )bool OESubsetMol ( OEMCMolBase &dst , const OEMCMolBase &src ,const OESystem : : OEUnaryPredicate &atomfcn ,const OESystem : : OEUnaryPredicate &bondfcn ,bool adjustHCount=false )bool OESubsetMol ( OEMCMolBase &dst , const OEMCMolBase &src ,const OEMatchBase ∗match ,bool adjustHCount=false )bool OESubsetMol ( OEMolBase &dst , const OEMolBase &src ,const OESystem : : OEUnaryPredicate &atomfcn ,bool adjustHCount=false )These functions allows the user to make a fully-functional molecule from a subset of another molecule. Theoriginal molecule may be a multi-conformer molecule, in which case a multi-conformational copy is produced.The basis for selection of atoms and bonds is a predicate function, i.e. a function that will return true or false forany atom or bond. By default bonds are carried along with the selected atoms, i.e. all bonds between such. If abond predicate is also provided then this transfer is controlled by the user. As some atoms in the copy will nowhave ’dangling’ bonds, i.e. ’edge’ atoms, the user can also specify that the hydrogen count be altered to preservethe original hybridization. An alternate mechanism of selection is to provide an OEMatchBase, which itselfcontains a subset of atoms.9.162 OESuppressHydrogens


9.163. OETheFunctionFormerlyKnownAsStripSalts 149bool OESuppressHydrogens ( OEMolBase &mol ,bool retainPolar=false ,bool retainStereo=false ,bool retainIsotope=true )This function transforms the explicit hydrogens in a molecule into implicit hydrogens on their parent heavy atom.Any explicit hydrogen atoms, those with atomic number OEElemNo::H, are deleted and any information associatedwith them, co-ordinates, isotopes, generic data etc... are lost. In their place, the implicit hydrogen count fieldof the heavy atom to which they are bonded is appropriately incremented.If the “retainPolar” flag is true, then hydrogens on polar atoms, i.e. those for whichOEAtomBase::IsPolarHydrogen returns true, are left unaffected. If the “retainStereo” flag is true,then hydrogens required to specify stereo centers, i.e. those for which OEHasStereoHydrogens return true,are left unaffected. Finally, if “retainIsotope” is true, specified isotopes of hydrogen (including deuterium [2H],tritium [3H] and protium [1H]) will be treated as heavy atoms and retained.This function returns the value true if any hydrogens were deleted, and returns false if the molecule was leftunchanged.9.163 OETheFunctionFormerlyKnownAsStripSaltsbool OETheFunctionFormerlyKnownAsStripSalts ( OEMolBase &mol )This function, named StripSalts during the development of <strong>OEChem</strong>, deletes all atoms that are not part of thelargest connected component of a molecule. If two or more components of a molecule are the size of the largestcomponent, this function keeps the first one encountered.9.164 OETranslatevoid OETranslate ( OEMolBase &mol , const double ∗v )void OETranslate ( OEMolBase &mol , const float ∗v )void OETranslate ( OEConfBaseT &conf , const double ∗v )void OETranslate ( OEConfBaseT &conf , const float ∗v )void OETranslate ( OEMCMolBaseT &mcmol , const double ∗v )void OETranslate ( OEMCMolBaseT &mcmol , const float ∗v )Translates the molecule by the vector passed as the argument v. The vector v must be of size three and containsthe Cartesian translation vector. The overloads for OEConfBaseT and OEMCMolBaseT are for efficiency.9.165 OETripleBondCountunsigned int OETripleBondCount ( const OEAtomBase ∗atm )Return the number of triple bonds connected to an atom.9.166 OETriposAtomNames


150 Chapter 9. <strong>OEChem</strong> Functionsvoid OETriposAtomNames ( OEMolBase &mol )The OETriposAtomNames function sets the atom name property of each atom, using theOEAtomBase::SetName method, to follow the convention typically followed in Sybyl .mol2 files. Each atomis named by its atomic symbol (or “Du” for element zero) followed by a sequential index per atomic number. Forexample, the first carbon in the molecule is named “C1”, the second “C2”, and so on. Similarly, the first oxygen isnamed “O1” and so on.The ordering of atoms is taken from the iterator returned by the OEMolBase::GetAtoms method (and maytherefore be changed by using OEMolBase::OrderAtoms) and is unchanged by this function.9.167 OETriposAtomTypeunsigned int OETriposAtomType ( const OEAtomBase ∗atm )This function determines the Tripos Sybyl atom type for the given atom. The result is an unsigned integer indextaken from the OETriposType namespace. The index zero corresponds to OETriposType::Du, i.e. a dummyor unrecognized atom. The atom, including any previously assigned integer atom type, is not modified by thisfunction.This function prefers that aromaticity has previously been assigned using the Tripos model of aromaticity, see theOEAssignAromaticFlags function. However, reasonable atom types are returned when using other modelsof aromaticity.9.168 OETriposAtomTypesbool OETriposAtomTypes ( OEMolBase &mol )This function sets the integer atom type property of every atom in a molecule to its Tripos Sybyl atomtype. The integer atom types are taken from the OETriposType namespace, as determined by theOETriposAtomType function, and each atom is assigned a value using the OEAtomBase::SetIntTypemethod. The OETriposAtomTypes function returns false if any atom was assigned OETriposType::Du,and returns the value true otherwise.This function prefers that aromaticity has previously been assigned using the Tripos model of aromaticity, see theOEAssignAromaticFlags function. However, reasonable atom types are returned when using other modelsof aromaticity.9.169 OETriposAtomTypeNamesbool OETriposAtomTypeNames ( OEMolBase &mol )This function sets the string atom type property of every atom in a molecule to its Tripos Sybyl atom type. Thesymbolic atom types are as determined by OETriposAtomType and the converted from integer index to typename using OETriposTypeName. The string atom type property is set using the OEAtomBase::SetTypemethod. This function returns false if any atom was assigned "Du", and returns the value true otherwise.This function prefers that aromaticity has previously been assigned using the Tripos model of aromaticity, see theOEAssignAromaticFlags function. However, reasonable atom types are returned when using other models


9.170. OETriposBondTypeNames 151of aromaticity.9.170 OETriposBondTypeNamesvoid OETriposBondTypeNames ( OEMolBase &mol )The OETriposBondTypeNames function sets the string bond type property of every bond in a molecule to itsTripos Sybyl bond type. Single, double and triple bonds are assigned the types “1”, “2” and “3” respectively withthe exception of aromatic and amide bonds with are assigned the values “ar” and “am” respectively.This function prefers that aromaticity has previously been assigned using the Tripos model of aromaticity, see theOEAssignAromaticFlags function. However, reasonable atom types are returned when using other modelsof aromaticity.9.171 OETriposTypeElementunsigned int OETriposTypeElement ( unsigned int type )The OETriposTypeElement function returns the atomic number/element represented by the given Tripos atomtype index, as encoded by the OETriposTypes namespace.9.172 OETriposTypeIndexunsigned int OETriposTypeIndex ( const char ∗name )This function returns the integer atom type, as encoded by the OETriposType namespace, that corresponds tothe given Tripos Sybyl atom type string. For example, OETriposType("N.pl3") returns the integer valueOETriposType::Npl3, which currently has the value 22.This function is the inverse of OETriposTypeName.9.173 OETriposTypeNameconst char ∗OETriposTypeName ( unsigned int type )This function returns the symbolic atom type name that corresponds to the given Tripos Sybyl atom type index, asencoded by the OETriposType namespace. For example, OETriposTypeName(OETriposType::Npl3)returns the value "N.pl3".This function is the inverse of OETriposTypeIndex.9.174 OETriposTypeNamesbool OETriposTypeNames ( OEMolBase &mol )


152 Chapter 9. <strong>OEChem</strong> FunctionsThis function loops through the atoms of the molecule, setting the string atom type property of each atom, to atomtype name of the Tripos Sybyl atom type encoded in the atoms integer atom type property. This is approximatelyequivalent to the following operation:atm−>SetType ( OETriposTypeName ( atm−>GetIntType ( ) ) )If both the string and integer atom types are required, it is faster to call OETriposAtomTypes and thenOETriposTypeNames (which reuses the results of the first call) than it is to call OETriposAtomTypesand OETriposAtomTypeNames.9.175 OEWriteCDXFilebool OEWriteCDXFile ( oemolostream &ofs , OEMolBase &mol )Write the given molecule to the output molstream in ChemDraw CDX file format.9.176 OEWriteFASTAFilevoid OEWriteFASTAFile ( oemolostream &ofs , OEMolBase &mol ,const char ∗ident )Write the molecule as a FASTA format protein sequence to the output stream ofs. The ident parameter is usedto specify the sequence identifier to be written before the molecule’s title on for each amino acid sequence.9.177 OEWriteMacroModelFilevoid OEWriteMacroModelFile ( oemolostream &ofs , OEMolBase &mol )void OEWriteMacroModelFile ( oemolostream &ofs , OEMCMolBase &mol )Write the molecule as a MacroModel format file to the output stream ofs.9.178 OEWriteMDLFilevoid OEWriteMDLFile ( oemolostream &ofs , OEMolBase &mol ,unsigned int flavor = OEMDLOFlag : : DEFAULT )Write the molecule as a MDL mol format file to the output stream ofs. A number of different MDL formatvariants are supported by the use of the bits in the “flavor” parameter.The OEMDLOFlag::MCHG flag is used to instruct the MDL mol file writer to write "M CHG" and "M RAD"lines for charged/radical atoms in the output connection table, even if the charge and radical values of every atomare within the ranges representable by the MDL atom block. By default, "M CHG" and "M RAD" lines are onlyused for connection tables that ”overflow” the allowed atom block limits.The OEMDLOFlag::ISO flag is used to instruct the <strong>OEChem</strong> MDL mol file writer to write "M ISO" lines forisotopes in the output connection table, even if the isotopic masses of every atom are within the range representable


9.179. OEWriteMOPACInputFile 153by the MDL atom block. By default, "M ISO" lines are only used for connection tables that ”overflow” theallowed atom block limits.The OEMDLOFlag::RGP flag is used to instruct the <strong>OEChem</strong> MDL mol file writer to write out "M RGP" entriesfor each R-group atom, i.e. atom with element zero and a non-zero atom map index. These atoms are alwayswritten with atomic symbol R#.9.179 OEWriteMOPACInputFilevoid OEWriteMOPACInputFile ( oemolostream &ofs , OEMolBase &mol ,unsigned int flavor = OEMOPACOFlag : : DEFAULT )Write the molecule in MOPAC input file format to the output stream ofs.9.180 OEWriteMol2Filevoid OEWriteMol2File ( oemolostream &ofs , OEMolBase &mol , bool m2h = true )Write the molecule as a Tripos mol2 format file to the output stream ofs. The “m2h” parameter specifies whetherimplicit hydrogens should be written out as explicit hydrogens in the mol2 file. If the value of “m2h” is false, themol2 file writer attempts to suppress writing hydrogens, if the resulting connection table can be read unambiguously.9.181 OEWritePDBFilevoid OEWritePDBFile ( oemolostream &ofs , OEMolBase &mol ,unsigned int flavor = OEPDBOFlag : : DEFAULT )Write the molecule as a Brookhaven PDB format file to the output stream ofs. A number of different PDB formatvariants are supported by use of the bits in the “flavor” parameter.The OEPDBOFlag::BONDS flag is used to control whether the <strong>OEChem</strong> PDB file writer includes CONECTrecords to describe the connectivity of the molecule. If this flag is given without OEPDBOFlag::ORDERS allbonds are written as “single” bonds. OEPDBOFlag::BONDS is off by default.The OEPDBOFlag::ORDERS flag is used to control whether the PDB file writer should use repeated CONECTrecords to represent multiple bond orders (i.e. double and triple bonds). If this flag is given withoutOEPDBOFlag::BONDS only double and triple bonds are written to the file. OEPDBOFlag::ORDERS is offby default.The OEPDBOFlag::BOTH flag is used to control whether CONECT records are written bi-directionally. Conventionally,PDB files list connect records both from source atom to destination atom, and again from destination tosource. This duplication doubles the number/size of CONECT records with redundant information, as most readers(if they honor CONECT records at all) can work with uni-directional CONECT records. By default, <strong>OEChem</strong>’sPDB writer only output uni-directional CONECT records where the source atom’s serial number is always lessthan the destination atom’s. The OEPDBOFlag::BOTH can be used to request full bi-directional PDB files.The OEPDBOFlag::CHARGE flag can be used to instruct the <strong>OEChem</strong> PDB file writer to take the value for thePDB file’s B-factor field from the atom’s partial charge property. A number of applications, including Delphi,


154 Chapter 9. <strong>OEChem</strong> Functions(ab)use the PDB file format specification to store atomic partial charges in the b-factor field rather instead ofcrystallographically determined anisotropic temperature factors. OEPDBOFlag::CHARGE is off by default.The OEPDBOFlag::RADIUS flag can be used to instruct the <strong>OEChem</strong> PDB file writer to take the value forthe PDB file’s occupancy field from the atom’s radius property. A number of applications, including Delphi,(ab)use the PDB file format specification to store radii in the occupancy field rather instead of crystallographicallydetermined anisotropic occupancies. OEPDBOFlag::RADIUS is off by default.The OEPDBOFlag::DELPHI flag is just the combination of the OEPDBOFlag::CHARGE andOEPDBOFlag::RADIUS flags.The OEPDBOFlag::ELEMENT flag instructs the <strong>OEChem</strong> PDB writer to write the chemical symbol rightjustifiedin columns 77-78, as specified by version 2.2 of the PDB format specification. This is a new featureas of <strong>OEChem</strong> 1.3.5. OEPDBOFlag::ELEMENT is on by default.The OEPDBOFlag::FORMALCHARGE flag instructs the <strong>OEChem</strong> pdb writer to write the formal charge rightjustified(e.g. ’2+’, ’2-’) in columns 79-80, as specified by version 2.2 of the PDB format specification. This is anew feature as of <strong>OEChem</strong> 1.3.5. This flag is off by default. Enablingn OEPDBOFlag::FORMALCHARGE alsoenables OEPDBOFlag::ELEMENT.The OEPDBOFlag::TER flag can be used to instruct the <strong>OEChem</strong> PDB file writer to terminate each connectiontable with a TER record rather than an END record. Some dubious molecular graphics software, such as Grasp,requires that multiple compounds be separated by the chain/fragment separator TER, rather than the moleculeseparator END. OEPDBOFlag::TER is off by default.9.182 OEWriteMoleculeunsigned OEWriteMolecule ( oemolostream &ofs , OEMCMolBase &mol )unsigned OEWriteMolecule ( oemolostream &ofs , OEQMolBase &mol )unsigned OEWriteMolecule ( oemolostream &ofs , OEMolBase &mol )unsigned OEWriteMolecule ( oemolostream &ofs , OEMol &mol )unsigned OEWriteMolecule ( oemolostream &ofs , OEQMol &mol )unsigned OEWriteMolecule ( oemolostream &ofs , OEGraphMol &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEMCMolBase &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEQMolBase &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEMolBase &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEMol &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEQMol &mol )unsigned OEWriteConstMolecule ( oemolostream &ofs , const OEGraphMol &mol )The <strong>OEChem</strong> OEWriteMolecule function provides a high-level file format writer, for multiple file formats.This function is build on top of <strong>OEChem</strong>’s low-level file format writers, but unlike them, it may modify themolecule by automatically invoking the appropriate perception routines (aromaticity, atom typing, chirality perception,residue perception, etc...) that are required by the selected file format. This greatly simplifies the task ofwriting molecules to a stream, but may provide less functionality than calling the lower-level functions directly.This function writes the molecule specified by mol, to the output molstream ofs. This function is synonymouswith the


9.183. OEWriteXYZFile 155All of the overloads of the OEWriteMolecule and OEWriteConstMolecule functions return anerror code from the OEWriteMolReturnCode namespace (vida infra). A return code of 0 orOEWriteMolReturnCode::Success indicates the write had no problems. The most common write problemis that the molecule may have too many atoms for the file format (e.g. >999 atoms in .sdf).Additionally, the OEWriteMolecule function provides some level of control over the processing appliedto a molecule prior to writing using <strong>OEChem</strong>’s file format flavor mechanism. Each output moleculestream maintains an independent “flavor” value for each output file format that can be specified byoemolstreambase::SetFormat. These “flavors” are unsigned integer values that are the combination ofbit patterns specified by the OEOFlavor namespace. The interpretation of each bit in a flavor depends upon theoutput file format to which it refers, and enables or disables processing associated with writing that output fileformat.9.183 OEWriteXYZFilevoid OEWriteXYZFile ( oemolostream &ofs , const OEMolBase &mol )Write the molecule as an XMol XYZ format file to the output stream ofs.


CHAPTERTEN<strong>OEChem</strong> FunctorsFunctors are C++ equivalents of function pointers in C. However, functors can also maintain state, be copied,created and destroyed. For details, please see the <strong>OEChem</strong> C++ theory manual. All of the functors here are derivedfrom template class OESystem::OEUnaryPredicate or template class OESystem::OEBinaryPredicate.All of the functors will have a virtual bool operator() const function which takes an argument oftype const Arg&, where Arg is the template argument. Many of the functors also have a constructor whichgenerates the state critical to the evaluation of their operator().All functors also contain the following function which will be covered once here and not duplicated in each section.OESystem : : OEUnaryFunction ∗CreateCopy ( )constCreateCopy is a virtual constructor. It returns a copy of the functor itself with its correct internal state. Thisfunction allows a user to copy functors even if they only have a pointer or reference to the base class.10.1 OEAtomIsInResiduestruct OEAtomIsInResidue : publicOESystem : : OEUnaryPredicateFunctor which identifies whether an atom is in a given residue or not.10.1.1 ConstructorOEAtomIsInResidue ( const OEResidue &r )Constructs the functor with r as the internally specified residue.10.1.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if the atom is in the residue specified as the construction argument. This is the same as the value returnedby OESameResidue(res,OEAtomGetResidue(&atom)), where res is the functor’s contruction156


10.2. OEAtomIsInRing 157argument.10.2 OEAtomIsInRingstruct OEAtomIsInRing : publicOESystem : : OEUnaryPredicateFunctor which identifies ring atoms.10.2.1 ConstructorOEAtomIsInRing ( )Default constructor.10.2.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsInRing() returns true.10.3 OEBondIsInRingstruct OEBondIsInRing : publicOESystem : : OEUnaryPredicateFunctor which identifies ring bonds.10.3.1 ConstructorOEBondIsInRing ( )Default constructor.10.3.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.IsInRing() returns true.10.4 OEGetNbrAtomstruct OEGetNbrAtom : publicOESystem : : OEUnaryFunction


158 Chapter 10. <strong>OEChem</strong> FunctorsFunctor which, when constructoed with one atom and passed a bond, will return the neighbor atom which is accrossthe bond from the construction atom.10.4.1 ConstructorOEGetNbrAtom ( const OEAtomBase ∗atom )Constructs the functor with atom as the reference atom used to find neighbors.10.4.2 operator()OEAtomBase ∗operator ( )( const OEBondBase ∗bond ) constReturns the OEAtomBase* returned by bond->GetNbr(atom) where atom is the contruction argument.10.5 OEHasAlphaBetaUnsatstruct OEHasAlphaBetaUnsat : publicOESystem : : OEUnaryPredicateFunctor which identifies atoms which have alph-beta unsaturation.10.5.1 ConstructorOEHasAlphaBetaUnsat ( bool includePandS = true )Constructs the functor with the boolean flag to determine whether phosphorus and sulfur atoms are included aspotential beta atoms.10.5.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.HasAlphaBetaUnsat(includePandS) returns true, where includePandS is theconstruction argument.10.6 OEHasAtomicNumstruct OEHasAtomicNum : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom’s atomic number matches the functor’s state.10.6.1 Constructor


10.7. OEHasAtomIdx 159OEHasAtomicNum ( unsigned int an )Constructs the functor with the internal atomic number equal to an.10.6.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.GetAtomicNum() is equivalent to the functor’s name state.10.7 OEHasAtomIdxtypedef OEHasIdx OEHasAtomIdx ;This OEAtomBase functor is a template specialization of the generic OEHasIdx functor. This functor has thestate of a particular atom index and returns true if the OEAtomBase::GetIdx method of an atom returns thesame value.10.7.1 ConstructorOEHasAtomIdx ( unsigned int idx )Constructs the OEHasAtomIdx with the atom index value for which it will return true.10.7.2 operator()bool operator ( )( const OEAtomBase &atm ) constReturns true if the specified atom has an index equal to the constructed value.10.8 OEHasAtomNamestruct OEHasAtomName : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom name matches the functor’s state.10.8.1 ConstructorOEHasAtomName ( const char ∗name )Constructs the functor with the internal name equal to name.10.8.2 operator()


160 Chapter 10. <strong>OEChem</strong> Functorsbool operator ( )( const OEAtomBase &atom ) constReturns true if atom.GetName() is equivalent to the functor’s name state.10.9 OEHasAtomStereoSpecifiedstruct OEHasAtomStereoSpecified : publicOESystem : : OEUnaryPredicateFunctor which identifies atoms which have stereo specified.10.9.1 ConstructorOEHasAtomStereoSpecified ( unsigned int v = OEAtomStereo : : All )Constructs the functor so that atoms with stereo type v will be identified. The default argument specifies that anyatom with stereo specified will be identified.10.9.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.HasStereoSpecifed(value) returns true, where value is the functors constructionargument.10.10 OEHasBondIdxtypedef OEHasIdx OEHasBondIdx ;This OEBondBase functor is a template specialization of the generic OEHasIdx functor. This functor has thestate of a particular bond index and returns true if the OEBondBase::GetIdx method of a bond returns thesame value.10.10.1 ConstructorOEHasBondIdx ( unsigned int idx )Constructs the OEHasBondIdx with the bond index value for which it will return true.10.10.2 operator()bool operator ( )( const OEBondBase &bnd ) const


10.11. OEHasBondStereoSpecified 161Returns true if the specified bond has an index equal to the constructed value.10.11 OEHasBondStereoSpecifiedstruct OEHasBondStereoSpecified : publicOESystem : : OEUnaryPredicateFunctor which identifies bonds which have specified stereo.10.11.1 ConstructorOEHasBondStereoSpecified ( unsigned int v = OEBondStereo : : All )Constructs the functor with the stereo type of interest. The defualt constructor will generate a functor which willidentify any bond with stereo specified.10.11.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.HasStereoSpecified(value) returns true, where value is the constructor argument.10.12 OEHasChainIDstruct OEHasChainID : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom chain ID matches the functor’s state.10.12.1 ConstructorOEHasChainID ( const char id )Constructs the functor with the specified chain id.10.12.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if OEAtomGetResidue(&atom).GetChainID() is equivalent to the functor’s chain identifierstate.10.13 OEHasConfIdx


162 Chapter 10. <strong>OEChem</strong> Functorstypedef OEHasIdx OEHasConfIdx ;This OEConfBase functor is a template specialization of the generic OEHasIdx functor. This functor has thestate of a particular conformer index and returns true if the OEConfBase::GetIdx method of a conformerreturns the same value.10.13.1 ConstructorOEHasConfIdx ( unsigned int idx )Constructs the OEHasConfIdx with the conformer index value for which it will return true.10.13.2 operator()bool operator ( )( const OEConfBase &conf ) constReturns true if the specified conformer has an index equal to the constructed value.10.14 OEHasFragmentNumberstruct OEHasFragmentNumber : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom’s fragment number matches the functor’s state.10.14.1 ConstructorOEHasFragmentNumber ( unsigned int num )Constructs the functor with the internal number equal to num.10.14.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if OEAtomGetResidue(&atom).GetFragmentNumber() is equivalent to the functor’s namestate.10.15 OEHasIdxtemplatestruct OEHasIdx : public OESystem : : OEUnaryPredicateFunctor which has the state of a particular index and returns true if the GetIdx member function of the argumentreturns the same index.


10.16. OEHasMapIdx 163For specializations of the OEHasIdx functor template for common uses, see the functors OEHasAtomIdx,OEHasBondIdx and OEHasConfIdx.10.15.1 ConstructorOEHasIdx ( unsigned int idx )Constructs the OEHasIdx with the value for which it will return true.10.15.2 operator()bool operator ( )( const Arg &arg ) constReturns true if the function Arg.GetIdx() is equivalent to the constructed value.10.16 OEHasMapIdxstruct OEHasMapIdx : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom has any or a specific map index depending on the functor’s state.10.16.1 ConstructorOEHasMapIdx ( unsigned int idx = 0)With no arguments, this constructs a functor which returns true for any atom with a non-zero map index. Whenconstructed with a non-zero integer, it constructs a functor which return true for atoms which have the same mapindex as the constructor argument.10.16.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.GetMapIdx() is the same as the functor’s constructed argument. If the constructionargument was 0, it will return true for an atom if atom.GetMaxIdx() returns any non-zero value.10.17 OEHasOrderstruct OEHasOrder : publicOESystem : : OEUnaryPredicateFunctor which identifes bonds in a molecule which have a particular order.10.17.1 Constructor


164 Chapter 10. <strong>OEChem</strong> FunctorsOEHasOrder ( unsigned int bo )Constructs the functor with the internal bond order of bo.10.17.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.GetOrder() returns the same value as the constructor argument.10.18 OEHasResidueNumberstruct OEHasResidueNumber : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom residue number matches the functor’s state.10.18.1 ConstructorOEHasResidueNumber ( unsigned int num )Constructs the functor with the internal number equal to num.10.18.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if OEAtomGetResidue(&atom).GetResidueNumber() is equivalent to the functor’s namestate.10.19 OEIsAromaticAtomstruct OEIsAromaticAtom : publicOESystem : : OEUnaryPredicateFunctor which identifies aromatic atoms.10.19.1 ConstructorOEIsAromaticAtom ( )Default constructor.10.19.2 operator()


10.20. OEIsAromaticBond 165bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsAromatic() returns true.10.20 OEIsAromaticBondstruct OEIsAromaticBond : publicOESystem : : OEUnaryPredicateFunctor which identifies aromatic bonds.10.20.1 ConstructorOEIsAromaticBond ( )Default constructor.10.20.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.IsAromatic() returns true.10.21 OEIsCAlphastruct OEIsCAlpha : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is a alpha carbon or a peptide.10.21.1 ConstructorOEIsCAlpha ( )Default constructor.10.21.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsCarbon() &&OEHasResidue(&atom) is true and atom.GetName() is " CA".10.22 OEIsCarbon


166 Chapter 10. <strong>OEChem</strong> Functorsstruct OEIsCarbon : publicOESystem : : OEUnaryPredicateFunctor which identifies carbon atoms.10.22.1 ConstructorOEIsCarbon ( )Default constructor.10.22.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsCarbon() returns true.10.23 OEIsChiralAtomstruct OEIsChiralAtom : publicOESystem : : OEUnaryPredicateFunctor which identifies chiral atoms.10.23.1 ConstructorOEIsChiralAtom ( )Default constructor.10.23.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsChiral() returns true.10.24 OEIsChiralBondstruct OEIsChiralBond : publicOESystem : : OEUnaryPredicateFunctor which identifies chiral bonds.10.24.1 ConstructorOEIsChiralBond ( )


10.25. OEIsHalogen 167Default constructor.10.24.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.IsChiral() returns true.10.25 OEIsHalogenstruct OEIsHalogen : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is a halogen.10.25.1 ConstructorOEIsHalogen ( )Default constructor.10.25.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsHalogen() returns true.10.26 OEIsHeavystruct OEIsHeavy : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is a heavy atom.10.26.1 ConstructorOEIsHeavy ( )Default constructor.10.26.2 operator()bool operator ( )( const OEAtomBase &atom ) const


168 Chapter 10. <strong>OEChem</strong> FunctorsReturns true if atom.IsHydrogen() returns false.10.27 OEIsHydrogenstruct OEIsHydrogen : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is a hydrogen.10.27.1 ConstructorOEIsHydrogen ( )Default constructor.10.27.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsHydrogen() returns true.10.28 OEIsMembertemplatestruct OEIsMember : public OESystem : : OEUnaryPredicateFunctor which identifies all of the objects which are in an stl container. Despite the deep magic or the multipletypedefs in this object, it is very easy to use and practically useful.10.28.1 ConstructorsOEIsMember ( std : : vector &container )OEIsMember ( std : : list &container )OEIsMember ( std : : deque &container )Constructs the functor using an STL container of type C, which contains objects or pointers to objects. Any of theelements of the STL container will be considered to be “a member” of the functor.template OEIsMember ( T bgn , T end )Constructs the functor using a sequence of values. The values from bgn up to but not including end are used toconstruct the functor. Using this constructor, the functor may be constructed from arrays and STL containers.OEIsMember ( OESystem : : OEIter &i )Constructs the functor using an iterator over values of the same type as the functor template argument.10.28.2 operator()


10.29. OEIsMemberPtr 169bool operator ( )( const C &arg ) constReturns true if the object arg (or a pointer to arg) is contained in the STL container passed to the functor onconstruction.10.29 OEIsMemberPtrtemplatestruct OEIsMemberPtr : public OESystem : : OEUnaryPredicateFunctor which performs set membership tests. This functor differs from OEIsMember in that the internal storagetype differs from the test type. While instances of abstract classes cannot be easily stored, however, pointers toabstract class instances do not pose the same storage problems. OEIsMemberFunctor stores pointers to datatypes, while the template type of the class is a singly dereferenced version of the storage type.10.29.1 Constructorstemplate OEIsMemberPtr ( T bgn , T end )Constructs the functor using a sequence of values. The values from bgn up to, but not including end are used toconstruct the functor. Using this constructor, the functor may be constructed from arrays and STL containers.OEIsMemberPtr ( OESystem : : OEIter &iter )Constructs the functor using an iterator over values of the same type as the functor template argument. Addressesinstead of instances or references to the data are stored internally.10.29.2 operator()bool operator ( ) ( const C &arg ) constReturns true if a pointer to the object arg is contained in the functor.10.29.3 CreateCopy()OESystem : : OEUnaryPredicate ∗CreateCopy ( )constDeep copy constructor. Returns a copy of the OEIsMemberPtr calling instance. The memory occupied by thereturned copy is now owned by the caller. The delete operator of the returned copy must be called to prevent amemory leak.10.30 OEIsNitrogenstruct OEIsNitrogen : publicOESystem : : OEUnaryPredicate


170 Chapter 10. <strong>OEChem</strong> FunctorsFunctor which returns true if the atom is a nitrogen10.30.1 ConstructorOEIsNitrogen ( )Default constructor.10.30.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsNitroge() return true.10.31 OEIsOxygenstruct OEIsOxygen : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is an oxygen.10.31.1 ConstructorOEIsOxygen ( )Default constructor.10.31.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsOxygen() returns true.10.32 OEIsPhosphorusstruct OEIsPhosphorus : publicOESystem : : OEUnaryPredicateFunctor which identified phosphorus atoms.10.32.1 ConstructorOEIsPhosphorus ( )


10.33. OEIsPolar 171Default constructor.10.32.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsPhosphorus() returns true.10.33 OEIsPolarstruct OEIsPolar : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is non-carbon.10.33.1 ConstructorOEIsPolar ( )Default constructor.10.33.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsPolar() returns true.10.34 OEIsPolarHydrogenstruct OEIsPolarHydrogen : publicOESystem : : OEUnaryPredicateFunctor which identifies polar hydrogens.10.34.1 ConstructorOEIsPolarHydrogen ( )Default constructor.10.34.2 operator()bool operator ( )( const OEAtomBase &atom ) const


172 Chapter 10. <strong>OEChem</strong> FunctorsReturns true if atom.IsPolarHydrogen() return true.10.35 OEIsRGroupstruct OEIsRGroup : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom represents any or a specific R-group.10.35.1 ConstructorOEIsRGroup ( unsigned int idx = 0)Constructs the functor with the internal R-group index equal to idx. idx has a default argument of 0 whichindicates that any R-group index should match.10.35.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.GetAtomicNum() ==0 and atom.GetMapIdx() is equal to the functor’s idx state,or if the functor was constructed with idx = 0, that atom.GetMapIdx() != 0.10.36 OEIsRotorstruct OEIsRotor : publicOESystem : : OEUnaryPredicateFunctor which bonds which are rotors. Single bonds that are not in rings are considered rotors.10.36.1 ConstructorOEIsRotor ( )Default constructor.10.36.2 operator()bool operator ( )( const OEBondBase &atom ) constReturns true if bond.IsRotor() returns true.10.37 OEIsSulfur


10.38. OEMatchFunc 173struct OEIsSulfur : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is a sulfur.10.37.1 ConstructorOEIsSulfur ( )Default constructor.10.37.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if atom.IsSulfur() return true.10.38 OEMatchFunctemplatestruct OEMatchFunc : public OESystem : : OEUnaryPredicateFunctor which returns true if the atom matches the substructure pattern specified in construction.10.38.1 ConstructorOEMatchFunc ( const char ∗smarts )Constructs the functor with the internal substructure search specified by the smart pattern.10.38.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if the atom is matched by the SMARTS pattern defined in construction.10.38.3 typedefsThree typedefs of OEMatchFunc are provided and their use is preferred.typedef OEMatchFunc OEMatchGraphMol ;typedef OEMatchFunc OEMatchMolBase ;typedef OEMatchFunc OEMatchAtomBase ;10.39 OENthAtom


174 Chapter 10. <strong>OEChem</strong> Functorsstruct OENthAtom : publicOESystem : : OEUnaryPredicateFunctor which returns true if the atom is the Nth atom in the molecule.10.39.1 ConstructorOENthAtom ( unsigned int n , unsigned int start )Constructs the functor with the Nth atom specified by n and the starting atom specified by start.10.39.2 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if iteration over the atoms in the molecule makes the atom the Nth atom in the molecule starting withthe first atom being the start atom.10.40 OEPartPredstruct OEPartPred : publicOESystem : : OEUnaryPredicateFunctor which holds multiple parts of a molecule, and can identify different parts based on the state of the functor.10.40.1 ConstructorOEPartPred ( unsigned int ∗parts , unsigned int size )Constructs the functor where the parts are specifeid by itegers in the integer array passed in as parts, and thenumber of parts is specified by size. The parts array is assumed to be of length mol.GetMaxAtomIdx(),where parts[atom->GetIdx()] is the integer associated with the part to which atom belongs.10.40.2 SelectPartvoid SelectPart ( unsigned int part )Sets the state of the functor to identify atoms from only the part specified by the part argument.10.40.3 operator()bool operator ( )( const OEAtomBase &atom ) constReturns true if parts[atom.GetIdx()] == part, where parts is the array passed on construction, and partis the argument used in SelectPart().


CHAPTERELEVEN<strong>OEChem</strong> Constants11.1 OEAroModel Constantsextern "C" OEAroModel OEAroModelDaylightextern "C" OEAroModel OEAroModelOpenEyeextern "C" OEAroModel OEAroModelTriposextern "C" OEAroModel OEAroModelMMFFextern "C" OEAroModel OEAroModelMDL<strong>OEChem</strong> contains five pre-defined models of aromaticity, which represent the OpenEye, Daylight, Tripos, MDLand MMFF definitions. Each aromaticity model is actually an array indexed by aromatic atom type indicatingwhether that atom type is not aromatic (i.e. has the value OENotAromatic), or specifies the numberof pi-electrons it donates to an aromatic ring system, zero, one or two. The indices into this array are specifiedby OEAroType namespace. These constants are typically provided as the model parameter to <strong>OEChem</strong>’sOEAssignAromaticFlags function.175


CHAPTERTWELVE<strong>OEChem</strong> Template Functions12.1 OECalcInertialTensortemplatestatic void OECalcInertialTensor ( double ∗mat , const T ∗c , unsigned int size )12.2 OESetCoordsToInertialFrametemplatestatic void OESetCoordsToInertialFrame ( T ∗c , unsigned int size )176


CHAPTERTHIRTEEN<strong>OEChem</strong> Namespaces13.1 OEAroTypeThe OEAroType namespace defines the indices into the OEAroModel array that specifies whether a particularatom type is not aromatic (i.e. has the value OENotAromatic) or the number of pi-electrons that it contributesto an aromatic ring system, zero, one or two.namespace OEAroType{const unsigned char Undefined = 0 ;const unsigned char C = 1 ;const unsigned char C_Exo = 2 ;const unsigned char C_EnegExo = 3 ;const unsigned char C2_Minus = 4 ;const unsigned char C3_Minus = 5 ;const unsigned char C2_Plus = 6 ;const unsigned char C3_Plus = 7 ;const unsigned char N_Pyridine = 8 ;const unsigned char N_Pyrole = 9 ;const unsigned char N_Oxide = 1 0 ;const unsigned char N_Oxide_Plus = 1 1 ;const unsigned char N_Minus = 1 2 ;const unsigned char N_Plus = 1 3 ;const unsigned char O = 1 4 ;const unsigned char O_Plus = 1 5 ;const unsigned char S = 1 6 ;const unsigned char S_Plus = 1 7 ;const unsigned char S_Oxide_Plus = 1 8 ;const unsigned char P_Pyridine = 1 9 ;const unsigned char P_Pyrole = 2 0 ;const unsigned char P_Oxide = 2 1 ;const unsigned char P_Oxide_Plus = 2 2 ;const unsigned char P_Minus = 2 3 ;const unsigned char P_Plus = 2 4 ;const unsigned char Si = 2 5 ;const unsigned char Se = 2 6 ;const unsigned char Se_Plus = 2 7 ;const unsigned char Te = 2 8 ;const unsigned char Te_Plus = 2 9 ;const unsigned char As = 3 0 ;const unsigned char MAXTYPE = 3 1 ;}177


178 Chapter 13. <strong>OEChem</strong> Namespaces13.2 OECountsnamespace OECounts{const unsigned int Undefined = 0 ;const unsigned int Atoms = 1 ;const unsigned int Bonds = 2 ;const unsigned int Conformers = 3 ;const unsigned int Poses = 4 ;}13.3 OEElemNoThe OEElemNo namespace is used to encode symbolic constants for the atomic numbers of the elements. Currentlythe first 109 elements are represented by their atomic symbols encoding the unsigned int value of theiratomic number, i.e. OEElemNo::C has the value 6, OEElemNo::O the value 8 and OEElemNo::H the value1.namespace OEElemNo{const unsigned int H = 1 ;const unsigned int He = 2 ;const unsigned int Li = 3 ;const unsigned int Be = 4 ;const unsigned int B = 5 ;const unsigned int C = 6 ;const unsigned int N = 7 ;const unsigned int O = 8 ;const unsigned int F = 9 ;const unsigned int Ne = 1 0 ;const unsigned int Na = 1 1 ;const unsigned int Mg = 1 2 ;const unsigned int Al = 1 3 ;const unsigned int Si = 1 4 ;const unsigned int P = 1 5 ;const unsigned int S = 1 6 ;const unsigned int Cl = 1 7 ;const unsigned int Ar = 1 8 ;const unsigned int K = 1 9 ;const unsigned int Ca = 2 0 ;const unsigned int Sc = 2 1 ;const unsigned int Ti = 2 2 ;const unsigned int V = 2 3 ;const unsigned int Cr = 2 4 ;const unsigned int Mn = 2 5 ;const unsigned int Fe = 2 6 ;const unsigned int Co = 2 7 ;const unsigned int Ni = 2 8 ;const unsigned int Cu = 2 9 ;const unsigned int Zn = 3 0 ;const unsigned int Ga = 3 1 ;const unsigned int Ge = 3 2 ;const unsigned int As = 3 3 ;const unsigned int Se = 3 4 ;const unsigned int Br = 3 5 ;const unsigned int Kr = 3 6 ;const unsigned int Rb = 3 7 ;const unsigned int Sr = 3 8 ;const unsigned int Y = 3 9 ;const unsigned int Zr = 4 0 ;


13.3. OEElemNo 179const unsigned int Nb = 4 1 ;const unsigned int Mo = 4 2 ;const unsigned int Tc = 4 3 ;const unsigned int Ru = 4 4 ;const unsigned int Rh = 4 5 ;const unsigned int Pd = 4 6 ;const unsigned int Ag = 4 7 ;const unsigned int Cd = 4 8 ;const unsigned int In = 4 9 ;const unsigned int Sn = 5 0 ;const unsigned int Sb = 5 1 ;const unsigned int Te = 5 2 ;const unsigned int I = 5 3 ;const unsigned int Xe = 5 4 ;const unsigned int Cs = 5 5 ;const unsigned int Ba = 5 6 ;const unsigned int La = 5 7 ;const unsigned int Ce = 5 8 ;const unsigned int Pr = 5 9 ;const unsigned int Nd = 6 0 ;const unsigned int Pm = 6 1 ;const unsigned int Sm = 6 2 ;const unsigned int Eu = 6 3 ;const unsigned int Gd = 6 4 ;const unsigned int Tb = 6 5 ;const unsigned int Dy = 6 6 ;const unsigned int Ho = 6 7 ;const unsigned int Er = 6 8 ;const unsigned int Tm = 6 9 ;const unsigned int Yb = 7 0 ;const unsigned int Lu = 7 1 ;const unsigned int Hf = 7 2 ;const unsigned int Ta = 7 3 ;const unsigned int W = 7 4 ;const unsigned int Re = 7 5 ;const unsigned int Os = 7 6 ;const unsigned int Ir = 7 7 ;const unsigned int Pt = 7 8 ;const unsigned int Au = 7 9 ;const unsigned int Hg = 8 0 ;const unsigned int Tl = 8 1 ;const unsigned int Pb = 8 2 ;const unsigned int Bi = 8 3 ;const unsigned int Po = 8 4 ;const unsigned int At = 8 5 ;const unsigned int Rn = 8 6 ;const unsigned int Fr = 8 7 ;const unsigned int Ra = 8 8 ;const unsigned int Ac = 8 9 ;const unsigned int Th = 9 0 ;const unsigned int Pa = 9 1 ;const unsigned int U = 9 2 ;const unsigned int Np = 9 3 ;const unsigned int Pu = 9 4 ;const unsigned int Am = 9 5 ;const unsigned int Cm = 9 6 ;const unsigned int Bk = 9 7 ;const unsigned int Cf = 9 8 ;const unsigned int Es = 9 9 ;const unsigned int Fm = 1 00;const unsigned int Md = 1 01;const unsigned int No = 1 02;const unsigned int Lr = 1 03;const unsigned int Rf = 1 04;const unsigned int Db = 1 05;


180 Chapter 13. <strong>OEChem</strong> Namespaces}const unsigned int Sg = 1 06;const unsigned int Bh = 1 07;const unsigned int Hs = 1 08;const unsigned int Mt = 1 09;const unsigned int MAXELEM = 1 10;const unsigned int Du = 0 ;const unsigned int Lp = 0 ;const unsigned int Xx = 0 ;const unsigned int D = 1 ;const unsigned int T = 1 ;13.4 OEExprOptsThe OEExprOpts namespace contains expression options that are to be passed to theOEQMolBase::BuildExpressions (Section 8.38.3) method. Expression options control how matchingexpressions are built based on the atom and bond data present in the query molecule at the point when theOEQMolBase::BuildExpressions method is called.namespace OEExprOpts{const unsigned int Mass = 0x1 ;const unsigned int HCount = 0x2 ;const unsigned int ImplicitHCount = 0x4 ;const unsigned int FormalCharge = 0x8 ;const unsigned int StrictFormalCharge = 0x10 ;const unsigned int Degree = 0x20 ;const unsigned int ExplicitDegree = 0x40 ;const unsigned int Valence = 0x80 ;const unsigned int Hybridization = 0x100 ;const unsigned int AtomicNumber = 0x200 ;const unsigned int EqMetal = 0x400 ;const unsigned int EqHalogen = 0x800 ;const unsigned int EqON = 0x1000 ;const unsigned int EqONS = 0x2000 ;const unsigned int EqPS = 0x4000 ;const unsigned int EqAromatic = 0x8000 ;const unsigned int EqCHalogen = 0x10000 ;const unsigned int EqCAliphaticONS = 0x20000 ;const unsigned int EqCPSAcidRoot = 0x40000 ;const unsigned int EqKetoneSulfoneRoot = 0x80000 ;const unsigned int BondOrder = 0x1 ;const unsigned int EqSingleDouble = 0x2 ;const unsigned int EqDoubleTriple = 0x4 ;const unsigned int EqNotAromatic = 0x100000 ;const unsigned int Aromaticity = 0x200000 ;const unsigned int RingMember = 0x400000 ;const unsigned int Chiral = 0x800000 ;const unsigned int Stereo = 0x800000 ;const unsigned int IntType = 0x1000000 ;const unsigned int StringType = 0x2000000 ;const unsigned int DefaultAtoms = AtomicNumber | Aromaticity | FormalCharge ;const unsigned int DefaultBonds = BondOrder | Aromaticity ;const unsigned int ExactAtoms = AtomicNumber | Aromaticity |StrictFormalCharge | Degree | HCount |Chiral | Mass | RingMember ;


13.4. OEExprOpts 181}const unsigned int ExactBonds = BondOrder | Aromaticity | RingMember | Stereo ;const unsigned int AutomorphAtoms = AtomicNumber | Aromaticity |Degree | Chiral | HCount ;const unsigned int AutomorphBonds = Aromaticity ;13.4.1 MassIsotopic mass flag. When set, the values returned by the OEAtomBase::GetIsotope method of the queryatom and potential graph match will be tested for equivalence.13.4.2 HCountHydrogen count flag. When set, the values returned by the OEAtomBase::GetTotalHCount method of thequery atom and potential graph match will be tested for equivalence. The OEAtomBase::GetTotalHCountmethod returns the sum of implicit and explicit hydrogens. The expression built when the HCount flag is set willtherefore not discriminate between implicit and explicit hydrogen counts.13.4.3 ImplicitHCountImplicit hydrogen count flag. When set, the values returned by the OEAtomBase::GetImplicitHCountmethod of the query atom and potential graph match will be tested for equivalence.13.4.4 FormalChargeFormal charge flag. When set, the values returned by the OEAtomBase::GetFormalCharge method of thequery atom and potential graph match will be tested for equivalence, if the formal charge on the query atom isnon-zero. If the formal charge of the query atom is zero no test will be performed.13.4.5 StrictFormalChargeStrict formal charge flag. When set, the values returned by the OEAtomBase::GetFormalCharge method ofthe query atom and potential graph match will be tested for equivalence. The formal charges must be equivalenteven if the formal charge of the query atom is zero.13.4.6 DegreeDegree flag. When set, the values returned by the OEAtomBase::GetDegree method of the query atom andpotential graph match will be tested for equivalence. The OEAtomBase::GetDegree method returns the totaldegree including the contribution from implicit hydrogens.


182 Chapter 13. <strong>OEChem</strong> Namespaces13.4.7 ExplicitDegreeExplicit degree flag. When set, the values returned by the OEAtomBase::GetHvyDegree method of the queryatom and potential graph match will be tested for equivalence. The values compared will therefore be only thenon-hydrogen degrees of the potentially corresponding atoms.13.4.8 ValenceValence flag. When set, the values returned by the OEAtomBase::GetValence method of the query atom andpotential graph match will be tested for equivalence. The OEAtomBase::GetValence method includes thevalence contribution from implicit hydrogens, therefore, the expression test may return successfully even when theexplicit valence of two corresponding atoms differ.13.4.9 HybridizationHybridization flag. When set, the values returned by the OEAtomBase::GetHyb method of the query atom andpotential graph match will be tested for equivalence. Hybridization values must be assigned on the query moleculebefore the call to BuildExpressions, and before an attempted graph match on the molecule to be compared.13.4.10 AtomicNumberAtomic number flag. When set, the values returned by the OEAtomBase::GetAtomicNum method of the queryatom and a potential match atom will be tested for equivalence.13.4.11 EqMetalMetal equivalence flag. When set, the classification of either metal or non-metal based on the return value ofthe OEAtomBase::GetAtomicNum method of the query atom and a potential match atom will be tested forequivalence.13.4.12 EqHalogenHalogen equivalence flag. When set, the classification of either halide (Florine, Chlorine, Bromine, and Iodine) ornon-halide based on the return value of the OEAtomBase::GetAtomicNum method of the query atom and apotential match atom will be tested for equivalence.


13.4. OEExprOpts 18313.4.13 EqONOxygen nitrogen equivalence flag. When set, query atoms which are oxygen or nitrogen based on the return valueof the OEAtomBase::GetAtomicNum method are equivalent to a potential match atom which is oxygen ornitrogen.13.4.14 EqONSOxygen-nitrogen-sulfur equivalence flag. When set, query atoms which are oxygen, nitrogen, or sulfur based onthe return value of the OEAtomBase::GetAtomicNum method are equivalent to a potential match atom whichis also either oxygen, nitrogen, or sulfur.13.4.15 EqPSPhosphorus-sulfur equivalence flag. When set, query atoms which are phosphorus or sulfur based on the returnvalue of the OEAtomBase::GetAtomicNum method are equivalent to a potential match atom which is alsoeither phosphorus or sulfur.13.4.16 EqAromaticAromatic equivalence flag. When set, the classification of either aromatic or non-aromatic based on the returnvalue of the OEAtomBase::IsAromatic method of the query atom and a potential match atom will be testedfor equivalence.13.4.17 EqCHalogenOxygen nitrogen equivalence flag. When set, query atoms which are carbon based on the return value of theOEAtomBase::GetAtomicNum method are equivalent to a potential match atom which is a halogen.13.4.18 EqCAliphaticONSOxygen nitrogen sulfur equivalence flag. When set, query atoms which are oxygen, nitrogen, or sulfur based on thereturn value of the OEAtomBase::GetAtomicNum method and are not aromatic based on the return value ofthe OEAtomBase::IsAromatic method are equivalent to a potential match atom which is also either oxygen,nitrogen, or sulfur and not aromatic.


184 Chapter 13. <strong>OEChem</strong> Namespaces13.4.19 EqCPSAcidRootCarbon phosphorus sulfur acid root atom equivalence flag. When set, query atoms which are the central atom of acarboxylic, phosphonic, or sulfonic acid moiety are equivalent to a potential match atom which is also the centralatom of a carboxylic, phosphonic, or sulfonic moiety.13.4.20 EqKetoneSulfoneRootKetone sulfone root atom equivalence flag. When set, query atoms which are the central atom of a ketone or sulfonemoiety are equivalent to a potential match atom which is also the central atom of a ketone or sulfone moiety.13.4.21 BondOrderBond order flag. When set, the values returned by the OEBondBase::GetBondOrder method of the queryand potential graph match will be tested for equivalence.13.4.22 EqSingleDoubleSingle double equivalence flag. When set, a query bond which is either a single or double bond based on the returnvalue of the OEBondBase::GetBondOrder method is equivalent to potential graph match which is also eithera single or double bond.13.4.23 EqDoubleTripleDouble triple equivalence flag. When set, a query bond which is either a double or triple bond based on the returnvalue of the OEBondBase::GetBondOrder method is equivalent to potential match bond which is also eithera double or triple bond.13.4.24 EqNotAromaticNot aromatic equivalence flag. When set, a query atom or bond which is not aromatic based on the return value ofthe corresponding OEAtomBase::IsAromatic or OEBondBase::IsAromatic method is equivalent to apotential match which is also not aromatic.13.4.25 AromaticityAromaticity flag. When set, the values returned by the corresponding OEAtomBase::IsAromatic orOEBondBase::IsAromatic method of the query atom or bond and a potential graph match will be testedfor equivalence.


13.4. OEExprOpts 18513.4.26 RingMemberRing membership flag. When set, the values returned by the corresponding OEAtomBase::IsInRing orOEBondBase::IsInRing method of the query atom or bond and a potential graph match will be tested forequivalence.13.4.27 Chiral/StereoChiral (atoms) or stereochemistry (bonds) flag. When set, atoms or bonds which have stereochemistryspecified based on the corresponding return value of OEAtomBase::HasStereoSpecified orOEBondBase::HasStereoSpecified will be tested for stereochemical equivalence based on the graphmatches surrounding the stereocenter.13.4.28 IntTypeInteger type flag. When set, the values returned by the corresponding OEAtomBase::GetIntType andOEBondBase::GetIntType method of the query atom or bond and a potential graph match will be testedfor equivalence.13.4.29 StringTypeCharacter string type flag. When set, the values returned by the corresponding OEAtomBase::GetType andOEBondBase::GetType method of the query atom or bond and a potential graph match will be tested forlexigraphical equivalence.13.4.30 DefaultAtomsLogical or of the atomic number, aromaticity, and formal charge flags of the OEExprOpts namespace. Accordingly,a query atom is mapped to a target atom only if they have the same atomic number, aromaticity value andformal charge. This combination of flags is intended to give a moderate degree of discrimination of the graphequivalence of atoms.13.4.31 DefaultBondsLogical or of the bond order and aromaticity flags of the OEExprOpts namespace. Accordingly a query bond ismapped to a target bond only if they have the same obd order and aromaticity value. This combination of flags isintended to give a moderate degree of discrimination of the graph equivalence of bonds.


186 Chapter 13. <strong>OEChem</strong> Namespaces13.4.32 ExactAtomsLogical or of the atomic number, aromaticity, strict formal charge, degree, hydrogen count, chirality, mass, and ringmembership flags of the OEExprOpts namespace. This combination of flags is intended to give a high degree ofdiscrimination of the graph equivalence of atoms.13.4.33 ExactBondsLogical or of the bond order, aromaticity, ring membership, and stereochemistry flags of the OEExprOpts namespace.This combination of flags is intended to give a high degree of discrimination of the graph equivalence ofbonds.13.4.34 AutomorphAtomsLogical or of the atomic number, aromaticity, degree, chirality, and hydrogen count. This combination of flags isused when determining automophism related graphs.13.4.35 AutomorphBondsEquivalent to the aromaticity flag. This flag is used when determining automophism related graphs.13.5 OEExprTypeThee OEExprType namespace is used to identify built-in <strong>OEChem</strong> expressions used in graph matching operations.The values in the namespace are returned by the OEExprBase::GetType method of the correspondingexpression implementations.namespace OEExprType{const unsigned int Undefined = 0 ;const unsigned int And = 1 ;const unsigned int Or = 2 ;const unsigned int Not = 3 ;const unsigned int Const = 4 ;const unsigned int Element = 5 ;const unsigned int AromElem = 6 ;const unsigned int Aromatic = 7 ;const unsigned int Mass = 8 ;const unsigned int HCount = 9 ;const unsigned int MinHCount = 1 0 ;const unsigned int Charge = 1 1 ;const unsigned int Connect = 1 2 ;const unsigned int Degree = 1 3 ;const unsigned int MinDegree = 1 4 ;const unsigned int Implicit = 1 5 ;const unsigned int Ring = 1 6 ;const unsigned int Size = 1 7 ;


13.6. OEFormat 187}const unsigned int RingBondCount = 1 8 ;const unsigned int Valence = 1 9 ;const unsigned int Hyb = 2 0 ;const unsigned int Recurs = 2 1 ;const unsigned int Chiral = 2 2 ;const unsigned int DefaultEdge = 2 3 ;const unsigned int BondOrder = 2 4 ;const unsigned int Metal = 2 5 ;const unsigned int Halogen = 2 6 ;const unsigned int IntType = 2 7 ;const unsigned int StringType = 2 8 ;13.6 OEFormatThe OEFormat namespace is used to encode symbolic constants representing the molecular file formats thatmay be read or written by <strong>OEChem</strong>. The symbol OEFormat::UNDEFINED has the value zero indicating anunrecognized or undefined file format.The symbol OEFormat::MAXFORMAT is defined as the last value plus one, allowing the convenient declarationof fixed sized arrays and range checking.namespace OEFormat {const unsigned int UNDEFINED = 0 ;const unsigned int SMI = 1 ;const unsigned int MDL = 2 ;const unsigned int PDB = 3 ;const unsigned int MOL2 = 4 ;const unsigned int BIN = 5 ;const unsigned int TDT = 6 ;const unsigned int ISM = 7 ;const unsigned int MOL2H = 8 ;const unsigned int SDF = 9 ;const unsigned int CAN = 1 0 ;const unsigned int MF = 1 1 ;const unsigned int XYZ = 1 2 ;const unsigned int FASTA = 1 3 ;const unsigned int MOPAC = 1 4 ;const unsigned int OEB = 1 5 ;const unsigned int MMOD = 1 6 ;const unsigned int SLN = 1 7 ;const unsigned int RDF = 1 8 ;const unsigned int CDX = 1 9 ;const unsigned int SKC = 2 0 ;const unsigned int MAXFORMAT = 2 1 ;}13.7 OEFuzzValThe OEFuzzVal namespace defines the values used to construct OEFuzzy (Section 8.13) instances. Fuzzy valuesof true, false, and maybe are represented by the corresponding constants in the OEFuzzVal namespace.


188 Chapter 13. <strong>OEChem</strong> Namespacesnamespace OEFuzzVal{const unsigned int False = 0 ;const unsigned int True = 1 ;const unsigned int Maybe = 2 ;}13.8 OEIFlavorThe OEIFlavor namespace is used to encode bitmasks representing the flavor, or minor file format variations, tothe molecular file formats that may be read by <strong>OEChem</strong>. The Generic namespace within OEIFlavor specifycontrol bits that are common to all of the input formats. Although these code Generic bits are common to all fileformats, they may be specified independently for each file format.The values are set and retrieved using the oemolstreambase::SetFormat andoemolstreambase::GetFormat methods of an oemolistream.The interpretation of many of these flavor values, is identical to those passed to the corresponding <strong>OEChem</strong> lowlevelfile format reader. Readers should also consult the flavor documentation for the appropriate low-level fileformat reader.namespace OEIFlavor {namespace Generic {const unsigned int OEAroModelDaylight = 0x80000 ;const unsigned int OEAroModelOpenEye = 0x40000 ;const unsigned int OEAroModelTripos = 0x20000 ;const unsigned int OEAroModelMMFF = 0x10000 ;const unsigned int OEAroModelMDL = 0x08000 ;const unsigned int AroMask = 0xF8000 ;const unsigned int Rings = 0x04000 ;const unsigned int GenericMask = 0xFC000 ;const unsigned int SpecificMask = 0x03FFF ;const unsigned int DEFAULT = 0x04000 ;const unsigned int Default = DEFAULT ;}namespace SMI {const unsigned int Strict = 0x01 ;const unsigned int Canon = 0x02 ;const unsigned int DEFAULT = 0x00 ;const unsigned int Default = DEFAULT ;}namespace MDL {const unsigned int Default = 0x0 ;}namespace PDB {const unsigned int TER = 0x001 ;const unsigned int END = 0x002 ;const unsigned int ENDM = 0x004 ;const unsigned int TerMask = 0x007 ;const unsigned int ALL = 0x008 ;const unsigned int DATA = 0x010 ;const unsigned int CHARGE = 0x020 ;const unsigned int RADIUS = 0x040 ;const unsigned int DELPHI = 0x060 ;const unsigned int BasicMask = 0x07F ;const unsigned int FormalCrg = 0x080 ;


13.8. OEIFlavor 189const unsigned int ImplicitH = 0x100 ;const unsigned int BondOrder = 0x200 ;const unsigned int Rings = 0x400 ;const unsigned int Connect = 0x800 ;const unsigned int ExtraMask = 0xF80 ;const unsigned int AllMask = 0xFFF ;const unsigned int DEFAULT = 0xF86 ;const unsigned int Default = DEFAULT ;}namespace MOL2 {const unsigned int M2H = 0x01 ;const unsigned int Default = 0x00 ;}namespace BIN {const unsigned int Default = 0x0 ;}namespace TDT {const unsigned int Default = 0x0 ;}namespace ISM {const unsigned int Default = 0x0 ;}namespace MOL2H {const unsigned int Default = 0x0 ;}namespace SDF {const unsigned int Default = 0x0 ;}namespace CAN {const unsigned int Default = 0x0 ;}namespace MF {const unsigned int Default = 0x0 ;}namespace XYZ {const unsigned int FormalCrg = 0x01 ;const unsigned int ImplicitH = 0x02 ;const unsigned int BondOrder = 0x04 ;const unsigned int Rings = 0x08 ;const unsigned int Connect = 0x10 ;const unsigned int ExtraMask = 0x1f ;const unsigned int Default = 0x1F ;}namespace FASTA {const unsigned int Default = 0x0 ;}namespace MOPAC {const unsigned int Default = 0x0 ;}namespace OEB {const unsigned int Default = 0x0 ;}namespace MMOD {const unsigned int FormalCrg = 0x80 ;const unsigned int Default = 0x0 ;}namespace SLN {const unsigned int Default = 0x0 ;}namespace RDF {const unsigned int Default = 0x0 ;}namespace CDX {const unsigned int Default = 0x0 ;


190 Chapter 13. <strong>OEChem</strong> Namespaces}}namespace SKC {const unsigned int Default = 0x0 ;}13.8.1 OEIFlavor::Generic13.8.2 OEIFlavor::MMODThis namespace controls the processing performed when reading OEFormat::MMOD format files using theOEReadMacroModelFile function.The OEIFlavor::MMOD::FormalCrg flag bit controls where the high-level file format reader calls theOEAssignFormalCharges function to assign formal charges, after reading the connection table withOEReadMacroModelFile.13.8.3 OEIFlavor::MOL2This namespace controls the processing performed when reading OEFormat::MOL2 format files using theOEReadMol2File function.13.8.4 OEIFlavor::PDBThis namespace controls the processing performed when reading OEFormat::PDB format files using theOEReadPDBFile function.13.8.5 OEIFlavor::SMIThis namespace controls the processing performed when reading OEFormat::SMI format files using theOEParseSmiles function.13.8.6 OEIFlavor::XYZ13.9 OEOFlavorThe OEOFlavor namespace is used to encode bitmasks representing the flavor, of minor file format variations,to the molecular file formats that may be written by <strong>OEChem</strong>. The Generic namespace within OEOFlavor


13.9. OEOFlavor 191specify control bits that are common to all of the output formats. Although these code Generic bits are commonto all file formats, they may be specified independently for each file format.The values are set and retrieved using the oemolstreambase::SetFormat andoemolstreambase::GetFormat methods of an oemolostream.The interpretation of many of these flavor values, is identical to those passed to the corresponding <strong>OEChem</strong> lowlevelfile format writer. Readers should also consult the flavor documentation for the appropriate low-level fileformat writer.namespace OEOFlavor {namespace Generic {const unsigned int OEAroModelDaylight = 0x80000 ;const unsigned int OEAroModelOpenEye = 0x40000 ;const unsigned int OEAroModelTripos = 0x20000 ;const unsigned int OEAroModelMMFF = 0x10000 ;const unsigned int OEAroModelMDL = 0x08000 ;const unsigned int AroMask = 0xF8000 ;const unsigned int Rings = 0x04000 ;const unsigned int GenericMask = 0xFC000 ;const unsigned int SpecificMask = 0x03FFF ;const unsigned int DEFAULT = 0x04000 ;const unsigned int Default = DEFAULT ;}namespace SMI {const unsigned int Isotopes = 0x001 ;const unsigned int Hydrogens = 0x002 ;const unsigned int RGroups = 0x004 ;const unsigned int AtomStereo = 0x008 ;const unsigned int BondStereo = 0x010 ;const unsigned int AtomMaps = 0x020 ;const unsigned int Canonical = 0x040 ;const unsigned int Kekule = 0x080 ;const unsigned int SuperAtoms = 0x100 ;const unsigned int ExtBonds = 0x200 ;const unsigned int SmiMask = 0x3FF ;const unsigned int DEFAULT = 0x024 ;const unsigned int Default = DEFAULT ;}namespace MDL {const unsigned int MCHG = 0x01 ;const unsigned int MISO = 0x02 ;const unsigned int MRGP = 0x04 ;const unsigned int MDLParity = 0x08 ;const unsigned int NoParity = 0x10 ;const unsigned int CurrentParity = 0x20 ;const unsigned int MMask = 0x07 ;const unsigned int PMask = 0x38 ;const unsigned int DEFAULT = 0x0f ;const unsigned int Default = DEFAULT ;}namespace PDB {const unsigned int BONDS = 0x001 ;const unsigned int ORDERS = 0x002 ;const unsigned int BOTH = 0x004 ;const unsigned int CHARGE = 0x008 ;const unsigned int RADIUS = 0x010 ;const unsigned int TER = 0x020 ;const unsigned int DELPHI = 0x018 ;const unsigned int ELEMENT = 0x040 ;const unsigned int FormalCrg = 0x080 ;const unsigned int BasicMask = 0x0FF ;


192 Chapter 13. <strong>OEChem</strong> Namespacesconst unsigned int OEResidues = 0x100 ;const unsigned int NoResidues = 0x200 ;const unsigned int CurrentResidues = 0x400 ;const unsigned int OrderAtoms = 0x800 ;const unsigned int AllMask = 0xFFF ;const unsigned int DEFAULT = 0x940 ;const unsigned int Default = DEFAULT ;}namespace MOL2 {const unsigned int AtomTypeNames = 0x01 ;const unsigned int BondTypeNames = 0x02 ;const unsigned int AtomNames = 0x04 ;const unsigned int OrderAtoms = 0x08 ;const unsigned int NameMask = 0x07 ;const unsigned int AllMask = 0x0F ;const unsigned int DEFAULT = 0x0F ;const unsigned int Default = DEFAULT ;}namespace BIN {const unsigned int Default = 0x0 ;}namespace TDT {const unsigned int Default = 0x0 ;}namespace ISM {const unsigned int Isotopes = 0x001 ;const unsigned int Hydrogens = 0x002 ;const unsigned int RGroups = 0x004 ;const unsigned int AtomStereo = 0x008 ;const unsigned int BondStereo = 0x010 ;const unsigned int AtomMaps = 0x020 ;const unsigned int Canonical = 0x040 ;const unsigned int Kekule = 0x080 ;const unsigned int SuperAtoms = 0x100 ;const unsigned int ExtBonds = 0x200 ;const unsigned int SmiMask = 0x3FF ;const unsigned int DEFAULT = 0x07d ;const unsigned int Default = DEFAULT ;}namespace MOL2H {const unsigned int AtomTypeNames = 0x01 ;const unsigned int BondTypeNames = 0x02 ;const unsigned int AtomNames = 0x04 ;const unsigned int OrderAtoms = 0x08 ;const unsigned int NameMask = 0x07 ;const unsigned int AllMask = 0x0F ;const unsigned int DEFAULT = 0x0F ;const unsigned int Default = DEFAULT ;}namespace SDF {const unsigned int MCHG = 0x01 ;const unsigned int MISO = 0x02 ;const unsigned int MRGP = 0x04 ;const unsigned int MDLParity = 0x08 ;const unsigned int NoParity = 0x10 ;const unsigned int CurrentParity = 0x20 ;const unsigned int MMask = 0x07 ;const unsigned int PMask = 0x38 ;const unsigned int DEFAULT = 0x0f ;const unsigned int Default = DEFAULT ;}namespace CAN {const unsigned int Isotopes = 0x001 ;const unsigned int Hydrogens = 0x002 ;


13.9. OEOFlavor 193const unsigned int RGroups = 0x004 ;const unsigned int AtomStereo = 0x008 ;const unsigned int BondStereo = 0x010 ;const unsigned int AtomMaps = 0x020 ;const unsigned int Canonical = 0x040 ;const unsigned int Kekule = 0x080 ;const unsigned int SuperAtoms = 0x100 ;const unsigned int ExtBonds = 0x200 ;const unsigned int SmiMask = 0x3FF ;const unsigned int DEFAULT = 0x064 ;const unsigned int Default = DEFAULT ;}namespace MF {const unsigned int Title = 0x1 ;const unsigned int DEFAULT = 0x1 ;const unsigned int Default = DEFAULT ;}namespace XYZ {const unsigned int Default = 0x0 ;}namespace FASTA {const unsigned int Default = 0x0 ;}namespace MOPAC {const unsigned int XYZ = 0x01 ;const unsigned int CHARGES = 0x02 ;const unsigned int DEFAULT = 0x02 ;const unsigned int Default = DEFAULT ;}namespace OEB {const unsigned int Default = 0x0 ;}namespace MMOD {const unsigned int AtomTypes = 0x1 ;const unsigned int DEFAULT = 0x1 ;const unsigned int Default = DEFAULT ;}namespace SLN {const unsigned int Default = 0x0 ;}namespace RDF {const unsigned int MCHG = 0x01 ;const unsigned int MISO = 0x02 ;const unsigned int MRGP = 0x04 ;const unsigned int MDLParity = 0x08 ;const unsigned int NoParity = 0x10 ;const unsigned int CurrentParity = 0x20 ;const unsigned int MMask = 0x07 ;const unsigned int PMask = 0x38 ;const unsigned int DEFAULT = 0x0F ;const unsigned int Default = DEFAULT ;}namespace CDX {const unsigned int Default = 0x0 ;}}


194 Chapter 13. <strong>OEChem</strong> Namespaces13.9.1 OEOFlavor::CANThis namespace controls the processing performed when writing OEFormat::CAN format files using theOECreateSmiString function.13.9.2 OEOFlavor::Generic13.9.3 OEOFlavor::ISMThis namespace controls the processing performed when writing OEFormat::ISM format files using theOECreateSmiString function.13.9.4 OEOFlavor::MDLThis namespace controls the processing performed when writing OEFormat::MDL format files using theOEWriteMDLFile function.The OEOFlavor::MDL::PMask set of bits controls the processing of the MDL stereo parity bit field of eachatom. The default behaviour, with just the OEOFlavor::MDL::MDLParity flag set, is to call the functionOEMDLPerceiveParity if the function OEMDLHasParity returns false. This determines the parity bitfrom <strong>OEChem</strong>’s perceived stereochemistry if the MDL parity bits haven’t already been set. Alternatively, theOEOFlavor::MDL::NoParity flag, instructs the high level writer to clear the MDL stereo parity field of everyatom to zero. Finally, OEOFlavor::MDL::CurrentParity (or neither MDLParity nor NoParity)instructs the high-level writer to leave the MDL parity bits alone.13.9.5 OEOFlavor::MFThis namespace controls the processing performed when writing OEFormat::MF format files using theOEMolecularFormula function.The OEOFlavor::MF::Title flag controls whether the molecule’s title (or name) is written to the outputfile. If so, this the text return by the OEMolBase::GetTitle functions appears, separated by a single spacecharacter, on the same line as the molecular formula.13.9.6 OEOFlavor::MMOD13.9.7 OEOFlavor::MOL2This namespace controls the processing performed when writing OEFormat::MOL2 format files using theOEWriteMol2File function.


13.10. OEHybridization 19513.9.8 OEOFlavor::MOL2HThis namespace controls the processing performed when writing OEFormat::MOL2H format files using theOEWriteMol2File function.13.9.9 OEOFlavor::MOPAC13.9.10 OEOFlavor::PDBThis namespace controls the processing performed when writing OEFormat::PDB format files using theOEWritePDBFile function.13.9.11 OEOFlavor::RDF13.9.12 OEOFlavor::SDFThis namespace controls the processing performed when writing OEFormat::SDF format files using theOEWriteMDLFile function.The OEOFlavor::SDF::PMask set of bits controls the processing of the MDL stereo parity bit field of eachatom. The default behaviour, with just the OEOFlavor::SDF::MDLParity flag set, is to call the functionOEMDLPerceiveParity if the function OEMDLHasParity returns false. This determines the parity bitfrom <strong>OEChem</strong>’s perceived stereochemistry if the MDL parity bits haven’t already been set. Alternatively, theOEOFlavor::SDF::NoParity flag, instructs the high level writer to clear the MDL stereo parity field of everyatom to zero. Finally, OEOFlavor::SDF::CurrentParity (or neither MDLParity nor NoParity)instructs the high-level writer to leave the MDL parity bits alone.13.9.13 OEOFlavor::SMIThis namespace controls the processing performed when writing OEFormat::SMI format files using theOECreateSmiString function.13.10 OEHybridizationnamespace OEHybridization{const unsigned int Unknown = 0 ;const unsigned int sp = 1 ;const unsigned int sp2 = 2 ;const unsigned int sp3 = 3 ;const unsigned int sp3d = 4 ;


196 Chapter 13. <strong>OEChem</strong> Namespaces}const unsigned int sp3d2 = 5 ;13.11 OEMCMolTypenamespace OEMCMolType{const unsigned int OEDefault = 1 ;const unsigned int Undefined = 0 ;const unsigned int Cartesian = 1 ;const unsigned int Torsion = 2 ;const unsigned int Rotation = 3 ;const unsigned int OEDBMCMol = 4 ;const unsigned int MaxType = 5 ;}The values in this namespace specify the OEMCMolBase implementation type to be allocated when passed to afactory method (see Section 9.124).13.12 OEMDLOFlagThe code OEMDLOFlag namespace is used to encode the output flavors used by <strong>OEChem</strong>’s MDL mol file writer.For a description of their meanings see the documentation for the OEWriteMDLFile function.namespace OEMDLOFlag{const unsigned int MCHG = 0x01 ;const unsigned int MISO = 0x02 ;const unsigned int MRGP = 0x04 ;const unsigned int DEFAULT = 0x07 ;}13.13 OEMModTypesnamespace OEMModType {const unsigned int C1 = 1 ;const unsigned int C2 = 2 ;const unsigned int C3 = 3 ;const unsigned int CA = 4 ;const unsigned int CB = 5 ;const unsigned int CC = 6 ;const unsigned int CD = 7 ;const unsigned int CE = 8 ;const unsigned int CF = 9 ;const unsigned int CM = 1 0 ;const unsigned int CP = 1 1 ;const unsigned int CR = 1 2 ;const unsigned int C0 = 1 4 ;const unsigned int O2 = 1 5 ;const unsigned int O3 = 1 6 ;


13.13. OEMModTypes 197const unsigned int OA = 1 7 ;const unsigned int OM = 1 8 ;const unsigned int OW = 1 9 ;const unsigned int OP = 2 0 ;const unsigned int OQ = 2 1 ;const unsigned int O0 = 2 3 ;const unsigned int N1 = 2 4 ;const unsigned int N2 = 2 5 ;const unsigned int N3 = 2 6 ;const unsigned int NA = 2 7 ;const unsigned int NB = 2 8 ;const unsigned int NC = 2 9 ;const unsigned int ND = 3 0 ;const unsigned int N4 = 3 1 ;const unsigned int N5 = 3 2 ;const unsigned int NE = 3 3 ;const unsigned int NF = 3 4 ;const unsigned int NG = 3 5 ;const unsigned int NH = 3 6 ;const unsigned int NI = 3 7 ;const unsigned int NM = 3 8 ;const unsigned int NP = 3 9 ;const unsigned int N0 = 4 0 ;const unsigned int H1 = 4 1 ;const unsigned int H2 = 4 2 ;const unsigned int H3 = 4 3 ;const unsigned int H4 = 4 4 ;const unsigned int H5 = 4 5 ;const unsigned int H0 = 4 8 ;const unsigned int S1 = 4 9 ;const unsigned int SA = 5 0 ;const unsigned int SM = 5 1 ;const unsigned int S0 = 5 2 ;const unsigned int P0 = 5 3 ;const unsigned int B2 = 5 4 ;const unsigned int B3 = 5 5 ;const unsigned int F0 = 5 6 ;const unsigned int Cl = 5 7 ;const unsigned int Br = 5 8 ;const unsigned int I0 = 5 9 ;const unsigned int Si = 6 0 ;const unsigned int Du = 6 1 ;const unsigned int Z0 = 6 2 ;const unsigned int Lp = 6 3 ;const unsigned int Li = 6 5 ;const unsigned int Na = 6 6 ;const unsigned int K0 = 6 7 ;const unsigned int Rb = 6 8 ;const unsigned int Cs = 6 9 ;const unsigned int Ca = 7 0 ;const unsigned int Ba = 7 1 ;const unsigned int Mg = 7 2 ;const unsigned int M2 = 7 3 ;const unsigned int M3 = 7 4 ;const unsigned int M4 = 7 5 ;const unsigned int M5 = 7 6 ;const unsigned int M6 = 7 7 ;const unsigned int M7 = 7 8 ;const unsigned int f2 = 7 9 ;const unsigned int f3 = 8 0 ;const unsigned int o2 = 8 1 ;const unsigned int o3 = 8 2 ;const unsigned int n2 = 8 3 ;const unsigned int n3 = 8 4 ;const unsigned int c1 = 8 5 ;


198 Chapter 13. <strong>OEChem</strong> Namespacesconst unsigned int c2 = 8 6 ;const unsigned int Zn = 8 7 ;const unsigned int m3 = 8 8 ;const unsigned int m4 = 8 9 ;const unsigned int m5 = 9 0 ;const unsigned int m6 = 9 1 ;const unsigned int SP = 1 00;const unsigned int S2 = 1 01;const unsigned int Cm = 1 02;}const unsigned int MAXTYPE = 1 03;13.14 OEMolBaseTypenamespace OEMolBaseType{const unsigned int Undefined = 0 ;const unsigned int OEDefault = 1 ;const unsigned int OEDBMol = 2 ;const unsigned int OEMiniMol = 3 ;const unsigned int MaxType = 4 ;}The values in this namespace specify the OEMolBase implementation type to be allocated when passed to afactory method (see Section 9.125).13.15 OEMOPACOFlagnamespace OEMOPACOFlag{const unsigned int XYZ = 0x01 ;const unsigned int CHARGES = 0x02 ;const unsigned int DEFAULT = 0x02 ;}13.16 OEPDBAtomNameThe OEPDBAtomName namespace is used to encode the result values from the OEGetPDBAtomIndex function.If the PDB atom name of the given atom isn’t recognized the value zero is returned.namespace OEPDBAtomName{// Amino Acid Atom Namesconst unsigned int N = 1 ;const unsigned int CA = 2 ;const unsigned int C = 3 ;const unsigned int O = 4 ;const unsigned int CB = 5 ;const unsigned int CG = 6 ;const unsigned int OG = 7 ;const unsigned int SG = 8 ;


13.16. OEPDBAtomName 199const unsigned int CG1 = 9 ;const unsigned int OG1 = 1 0 ;const unsigned int CG2 = 1 1 ;const unsigned int CD = 1 2 ;const unsigned int OD = 1 3 ;const unsigned int SD = 1 4 ;const unsigned int CD1 = 1 5 ;const unsigned int ND1 = 1 6 ;const unsigned int OD1 = 1 7 ;const unsigned int CD2 = 1 8 ;const unsigned int ND2 = 1 9 ;const unsigned int OD2 = 2 0 ;const unsigned int CE = 2 1 ;const unsigned int NE = 2 2 ;const unsigned int CE1 = 2 3 ;const unsigned int NE1 = 2 4 ;const unsigned int OE1 = 2 5 ;const unsigned int CE2 = 2 6 ;const unsigned int NE2 = 2 7 ;const unsigned int OE2 = 2 8 ;const unsigned int CE3 = 2 9 ;const unsigned int CZ = 3 0 ;const unsigned int NZ = 3 1 ;const unsigned int CZ2 = 3 2 ;const unsigned int CZ3 = 3 3 ;const unsigned int OH = 3 4 ;const unsigned int NH1 = 3 5 ;const unsigned int CH2 = 3 6 ;const unsigned int NH2 = 3 7 ;const unsigned int OXT = 3 8 ;// Nucleic Acid Atom Namesconst unsigned int P = 5 0 ;const unsigned int O1P = 5 1 ;const unsigned int O2P = 5 2 ;const unsigned int O5_ = 5 3 ;const unsigned int C5_ = 5 4 ;const unsigned int C4_ = 5 5 ;const unsigned int O4_ = 5 6 ;const unsigned int C3_ = 5 7 ;const unsigned int O3_ = 5 8 ;const unsigned int C2_ = 5 9 ;const unsigned int O2_ = 6 0 ;const unsigned int C1_ = 6 1 ;const unsigned int N9 = 6 2 ; // A Gconst unsigned int C8 = 6 3 ; // A Gconst unsigned int N7 = 6 4 ; // A Gconst unsigned int C5 = 6 5 ; //?A Gconst unsigned int C6 = 6 6 ; //?A Gconst unsigned int O6 = 6 7 ; // Gconst unsigned int N6 = 6 8 ; // Aconst unsigned int N1 = 6 9 ; // ACGTconst unsigned int C2 = 7 0 ; // ACGTconst unsigned int O2 = 7 1 ; // C Tconst unsigned int N2 = 7 2 ; // Gconst unsigned int N3 = 7 3 ; // ACGTconst unsigned int C4 = 7 4 ; // ACGTconst unsigned int O4 = 7 5 ; // Tconst unsigned int N4 = 7 6 ; // Cconst unsigned int C5__ = 7 7 ; //? C Tconst unsigned int C5M = 7 8 ; // Tconst unsigned int C6_ = 7 9 ; //? C T// Ligand Atom Namesconst unsigned int lS = 1 00;


200 Chapter 13. <strong>OEChem</strong> Namespacesconst unsigned int lP = 1 01;const unsigned int lO1 = 1 02;const unsigned int lO2 = 1 03;const unsigned int lO3 = 1 04;const unsigned int lO4 = 1 05;}13.17 OEPDBIFlagnamespace OEPDBIFlag{const unsigned int TER = 0x01 ;const unsigned int END = 0x02 ;const unsigned int ENDM = 0x04 ;const unsigned int ALL = 0x08 ;const unsigned int DATA = 0x10 ;const unsigned int CHARGE = 0x20 ;const unsigned int RADIUS = 0x40 ;const unsigned int DELPHI = 0x60 ;const unsigned int DEFAULT = 0x06 ;}13.18 OEPDBOFlagThe OEPDBOFlag namespace is used to encode the output flavors used by <strong>OEChem</strong>’s PDB file writer. For adescription of their meanings see the documentation for the OEWritePDBFile function.namespace OEPDBOFlag{const unsigned int BONDS = 0x01 ;const unsigned int ORDERS = 0x02 ;const unsigned int BOTH = 0x04 ;const unsigned int CHARGE = 0x08 ;const unsigned int RADIUS = 0x10 ;const unsigned int TER = 0x20 ;const unsigned int ELEMENT = 0x40 ;const unsigned int FORMALCHARGE = 0x80 ;const unsigned int DELPHI = 0x18 ;const unsigned int DEFAULT = 0x40 ;}13.19 OEPreserveResInfoThe OEPreserveResInfo namespace is used as a bit-mask to indicate which fields in the OEResidue classare preserved during an OEPerceiveResidues function call.namespace OEPreserveResInfo


13.20. OEProperty 201{const unsigned int None = 0x0 ;const unsigned int ChainID = 0x1 ;const unsigned int ResidueNumber = 0x2 ;const unsigned int ResidueName = 0x4 ;const unsigned int Default = None ;const unsigned int All = 0x7 ;}13.20 OEPropertynamespace OEProperty{const unsigned int Undefined = 0 ;const unsigned int Aromatic = 1 ;const unsigned int Ring = 2 ;const unsigned int Donor = 5 ;const unsigned int Acceptor = 6 ;const unsigned int Both = 7 ;const unsigned int Chiral = 8 ;const unsigned int Exo = 9 ;const unsigned int Endo = 1 0 ;const unsigned int StereoDefined = 1 1 ;const unsigned int Visit = 1 2 ;const unsigned int Deleted = 1 3 ;const unsigned int Single = 1 7 ;const unsigned int Double = 1 8 ;const unsigned int Triple = 1 9 ;const unsigned int Closure = 2 0 ;const unsigned int Rotor = 2 4 ;const unsigned int RingAtomsAndBonds = 2 5 ;const unsigned int ClosureBonds = 2 6 ;const unsigned int Chirality = 2 7 ;const unsigned int Hybridization = 2 8 ;const unsigned int Kekule = 2 9 ;const unsigned int Degree = 3 1 ;const unsigned int Valence = 3 2 ;const unsigned int PhCorrected = 3 3 ;const unsigned int AtomTypes = 3 4 ;const unsigned int Residue = 3 5 ;const unsigned int BondOrders = 3 6 ;const unsigned int HydrogenMode = 3 7 ;const unsigned int DeletedAtoms = 3 8 ;const unsigned int DeletedBonds = 3 9 ;const unsigned int AtomTypeString = 4 0 ;const unsigned int BondTypeString = 4 1 ;const unsigned int Isotope = 4 2 ;const unsigned int PartialCharge = 4 3 ;const unsigned int AtomTypeInt = 4 4 ;const unsigned int AtomName = 4 5 ;const unsigned int X = 4 6 ;const unsigned int Y = 4 7 ;const unsigned int Z = 4 8 ;const unsigned int MatchOrder = 4 9 ;const unsigned int OEBase = 5 0 ;const unsigned int Rxn = 5 1 ;const unsigned int RxnRole = 5 2 ;const unsigned int AtomMemberPred = 5 3 ;const unsigned int BondMemberPred = 5 4 ;


202 Chapter 13. <strong>OEChem</strong> Namespaces}const unsigned int BondStereo = 5 5 ;const unsigned int Component = 5 6 ;const unsigned int AroModel = 5 8 ;const unsigned int PartialChargeModel = 5 9 ;const unsigned int Dimension = 6 0 ;const unsigned int Perceived = 6 1 ;const unsigned int MapIdx = 6 2 ;const unsigned int SymClass = 6 3 ;const unsigned int All = 6 5 ;const unsigned int Radius = 6 6 ;13.21 OEQMolTypenamespace OEQMolType {const unsigned int Undefined = 0 ;const unsigned int OEDefault = 1 ;const unsigned int MaxType = 2 ;}The values in this namespace specify the OEQMolBase implementation type to be allocated when passed to afactory method (see Section 9.126).13.22 OEResidueIndexThe namespace is used to encode the return values from the OEGetResidueIndex function(s). If the biopolymerresidue name is not recognized, the OEGetResidueIndex function returns either a zero or a unsignedinteger value other than the values listed below. As future releases of <strong>OEChem</strong> may add to this namespace, codeshould not test for against zero, but instead check against the values that its interested in and treat all other valuesas “unrecognized”.The table below lists the symbolic constant names that are assigned integer values in <strong>OEChem</strong>’s headers. Theseactual constants are not listed here, as they may change from release to release and therefore the symbolic namesshould be used. However, because these values really are unsigned integer constants they may be used, for example,in the cases of a switch statement, i.e. their values are known by the compiler at compile-time.namespace OEResidueIndex{const unsigned int ALA ;const unsigned int ARG ;const unsigned int ASN ;const unsigned int ASP ;const unsigned int CYS ;const unsigned int GLN ;const unsigned int GLU ;const unsigned int GLY ;const unsigned int HIS ;const unsigned int ILE ;const unsigned int LEU ;const unsigned int LYS ;const unsigned int MET ;const unsigned int PHE ;const unsigned int PRO ;const unsigned int SER ;const unsigned int THR ;


13.23. OERxnRole 203const unsigned int TRP ;const unsigned int TYR ;const unsigned int VAL ;const unsigned int UNK ;const unsigned int ASX ;const unsigned int GLX ;const unsigned int CYX ;const unsigned int CYH ;const unsigned int HID ;const unsigned int HIE ;const unsigned int HIP ;// TRY// CSS// CSHconst unsigned int A ;const unsigned int C ;const unsigned int G ;const unsigned int T ;const unsigned int U ;// ADE// CYT// GUA// THY// URAconst unsigned int HSE ;const unsigned int HYP ;const unsigned int HYL ;const unsigned int MSE ;const unsigned int ORN ;const unsigned int SAR ;const unsigned int TAU ;const unsigned int HOH ;const unsigned int SO4 ;const unsigned int PO4 ;const unsigned int CL ;const unsigned int BR ;const unsigned int IOD ;const unsigned int GOL ;const unsigned int PER ;const unsigned int MOH ;const unsigned int EOH ;}// H2O, DOD, D2O, WAT, TIP, SOL, OH2, OD2// SUL13.23 OERxnRoleThe OERxnRole namespace is used to define symbolic constants for the “Role” property of OEAtomBases. Thisstored property is used to record that “role” played by the atom in a reaction molecule. The default value isOERxnRole::None. The other currently defined values are OERxnRole::Reactant, OERxnRole::Agent, OERxn-Role::Catalyst and OERxnRole::Product.namespace OERxnRole{const unsigned int None = 0 ;const unsigned int Reactant = 1 ;const unsigned int Agent = 2 ;const unsigned int Catalyst = 2 ;const unsigned int Product = 3 ;}


204 Chapter 13. <strong>OEChem</strong> Namespaces13.24 OESmiFlagnamespace OESmiFlag{const unsigned int Undefined = 0 ;const unsigned int Up = 1 ;const unsigned int Down = 2 ;}13.25 OETriposTypeThe OETriposType namespace is used to define symbolic constants for Tripos atom types. These values aretypically calculated by atom typing, read from a Sybyl mol2 format file and used in writing Sybyl mol2 formatfiles.namespace OETriposType{const unsigned int Du = 0 ;const unsigned int Al = 1 ;const unsigned int Br = 2 ;const unsigned int C1 = 3 ;const unsigned int C2 = 4 ;const unsigned int C3 = 5 ;const unsigned int Car = 6 ;const unsigned int Ccat = 7 ;const unsigned int Ca = 8 ;const unsigned int Cl = 9 ;const unsigned int F = 1 0 ;const unsigned int H = 1 1 ;const unsigned int I = 1 2 ;const unsigned int K = 1 3 ;const unsigned int Li = 1 4 ;const unsigned int Lp = 1 5 ;const unsigned int N1 = 1 6 ;const unsigned int N2 = 1 7 ;const unsigned int N3 = 1 8 ;const unsigned int N4 = 1 9 ;const unsigned int Nam = 2 0 ;const unsigned int Nar = 2 1 ;const unsigned int Npl3 = 2 2 ;const unsigned int Na = 2 3 ;const unsigned int O2 = 2 4 ;const unsigned int O3 = 2 5 ;const unsigned int Oco2 = 2 6 ;const unsigned int P3 = 2 7 ;const unsigned int S2 = 2 8 ;const unsigned int S3 = 2 9 ;const unsigned int So = 3 0 ;const unsigned int So2 = 3 1 ;const unsigned int Si = 3 2 ;const unsigned int MAXTYPE = 3 3 ;}


13.26. OEWriteMolReturnCode 20513.26 OEWriteMolReturnCodeThe OEWriteMolReturnCode namespace is used to specify the error return codes from the high-level writefunctions OEWriteMolecule and OEWriteConstMolecule. A portion of this namespace is identical to theOEBReturnCode namespace.namespace OEWriteMolReturnCode{const unsigned int Success = 0 ;const unsigned int NoParentClass = 1 ;const unsigned int CheckFailed = 2 ;const unsigned int StreamFailed = 3 ;const unsigned int IncorrectSize = 4 ;const unsigned int Continue = 5 ;const unsigned int ReadTagFailed = 6 ;const unsigned int CorruptHeader = 7 ;const unsigned int EndOfFile = 8 ;const unsigned int ReadLengthFailed = 9 ;const unsigned int TypeCheckFailed = 1 0 ;const unsigned int IncorrectHandlerType = 1 1 ;const unsigned int TooManyAtoms = 1 2 ;const unsigned int OEBWriteFailure = 1 3 ;const unsigned int FormatNotWritable = 1 4 ;}


Part IVOESystem Library206


CHAPTERFOURTEENOESystem Classes and MemberFunctions14.1 OEBaseclass OEBaseThe abstract class OEBase defines the interface for run-time class extensibility and run-time type identification.Classes which derive from OEBase can store and retrieve data by association with integer or character string ’tag’identifiers. All primitive data types and user-defined classes which have valid copy constructors and assignmentoperators can be stored through the mechanism provided by OEBase.14.1.1 ConstructorsOEBase ( )Default constructor.OEBase ( const OEBase &copy )Copy constructor.14.1.2 AddDatatemplatebool AddData ( unsigned int tag , const T t )templatebool AddData ( const char ∗tag , const T t )These template methods associate and store a copy of the data passed as the second argument with the tag identifiergiven as the first argument. Integer tags should be allocated using the OEGetTag (Section 15.7) function. Multiplecalls to AddData of a OEBase derived class instance will result in multiple copies of data being stored. TheAddData method does not overwrite data stored by previous calls.templatebool AddData ( unsigned int tag , const T t , unsigned int len )templatebool AddData ( const char ∗tag , const T t , unsigned int len )207


208 Chapter 14. OESystem Classes and Member FunctionsThese template methods associate and store a copy of the data pointed to by the second argument with the tagidentifier given as the first argument. The third argument passed to the method is used to denote the length of thearray pointed to by the second argument. The array length must be specified so that data can be copied directly.Integer tags should be allocated using the OEGetTag (Section 15.7) function. Multiple calls to AddData of aOEBase derived class instance will result in multiple copies of data being stored. The AddData method does notoverwrite data stored by previous calls.14.1.3 Clearvirtual void Clear ( )This method clears all data stored using the AddData and SetData methods. When writing classes derived fromOEBase the Clear method should be chained to call the parent class Clear method.14.1.4 CreateCopyvirtual OEBase ∗CreateCopy ( )constThis pure virtual copy constructor should return a deep copy of the OEBase derived object. The copy of the objectreturned is dynamically allocated and should be deallocated using the C++ delete operator.14.1.5 DeleteDatabool DeleteData ( const char ∗tag )bool DeleteData ( unsigned int tag )This method deletes all instances of data stored with the AddData and SetData methods which are associated withthe data tag passed to the method. The method will return true if any data was deleted, and false if not dataassociated with the data tag was found.14.1.6 GetBoolDatabool GetBoolData ( unsigned int tag ) constbool GetBoolData ( const char ∗tag ) constThese methods return the first instance of boolean data stored previously with the associated data tag. This methodis equivalent to calling the GetData method with template argument bool.14.1.7 GetDatatemplateconst T &GetData ( unsigned int tag ) consttemplateconst T &GetData ( const char ∗tag ) constThese template methods return the first instance of data stored previously with the associated data tag. Integer tagsshould be allocated using the OEGetTag (Section 15.7) function. Run-time type checking is performed when datais requested. A data type mismatch between the storage and request types will result in a default data instance


14.1. OEBase 209being returned instead of the original data. Request for datum not present will also result in a default data instancebeing returned.14.1.8 GetDataIterOESystem : : OEIterBase ∗GetDataIter ( )constThis template method returns an iterator over data stored in an OEBase derived class instance. Data tag identification,run-time type checking, and data retrieval can be performed using the OEBaseData <strong>API</strong> (Section 14.2).14.1.9 GetDataTypevirtual const void ∗GetDataType ( )constThis pure virtual function is used to perform run-time type identification. The value returned by the method shouldbe equivalent to the value returned by OEGetDataType (Section 16.3) using the derived class type as the templateargument.14.1.10 GetDoubleDatadouble GetDoubleData ( unsigned int tag ) constdouble GetDoubleData ( const char ∗tag ) constThese methods return the first instance of double precision floating point data stored previously with the associateddata tag. This method is equivalent to calling the GetData method with template argument double.14.1.11 GetFloatDatafloat GetFloatData ( unsigned int tag ) constfloat GetFloatData ( const char ∗tag ) constThese methods return the first instance of single precision floating point data stored previously with the associateddata tag. This method is equivalent to calling the GetData method with template argument float.14.1.12 GetIntDataint GetIntData ( unsigned int tag ) constint GetIntData ( const char ∗tag ) constThese methods return the first instance of integer data stored previously with the associated data tag. This methodis equivalent to calling the GetData method with template argument int.14.1.13 GetStringDatastd : : string GetStringData ( unsigned int tag ) conststd : : string GetStringData ( const char ∗tag ) const


210 Chapter 14. OESystem Classes and Member FunctionsThese methods return the first instance of an STL string stored previously with the associated data tag. This methodis equivalent to calling the GetData method with template argument std::string.14.1.14 HasDatabool HasData ( const char ∗tag ) constbool HasData ( unsigned int tag ) constThese methods return true if any data stored in an OEBase derived object is associated with a particular data tagidentifier. If no stored data is associated with the passed data tag the methods return false.14.1.15 IsDataTypevirtual bool IsDataType ( const void ∗typ ) constThis method is used for run-time type identification of OEBase derived classes. The const void pointer argumentpassed to the function should be a value returned by the template function OEGetDataType (Section 16.3). TheIsDataType method will return true if the data type identifier passed to the function matches at least one of the datatypes in the inheritence tree of the requested OEBase derived object. The method will return false if the data typeidentifier passed to the method fails to match any class type in the inheritence tree of the requested OEBase derivedobject. Implementations of this pure virtual method should chain to their parent class’ IsDataType method.14.1.16 SetBoolDatabool SetBoolData ( unsigned int tag , bool t )bool SetBoolData ( const char ∗tag , bool t )These methods store boolean values associated with the passed data tag identifiers. The methods are equivalent tothe SetData method called with a boolean value.14.1.17 SetDatatemplate bool SetData ( unsigned int tag , const T t )template bool SetData ( const char ∗tag , const T t )These template methods store a copy of primitive or user-defined data passed as the second argument with a datatag identifier passed as the first argument. If data of the same type has been stored using the identical tag in aprevious AddData or SetData call, subsequent calls to SetData will overwrite the first instance of data stored withthe data tag. If a call to SetData succeeds in storing or overwriting previously stored data the method will returntrue. SetData will return false if a copy of the data cannot be made. If data has been stored previously associatedwith a data tag, subsequent calls to SetData with the identical data tag but with different data type will result in arun-time warning being written and a return value of false. Note that these methods will not make copies of datapassed by pointer. Values to be passed by pointer, or arrays, should be stored using the following SetData methods.templatebool SetData ( unsigned int tag , const T t , unsigned int len )templatebool SetData ( const char ∗tag , const T t , unsigned int len )These template methods store copies of arrays of primitive or user-defined data passed as the second argument witha data tag identifier passed as the first argument. The length of the array (number of elements) is passed as the third


14.2. OEBaseData 211argument to the method. If data of the same type has been stored using the identical tag in a previous AddDataor SetData call, subsequent calls to SetData will overwrite the first instance of data stored with the data tag. Thearray copy stored previously will be deallocated and a copy of the new array will be stored. If a call to SetDatasucceeds in storing or overwriting an array stored previously the method will return true. SetData will return falseif a copy of the data cannot be made. If data has been stored previously associated with a data tag, subsequent callsto SetData with the identical data tag but with different data type will result in a run-time warning being writtenand a return value of false.14.1.18 SetDoubleDatabool SetDoubleData ( unsigned int tag , double t )bool SetDoubleData ( const char ∗tag , double t )These methods store and associate double precision floating point values passed as the second argument with thedata tag provided as the first argument. The methods are provided for convenience and are functionally equivalentto calls to SetData where the template argument is a double precision floating point number.14.1.19 SetFloatDatabool SetFloatData ( unsigned int tag , float t )bool SetFloatData ( const char ∗tag , float t )These methods store and associate single precision floating point values passed as the second argument with thedata tag provided as the first argument. The methods are provided for convenience and are functionally equivalentto calls to SetData where the template argument is a single precision floating point number.14.1.20 SetIntDatabool SetIntData ( unsigned int tag , int t )bool SetIntData ( const char ∗tag , int t )These methods store and associate integer values passed as the second argument with the data tag provided as thefirst argument. The methods are provided for convenience and are functionally equivalent to calls to SetData wherethe template argument is a integer value.14.1.21 SetStringDatabool SetStringData ( unsigned int tag , std : : string t )bool SetStringData ( const char ∗tag , std : : string t )These methods store and associate STL strings passed as the second argument with the data tag provided as thefirst argument. The methods are provided for convenience and are functionally equivalent to calls to SetData wherethe template argument is a std::string.14.2 OEBaseDataclass OEBaseData


212 Chapter 14. OESystem Classes and Member FunctionsOEBaseData is an abstract class which defines the interface necessary for storage, retrieval, and duplication of datastored through the generic data interface in the OEBase (Section 14.1) class. Data stored in classes derived fromOEBaseData is identified through data tags. The ability to perform run-time type checking is also built into theclass.14.2.1 ConstructorOEBaseData ( unsigned int tag )Construct and instance of OEBaseData and set the data identifier tag upon construction.14.2.2 CreateCopyvirtual OEBaseData ∗CreateCopy ( )constThis pure virtual copy constructor should return a deep copy of the OEExprBase object. The copy of the objectreturned is not memory-managed by the parent instance. It is the responsibility of the programmer to manage thememory created and returned by this method.14.2.3 GetDataTypevirtual const void ∗GetDataType ( )constThis pure virtual method returns a unique type identifier for the data type being stored. The return value of themethod is equivalent to the return value of OEGetDataType (Section 16.3) for the stored type.14.2.4 GetSizevirtual unsigned int GetSize ( )constThis pure virtual method is used to return the number of elements if the data stored in an OEBaseData derived classis an array. Note that the value returned is the number of elements in the array, not the number of bytes occupiedby the data.14.2.5 GetTagunsigned int GetTag ( )constThis method returns the integer data tag with which the data was stored.14.3 OEBitVectorThe OESystem::OEBitVector class is used to represent a resizable bitmap. These are commonly used to store“fingerprints” in chemoinformatics.class OEBitVector


14.3. OEBitVector 21314.3.1 ConstructorsOEBitVector ( )OEBitVector ( unsigned int size )OEBitVector ( const OEBitVector &copy )When constructed with an integer argument, this specifies the initial number of bits in the OEBitVector. Whenconstructed without an argument, the default number of bits is architecture dependent, 32 bits on 32-bit hosts and64 bits on 64-bit hosts. Initially, all the bits are set to zero.14.3.2 ClearBitsvoid ClearBits ( )The ClearBits method clears all of the bits of the OEBitVector to zero.14.3.3 CountBitsunsigned int CountBits ( )constThe CountBits method determines the number of bits that are set to one, in an OEBitVector.14.3.4 FirstBitint FirstBit ( )constThe FirstBit method returns the index of the first bit, i.e. the set bit with the lowest index,in the OEBitVector. Bit position indices are numbered from zero, and have a maximum ofOEBitVector::GetSize()-1. If the OEBitVector has no bits set, i.e. OEBitVector::IsEmptyreturns true, this method return will return the value -1.14.3.5 FromHexStringvoid FromHexString ( const std : : string &str )void FromHexString ( const char ∗str )The FromHexString method converts a hexadecimal string, in either upper, lower or mixed case, into an OEBitVector.The OEBitVector is resized to four times the length of the specified string, each character or hex digit correspondingto four bits. All characters outside the ranges ’0’..’9’, ’A’..’F’ and ’a’..’f’ are treated as zero.14.3.6 GetDataconst unsigned char ∗GetData ( )constThe GetData method returns a pointer to the internal storage of the OEBitVector’s bitmap. This pointer to asequence of at least (OEBitVector::GetSize()+7)/8 consecutive bytes. Bit index zero corresponds to the leastsignificant bit of the first byte. All bits beyond OEVector::GetSize() in the last byte are guaranteed to be zero. The


214 Chapter 14. OESystem Classes and Member FunctionsGetData method always returns a valid non-NULL pointer even if the number of bits is zero.14.3.7 GetSizeunsigned int GetSize ( )constThe GetSize method returns the size, in bits, of the OEBitVector. An OEBitVector may potentially contain zerobits.14.3.8 IsBitOnbool IsBitOn ( unsigned int bit ) constThe IsBitOn method is used to check/test whether the bit as the specified position/index of an OEBitVector is set.Bit position indices are numbered from zero, and have a maximum of OEBitVector::GetSize()-1. This methodreturns false for all indices greater than or equal to OEBitVector::GetSize().14.3.9 IsEmptybool IsEmpty ( )constReturn true if all the bits of an OEBitVector are zero. This is equivalent to, but much more efficient than, testingthat OEBitVector::CountBits() == 0. An OEBitVector of zero size is considered empty.14.3.10 LastBitint LastBit ( )constThe LastBit method returns the index of the last bit, i.e. the set bit with the highest index, in the OEBitVector.Bit position indices are numbered from zero, and have a maximum of OEBitVector::GetSize()-1. If theOEBitVector has no bits set, i.e. OEBitVector::IsEmpty returns true, this method return will return thevalue -1.14.3.11 NegateBitsvoid NegateBits ( )The NegateBits method inverts all of the bits of an OEBitVector.14.3.12 NextBitint NextBit ( unsigned int bit )The NextBit method returns the next set bit after the specified bit position, i.e. the set bit with the lowestindex greater than the argument. If there are no such set bits, or the value of bit is greater than or equal toOEBitVector::GetSize(), this method returns the value -1.14.3.13 PrevBit


14.3. OEBitVector 215int PrevBit ( unsigned int bit )The PrevBit method returns the previous set bit before the specified bit position, i.e. the set bit with the highestindex less than the argument. If there are no such set bits, this method returns the value -1. If the specifiedvalue of bit is greater than or equal to OEBitVector::GetSize(), this method returns the same values asOEBitVector::LastBit().14.3.14 SetBitOffvoid SetBitOff ( unsigned int bit )The SetBitOff method clears the bit at the specified bit position/index of an OEBitVector. Bit position indices arenumbered from zero, and have a maximum of OEBitVector::GetSize()-1. If the value of ’bit’ is greater than orequal to OEBitVector::GetSize(), the bitmap is resized to bit+1 bits. All of the new bits are initialized to zero.14.3.15 SetBitOnvoid SetBitOn ( unsigned int bit )The SetBitOn method sets the bit at the specified bit position/index of an OEBitVector. Bit position indicesare numbered from zero, and have a maximum of OEBitVector::GetSize()-1. If the value of ’bit’ isgreater than or equal to OEBitVector::GetSize(), the bitmap is resized to bit+1 bits. All of the new bitsother than the one specified in the argument, i.e. the last, are initialized to zero.14.3.16 SetSizevoid SetSize ( unsigned int size )The SetSize method resizes an OEBitVector to the specified number of bits. A size argument of zero is allowed. Ifthis method increases the size of an OEBitVector all of the new bit positions are initialized to zero.14.3.17 ToggleBitvoid ToggleBit ( unsigned int bit )The ToggleBit method inverts the bit at the specified bit position/index of an OEBitVector. Bit positionindices are numbered from zero, and have a maximum of OEBitVector::GetSize()-1. If the value of ’bit’is greater than or equal to OEBitVector::GetSize(), the bitmap is resized to bit+1 bits. All of the newbits other than the one specified in the argument, i.e. the last, are initialized to zero.14.3.18 ToHexStringvoid ToHexString ( std : : string &str ) constThe ToHexString method generates a hexadecimal string representation of an OEBitVector. Each ‘nibble’of four bits is converted into an uppercase hexadecimal character. Hexadecimal strings can only represent bitmaps


216 Chapter 14. OESystem Classes and Member Functionsthat have a multiple of four bits. For OEBitVectors that are not a multiple of four, the remaining bits of themost significant nibble, i.e. the first character, are assumed to be zero.14.4 OEContainerclass OEContainer : public OEBase14.4.1 ConstructorsOEContainer ( )OEContainer ( const OEBase &copy )14.5 OEDotsclass OEDots14.5.1 ConstructorsOEDots ( unsigned int big , unsigned int small , const char ∗name = "" )14.5.2 GetCountsunsigned int GetCounts ( )14.5.3 Totalvoid Total ( )14.5.4 Updatevoid Update ( unsigned int step = 1)14.6 OEErrorHandlerclass OEErrorHandlerThe OEErrorHandler class is used to define the behavior of the OESystem::OEThrow error handler. Alldiagnostic output, including error, warning and informational messages, generated by the OpenEye libraries are


14.6. OEErrorHandler 217emitted via OEThrow. The OEErrorHandler class defines how these messages are emitted, but also how theuser can redirect and/or intercept these messages.14.6.1 Errorvoid Error ( const char ∗ format , . . . )void Error ( const std : : string &)The Error methods are used to write error messages to the OEErrorHandler. Depending upon the value ofthe OEErrorHandler’s strict property (see GetStrict and SetStrict), these diagnostics are forwarded toeither the Fatal or Warning methods.14.6.2 Fatalvoid Fatal ( const char ∗ format , . . . )void Fatal ( const std : : string &)The Fatal methods are used to write fatal error messages to the OEErrorHandler.14.6.3 GetStrictbool GetStrict ( )The GetStrict method is used to get the strict property of the OEErrorHandler. When theOEErrorHandler is strict, all errror messages written via the Error methods are treated as fatal, and handledlike those passed to Fatal. When the OEErrorHandler is not strict, error messages written via Error aretreated like those to Warning. The strict property of an OEErrorHandler can be set using the SetStrictmethod.14.6.4 Infovoid Info ( const char ∗ format , . . . )void Info ( const std : : string &)The Info methods are used to write an informational messages to the OEErrorHandler.14.6.5 SetOutputStreamvoid SetOutputStream ( OEPlatform : : oeostream &ofs )The SetOutputStream method can be used to specify the output stream that diagnostic messages are written towhen no custom error handler has been specified. By default, all messages are written to OEPlatform::oeerr.This function can be used to redirect this output to either a file stream or a string stream.14.6.6 SetStrictvoid SetStrict ( bool strict )


218 Chapter 14. OESystem Classes and Member FunctionsThe SetStrict method is used to set the strict property of the OEErrorHandler. When theOEErrorHandler is strict, all errror messages written via the Error methods are treated as fatal, and handledlike those passed to Fatal. When the OEErrorHandler is not strict, error messages written via Errorare treated like those to Warning. The strict property of an OEErrorHandler can be retrieved by using theGetStrict method.14.6.7 Usagevoid Usage ( const char ∗ format , . . . )void Usage ( const std : : string &)The Usage methods are used to write usage (warning) messages to the OEErrorHandler.14.6.8 Warningvoid Warning ( const char ∗ format , . . . )void Warning ( const std : : string &)The Warning methods are used to write warning messages to the OEErrorHandler.14.7 OEErrorHandlerImplBaseclass OEErrorHandlerImplBaseThe OEErrorHandlerImplBase abstract base class is used to define the <strong>API</strong> that can be used to customizean OEErrorHandler, typically the system error handler, OEThrow. For example, this class may be used topop-up a dialog box in a graphical user application.14.8 OEInterface14.8.1 Factorystatic OEFactory& Factory ( )Returns the OEInterface class’s factory used to create new parameters.14.8.2 Hastemplate bool Has ( std : : string name ) constReturns true if all of the following are true1. A parameter with name name is contained by the OEInterface2. The parameter is of type TT3. The parameters value of default is set.


14.8. OEInterface 219In all other cases the function returns false.14.8.3 Gettemplate TT Get ( std : : string name ) constReturns the setting (either the value, or default if the value is not set) of the parameter with the given name andinstance. The parameter must be of type TT, and must have either have a value or default set. If the parametercannot be found (i.e., a call to Has with the same TT and name returns false) a warning is issued and a defaultconstructed TT is returned.14.8.4 SetOrderPrioritybool SetOrderPriority ( int priority )Sets the order priority of the interface. The order priority overrides the default sorting by name that is used whencalling the GetInterfaces(false) member function. Child interfactes with lower priority values will appear first.This function returns true if the priority was successfully set and false otherwise. (The current implementationnever fails).14.8.5 SetNamebool SetName ( std : : string name )Sets the name of the interface. Returns true if the name was successfully set and false otherwise. (The currentimplementation never fails).14.8.6 SetBriefbool SetBrief ( std : : string brief )Sets the brief description of the interface. Returns true if the brief was successfully set and false otherwise. (Thecurrent implementation never fails)14.8.7 AddDetailbool AddDetail ( const std : : string& detail )Add a line to the detailed description of the interface. Returns true if the add was successful and false otherwise.(The current implementatin never fails)14.8.8 GetOrderPriorityint GetOrderPriority ( )const


220 Chapter 14. OESystem Classes and Member FunctionsReturns the order priority of the interface.14.8.9 GetNamestd : : string GetName ( )constReturns the name of the interface.14.8.10 GetBriefstd : : string GetBrief ( )constReturns the brief description of the interface.14.8.11 GetDetailOEIterBase∗ GetDetail ( )constReturns the detailed description of the interface.14.8.12 AddParameterOEParameter∗ AddParameter ( std : : string classid )Adds a parameter to the interface. The returned pointer points to the newly created parameter. This memory isOWNED by the OEInterface object. If the add fails NULL will be returned.The implimentation of the returned OEParameter pointer will always be a subclass oftemplate OETypedParameterwhich is documented here in section 16.8. The specific type depends upon the value of classid as follows :string TT is std::string parameterdouble TT is double parameterfloat TT is float parameterbool TT is bool parameterint TT is int parameterfile TT is OEPlatform::oeisstream parameterparam file TT is OEPlatform::oeisstream and additionally the parameter is specially recognized byOEParseCommandLine as a text file holding parameter settings.Once functionnamespace <strong>OEChem</strong> { void OERegisterMolParameters ( ) ; }in the <strong>OEChem</strong> libarary is called the following addtional values of classid will be valid.


14.8. OEInterface 221OEGraphMol TT is OEGraphMol.OEMol TT is OEMol.A NULL pointer will be returned and no parameter will be created if a recognized value of classid is not passed.14.8.13 DeleteParameterbool DeleteParameter ( OEParameter& param )Delete a parameter, param, owned by this OEInterface. The function returns true if the delete succeeds and falseotherwise. The parameter must be owned by the OEInterface object to be deleted (it will not delete parameters thatbelong to child OEInterface objects of this OEInterface).14.8.14 GetParameterOEParameter∗ GetParameter ( std : : string name )const OEParameter∗ GetParameter ( std : : string name )Returns a pointer to a parameter with a given name owned by the OEInterface object or one of it’s child interfaces(or child’s child OEInterface, etc etc). If no such parameter exists NULL is returned.14.8.15 GetTypedParametertemplate OETypedParameter∗ GetTypedParameter ( string name )template const OETypedParameter∗ GetTypedParameter ( string name ) constReturns a pointer to a typed parameter with a given name and type TT owned by the OEInterface object or one ofit’s child interfaces (or child’s child OEInterface, etc etc). If a parameter with the given name and type TT is notcontained by the OEInterface NULL is returned.14.8.16 GetParametersOEIterBase< OEParameter>∗ GetParameters ( bool recursive = true )OEIterBase∗ GetParameters ( bool recursive = true ) constReturns an iterator over all parameters with OEInterface holds. If recursive is true the search is recursive includingparameters held by all child OEInterfaces and there children in arbitrary order. If recursive is false parametersheld by child interfaces will not be included and they will be sorted by the parameters order priority (lowest valuesfirst), followed by name.14.8.17 AddInterfaceOEInterface∗ AddInterface ( )


222 Chapter 14. OESystem Classes and Member FunctionsAdds a child OEInterface and returns a pointer to the newly created class (which is owned by the current OEInterfaceclass).14.8.18 DeleteInterfacebool DeleteInterface ( OEInterface& itf )Delete a child OEInterface. itf is the child OEInterface to be deleted. True is returned if the deletion is successfuland false otherwise. itf must be directly owned by the OEInterface, not one of its child interfaces.14.8.19 GetInterfaceOEInterface∗ GetInterface ( std : : string name )const OEInterface∗ GetInterface ( std : : string name )Returns a pointer to a child parameter with a given name owned by any child OEInterface. The search is recursivesearching through all childs child OEInterfaces, etc etc. If no such parameter exists NULL is returned.14.8.20 GetInterfacesOEIterBase< OEInterface>∗ GetInterfaces ( bool recursive = false )OEIterBase∗ GetInterfaces ( bool recursive = false ) constReturns and iterator over all child interfaces of this class. If recursive is true, the iterator will include all of thechildrens OEInterfaces recursively in arbitrary order. If recursive is false only the imediate child interfaces will bereturned, and they will be sorted by GetOrderPriority() (lowest values first) and then name.14.8.21 Parentconst OEInterface∗ Parent ( )OEInterface∗ Parent ( )constReturns a pointer to the parent OEInterface of this object, or NULL if this OEInterface object doesn’t have a parent.14.8.22 Clearbool Clear ( )Returns the OEInterface object to the default constructed state of an OEInterface.14.8.23 ConstructorOEInterface ( )Works normally.14.8.24 Destructor


14.9. OEParameter 223˜ OEInterface ( )Works normally.14.8.25 Copy ConstructorOEInterface ( const OEInterface&)Works normally.14.8.26 Assignment operatorOEInterface& operator=(const OEInterface&)Works normally.14.9 OEParameterThe OEParameter class is Beta in <strong>OEChem</strong> version 1.314.9.1 IsSetbool IsSet ( )constThis method is equivalent to the expression GetHasValue() || GetHasDefault().14.9.2 SetNamebool SetName ( std : : string name )Sets the name of the parameter, which must be a single word and begin with ’-’. The function returns true if theset succeeded.14.9.3 SetBriefbool SetBrief ( std : : string brief )Sets the brief description of the parameter. The function returns true if the set succeeded. Currently this functionalways succeeds for any parameter implemented by OpenEye.14.9.4 SetStringValuebool SetStringValue ( std : : string string_value )


224 Chapter 14. OESystem Classes and Member FunctionsSets the value of the parameter as a string. This string value is not converted into the real value until the LoadValuemember function is called. The function returns true if the set succeeded. Currently this function always succeedsfor any parameter implemented by OpenEye.14.9.5 SetStringDefaultbool SetStringDefault ( std : : string string_default )Sets the default value of the parameter as a string. This string default is not converted into the read default untilthe LoadDefault member function is called.14.9.6 SetHasValuebool SetHasValue ( bool has_value )Set the flag indicating if the value of the parameter has been set. The function returns true if the set succeeded.Currently this function always succeeds for any parameter implemented by OpenEye.14.9.7 SetHasDefaultbool SetHasDefault ( bool has_default )Set the flag indicating if the default of the parameter has been set. The function returns true if the set succeeded.Currently this function always succeeds for any parameter implemented by OpenEye.14.9.8 SetRequiredbool SetRequired ( bool required )Set the flag indicating if the parameter is required. The function returns true if the set succeeded. Currently thisfunction always succeeds for any parameter implemented by OpenEye.14.9.9 SetKeylessbool SetKeyless ( unsigned int keyless )Set the keyless setting of the parameter. The function returns true if the set succeeded. Currently this functionalways succeeds for any parameter implemented by OpenEye.14.9.10 SetVisibilitybool SetVisibility ( unsigned int visibility )Set the visibility of the parameter. Valid settings areParamVis::Simple ParamVis::Normal ParamVis::Hidden


14.9. OEParameter 225Other values will be ignored and the function will return false.14.9.11 SetOrderPrioritybool SetOrderPriority ( int order )Sets the order priority of the parameter, which is used to control the order parameters appear in help lists. Thisfunction currently always returns true.The order priority flag affects the ordering of parameters returned by the OEInterface class’s member functionGetParameters(false).14.9.12 AddDetailbool AddDetail ( const std : : string& detail )Add a line to the detailed description of the parameter. This function currently always returns true.14.9.13 AddAliasbool AddAlias ( std : : string alias )Add and alias name for this parameter. The alias must be a single word and begin with a ’-’. This function returnstrue if the alias is valid and the add succeeds.14.9.14 AddLegalValuebool AddLegalValue ( std : : string val )Add a legal value in string format. This function succeeds and returns true if the parmaeter can have legal values.As a special case for string parameters val can be a pattern with up to two * wildcards.14.9.15 AddIllegaValuebool AddIllegalValue ( std : : string val )Add an illegal value in string format. This function succeeds and returns true if the parmaeter can have legal valuesand false otherwise. As a special case for string parameters val can be a pattern with up to two * wildcards.14.9.16 AddLegalRangebool AddLegalRange ( std : : string hi_val , std : : string low_val )Add a legal range for the parameter in string format. This function succeeds and returns true if the parameter canhave legal ranges and false otherwise. Currently only int, float and double parameters can have legal ranges, andfor these parameters inf and -inf are legal high and low values respectively.14.9.17 AddIllegalRange


226 Chapter 14. OESystem Classes and Member Functionsbool AddIllegalRange ( std : : string hi_val , std : : string low_val )Add an illegal range for this parameter in string format. This function succeeds and returns true if the parametercan have illegal ranges and false otherwise. Currently only int, float and double parameters can have illegal ranges,and for these parameters inf and -inf are legal high and low values respectively.14.9.18 GetNamestd : : string GetName ( )constReturns the name of the parameter set.14.9.19 GetBriefstd : : string GetBrief ( )constReturns the brief description of the parameter.14.9.20 GetStringValuestd : : string GetStringValue ( )constReturns the string value of the parameter.14.9.21 GetStringDefaultstd : : string GetStringDefault ( )constReturns the string default of the parameter.14.9.22 GetHasValuebool GetHasValue ( )constReturns true if the parameters value is set.14.9.23 GetHasDefaultbool GetHasDefault ( )constReturns true if the parameters default is set.14.9.24 GetRequiredbool GetRequired ( )const


14.9. OEParameter 227Returns true if the parameter is required.14.9.25 GetKeylessunsigned int GetKeyless ( )constReturns the keyless setting of the parameter.14.9.26 GetVisibilityunsigned int GetVisibility ( )constReturns the visibility of the parameter.14.9.27 GetOrderPriorityint GetOrderPriority ( )constReturns the order priority of the parameter.The order priority flag affects the ordering of parameters returned by the OEInterface class’s member functionGetParameters(false).14.9.28 GetDetailOEIterBase∗ GetDetail ( )constReturns the detailed description of the parameter.14.9.29 GetAlaisesOEIterBase∗ GetAliases ( )constReturns the aliases of the parameter.14.9.30 GetLegalValuesOEIterBase∗ GetLegalValues ( )constReturns the parameters legal values in string format.14.9.31 GetIllegalValuesOEIterBase∗ GetIllegalValues ( )constReturns the parameters illegal values in string format.14.9.32 GetLegalRanges


228 Chapter 14. OESystem Classes and Member FunctionsOEIterBase∗ GetLegalRanges ( ) constReturns the parameters legal ranges in string format.14.9.33 GetIllegalRangesOEIterBase∗ GetIllegalRanges ( ) constReturns the parameters illegal ranges in string format.14.9.34 Loadbool Load ( )This method is equivalent to LoadValue() &&LoadDefault().14.9.35 LoadValuebool LoadValue ( )Converts the string value of this parameter into actual value returned by OETypedParameter’s GetValue memberfunction. This functin will return not succeed and return false if the string value cannot be converted to the actualvalue, or if passing GetStringValue to IsLegalString returns false.14.9.36 LoadDefaultbool LoadDefault ( )Converts the string default of this parameter into actual default returned by OETypedParameter’s GetValue memberfunction. This functin will return not succeed and return false if the string default cannot be converted to the actualdefault, or if passing GetStringValue to IsLegalString returns false.14.9.37 IsLegalStringbool IsLegalString ( std : : string setting ) constReturns if the given setting in string format is a legal value. A setting is considered a legal value if it does not matchand illegal value or fall within an illegal range (see AddIllegalValue and AddIllegalRange member functions ofthis class). Additionally if the parameter has at least one legal value or legal range the setting must match either alegal value or legal range (see AddIllegalValue and AddIllegaRange member functions).14.9.38 IsSetToStringbool IsSetToString ( std : : string val ) constThis function converts val from a string the the actual parameter type and then returns false unless one of thefollowing conditions is met.1. The parameter’s value is set and that value matches val.


14.9. OEParameter 2292. The parameter’s value is not set, but the parameters default is set and the default matches val.14.9.39 TypeParameterTypeIDconst void∗ ParameterTypeID ( )constReturns OEGetDataType¡TT¿(), where TT is the OETypedParameter¡TT¿ this parameters implementation classderives from. (All implementations of OEParameter must derive from OETypedParameter¡TT¿).14.9.40 ClassIDstd : : string ClassID ( )constReturns the class id this parameters implementation class was registered to OEInterface::Factory() with.14.9.41 WriteValueAndDefaultBinarysize_t WriteValueAndDefaultBinary ( unsigned char∗) constWrites the current value and default of this parameters (as returned by GetValue and GetDefault of OETypedParameter¡TT¿)as a platform independent binary.14.9.42 ReadValueAndDefaultBinarysize_t ReadValueAndDefaultBinary ( const unsigned char∗)Reads and sets the currentl value and default of this parameter from the binary written by WriteValueAndDefault-Binary.14.9.43 ValueAndDefaultBinarySizesize_t ValueAndDefaultBinarySize ( )constReturns the size of the binary that will be written by WriteValueAndDefaultBinary.14.9.44 CreateCopyOEParameter∗ CreateCopy ( )constCreates a copy of this parameter.14.9.45 Destructorvirtual ˜ OEParameter ( ) {}


230 Chapter 14. OESystem Classes and Member Functions14.10 OERandomclass OERandom14.10.1 ConstructorOERandom ( bool timeseed=false )The <strong>OEChem</strong> class provides a portable pseudo-random number generator. The Boolean “timeseed” argument tothe OERandom constructor indicates whether the pseudo random number generator should initialize (or seed) itssequence from the system clock.14.10.2 NextFloatfloat NextFloat ( )Return the next pseudo-random floating point value in the range [0.0, 1.0). To convert this value into an integerrange, for example 10 discrete values, use int i = (int)floor(10.0*r.NextFloat()), which shouldreturn values in the range 0 to 9 inclusive.14.10.3 Seedvoid Seed ( unsigned int seed )Set the pseudo random number generator seed to a given value. The OERandom class uses a deterministic linearcongruential class of pseudo random number generator (PRNG). Setting the seed to a specific value, causes thesequence of subsequent NextFloat values to be identical on all platforms. This may be useful for testing stochasticalgorithms on different architectures/operating systems.14.10.4 TimeSeedvoid TimeSeed ( )Set the pseudo random number generator seed from the system clock.14.11 OEStopwatchclass OEStopwatchThe <strong>OEChem</strong> OEStopwatch class provides a portable mechanism for measuring elapsed CPU time of a process.14.11.1 Elapsedfloat Elapsed ( )


14.11. OEStopwatch 231Return the number of elapsed CPU seconds (as a floating point value) since OEStopwatch::Start was last called.This method is identical to OEStopwatch::Lap. This method does not update the internal “start” time.14.11.2 Lapfloat Lap ( )Return the number of elapsed CPU seconds (as a floating point value) since OEStopwatch::Start was last called.This method is identical to OEStopwatch::Elapsed. This method does not update the internal “start” time.14.11.3 Startvoid Start ( )Set the internal “start” time of the OEStopwatch to the current time. This method should be called before callingeither OEStopwatch::Elapsed or OEStopwatch::Start. This method may be called more than once to reinitializethe “start” time to the current time.


CHAPTERFIFTEENOESystem Functions15.1 OEBitVectorAndOEBitVector OEBitVectorAnd ( const OEBitVector &a ,const OEBitVector &b )The OEBitVectorAnd function returns Boolean conjunction (or ‘and’) of two OEBitVectors. The result will havethe same number of bits as the larger of the two operands. This function is identical to the ’&’ operator of twoOEBitVectors.15.2 OEBitVectorEqualbool OEBitVectorEqual ( const OEBitVector &a ,const OEBitVector &b )The OEBitVectorEqual function determines whether two OEBitVectors are considered equal. The twoOEBitVectors are only considered equal if they have the same size, i.e. a.GetSize() == b.GetSize(),and all of the bits have the same value.15.3 OEBitVectorNotOEBitVector OEBitVectorNot ( const OEBitVector &bv )The OEBitVectorNot function returns the Boolean negation (or inversion) of an OEBitVector. The resultwill have the same number of bits as the argument. This function is identical to the ’˜’ operator of anOEBitVector.15.4 OEBitVectorOrOEBitVector OEBitVectorOr ( const OEBitVector &a ,const OEBitVector &b )232


15.5. OEBitVectorSub 233The OEBitVectorOr function returns the Boolean disjunction (or ‘or’) of two OEBitVectors. The result willhave the same number of bits as the larger of the two operands. This function is identical to the ’—’ operator oftwo OEBitVectors.15.5 OEBitVectorSubOEBitVector OEBitVectorSub ( const OEBitVector &a ,const OEBitVector &b )The OEBitVectorSub function returns the Boolean difference of two OEBitVectors. This function returnsan OEBitVector where each bit is set only if that position is set in the first operand and clear in the second, i.e.a &˜b. The result will have the same number of bits as the larger of the two operands. This function is identicalto the ’-’ operator of two OEBitVectors.15.6 OEBitVectorXorOEBitVector OEBitVectorXor ( const OEBitVector &a ,const OEBitVector &b )The OEBitVectorXor function returns that Boolean exclusive or (or ’xor’) of two OEBitVectors. This functionreturns an OEBitVector where each bit is set only if the equivalent bit positions in the two operands have differentvalues. The result will have the same number of bits as the large of the two operands. This function is identical tothe ’ˆ’ operator of two OEBitVectors.15.7 OEGetTagThe OEGetTag functions serve to associate a text string tag with a corresponding unsigned integer tag. Becauseinteger comparisons are often faster than character string comparisons, operations which require a potentially largenumber of data comparisons may benefit by using integer instead of string data. The OEGetTag functions serveto associate, store and retrieve string and integer tags.const char ∗OEGetTag ( unsigned int tag )This function retrieves a character string tag associated with an integer tag. If no string tag has been associatedwith the passed integer tag, a pointer to a null-terminated pointer character string is returned. The function shouldalways return a non-zero pointer.unsigned int OEGetTag ( const std : : string &tag )This function retrieves an integer tag associated with the character string stored in the STL string object. The firstcall to OEGetTag with a particular character string creates an association with an arbitrary unique integer, andreturns the associated integer tag. Subsequent calls to OEGetTag with the same character string value return theassociated integer tag. No guarantees are made regarding the allocation of integer values associated with characterstring values.unsigned int OEGetTag ( const char ∗tag )This function retrieves an integer tag associated with a constant character string. The first call to OEGetTag with aparticular character string creates an association with an arbitrary unique integer, and returns the associated integer


234 Chapter 15. OESystem Functionstag. Subsequent calls to OEGetTag with the same character string value return the associated integer tag. Noguarantees are made regarding the allocation of integer values associated with character string values.15.8 OEGetThreadSafebool OEGetThreadSafe ( )This function reports whether OESystem memory allocation uses thread-safe mutual exlusion to access its datastructures. By default, this value is true. This allows <strong>OEChem</strong> molecules and other toolkit objects to be allocatedand deallocated simultaneously in concurrent operating system threads. However, for applications that only havea single thread of execution, the use of thread-safe memory allocation can cause a small performance overheadon some platforms. Setting this value to false, using the OESetThreadSafe function can be used to instructOESystem (and the toolkits built upon it) to use faster implementations when it is known to be safe.15.9 OEHasTagThe OEHasTag functions test whether an association exists between a character string tag and a correspondinginteger tag identifier using the OEGetTag function (Section 15.7).bool OEHasTag ( unsigned int tag )This function returns true if an association exists between the passed integer tag and a character string tag. If noassociation has been made the function returns false.bool OEHasTag ( const std : : string &s )This function returns true if an association exists between the character string tag contained in the STL stringpassed to the function and an integer tag. If no association has been made the function returns false.15.10 OENumberToStringThe OENumberToString functions convert numerical values into ASCII strings.bool OENumberToString ( short value , std : : string &str ,int base = 10)bool OENumberToString ( unsigned short value , std : : string &str ,int base = 10)bool OENumberToString ( int value , std : : string &str ,int base = 10)bool OENumberToString ( unsigned int value , std : : string &str ,int base = 10)bool OENumberToString ( OELongLong value , std : : string &str ,int base = 10)bool OENumberToString ( OEULongLong value , std : : string &str ,int base = 10)bool OENumberToString ( double value , std : : string &str ,char form = ’f’ , int prec = 6)


15.11. OESetThreadSafe 235These functions convert the specified value into an ASCII formatted string in the specified base. The strparameter is assigned the value of the resulting string and the functions returns whether or not the conversion wassuccessful. The prec parameter specifies the precision with which a floating-point value should be converted to astring. The form parameter specifies the format in which the floating-point value should be displayed. Acceptablevalues for this parameter are: f, F, e, E, g, and G. Specifying any of these values is equivalent to using that valueafter the percent sign in a printf statement.std : : string OENumberToString ( short value , int base = 10)std : : string OENumberToString ( unsigned short value , int base = 10)std : : string OENumberToString ( int value , int base = 10)std : : string OENumberToString ( unsigned int value , int base = 10)std : : string OENumberToString ( OELongLong number , int base = 10)std : : string OENumberToString ( OEULongLong number , int base = 10)std : : string OENumberToString ( double number , char f = ’f’ ,int prec = 6)These functions convert the specified value into an ASCII formatted string in the specified base and then returnthe resulting string. If the conversion failed, an empty string will be returned. The prec parameter specifies theprecision with which a floating-point value should be converted to a string. The form parameter specifies theformat in which the floating-point value should be displayed. Acceptable values for this parameter are: f, F, e, E, g,and G. Specifying any of these values is equivalent to using that value after the percent sign in a printf statement.15.11 OESetThreadSafebool OESetThreadSafe ( )The OESetThreadSafe function controls whether the internal memory allocation and deallocation routinesused by <strong>OEChem</strong> (and other OpenEye tookits) should use slower thread-safe implementations, or faster singlethreadedversions. By default, this value is true. This allows <strong>OEChem</strong> molecules and other toolkit objects to beallocated and deallocated simultaneously in concurrent operating system threads. However, for applications thatonly have a single thread of execution, the use of thread-safe mutual exclusion can cause a small performanceoverhead on some platforms. The current setting can be inspected by calling the OEGetThreadSafe function.15.12 OEStringJoinstd : : string OEStringJoin ( const std : : list &strgrp ,const std : : string &delim = " " )std : : string OEStringJoin ( const std : : vector &strgrp ,const std : : string &delim = " " )This function returns a new string created by concatenating the contents of the specified group of strings (strgrp)together delimited by the specified parameter (delim).15.13 OEStringLowerstd : : string OEStringLower ( const std : : string &str )


236 Chapter 15. OESystem FunctionsThis function returns a copy of the specified string (str) with all of its letters in lower-case format.15.14 OEStringMatchbool OEStringMatch ( const std : : string& str , const std : : string& pattern )Returns whether or not the specified pattern string (pattern) matches the specified search string (str). Stringmatching is case-sensitive and wildcards are limited to no more than two per pattern.15.15 OEStringSimplifyWhiteSpacestd : : string OEStringSimplifyWhiteSpace ( const std : : string &str )Returns a copy of the specified string parameter (str) which has had all contiguous whitespace characters convertedto a single ’ ’.15.16 OEStringStripWhiteSpacestd : : string OEStringStripWhiteSpace ( const std : : string &str )Returns a copy of the specified string parameter (str) which has had all whitespace characters at the beginningand the end of the text string removed.15.17 OEStringTokenizebool OEStringTokenize ( std : : list &strgrp ,const std : : string &str ,const std : : string &delim = " \t\n" )bool OEStringTokenize ( std : : vector &strgrp ,const std : : string &str ,const std : : string &delim = " \t\n" )These functions break up the specified input string (str) into individual tokens based on the specified delimiters(delim). The resulting tokens are stored in the specified string group (strgrp). This function always returnstrue.15.18 OEStringTokenizeQuotedbool OEStringTokenizeQuoted ( std : : list &strgrp ,const std : : string &str ,const std : : string &delim = " \t\n" ,const std : : string &quote = "\’\"" )bool OEStringTokenizeQuoted ( std : : vector &strgrp ,const std : : string &str ,


15.19. OEStringToNumber 237const std : : string &delim = " \t\n" ,const std : : string &quote = "\’\"" )These functions break up the specified input string (str) into individual tokens based on the specified delimiters(delim) while maintaining the integrity of quoted text specified by quote delimiters (quote). The resultingtokens are stored in the specified string group (strgrp). This function always returns true.15.19 OEStringToNumberbool OEStringToNumber ( const std : : string &str , short &val , int b = 10)bool OEStringToNumber ( const std : : string &str , unsigned short &val , int b = 10)bool OEStringToNumber ( const std : : string &str , int &val , int b = 10)bool OEStringToNumber ( const std : : string &str , unsigned int &val , int b = 10)bool OEStringToNumber ( const std : : string &str , OELongLong &val , int b = 10)bool OEStringToNumber ( const std : : string &str , OEULongLong &val , int b = 10)bool OEStringToNumber ( const std : : string &str , float &val )bool OEStringToNumber ( const std : : string &str , double &val )These functions attempt to convert the specified string (str) into a numerical value in the specified base (b) andstore the generated value in the format appropriate to the passed parameter (val). The function returns whetheror not this conversion was successful. If the function fails, val is set to 0.15.20 OEStringTranslatestd : : string OEStringTranslate ( const std : : string &str )This function currently returns a copy of the input string. It exists as a placeholder for future internationalizationsupport.15.21 OEStringUpperstd : : string OEStringUpper ( const std : : string &str )This function returns a copy of the specified string (str) with all of its letters in upper-case format.15.22 OETanimotodouble OETanimoto ( const OEBitVector &a , const OEBitVector &b )The OETanimoto function calculates the “Tanimito similarity coefficient” between two OEBitVectors. This isdefined as the number of bits that the two bitmaps/fingerprints have in common divided by the total of bits set ineither. This function does not require that the two OEBitVectors be the same size, the bits lacking from the shorterOEBitVector being interpreted as all zeros. This function always returns 1.0, if the two OEBitVectors are equal,


238 Chapter 15. OESystem Functionseven if they are both empty.15.23 OEConfigurebool OEConfigure ( OEInterface& itf , const unsigned char∗ configdata )This function provides a mechanism for adding parameters and child OEInterface’s to an OEInterface object, itf,by parsing a specifically formatted text file. The text file must be converted into a null terminated character arrayat compile time, and passed as the configdata to this function. The format of the config file is a series ofparameter or category records.15.23.1 Parameter record formatWhen OEConfigure encounters a parameter record, it adds an OEParameter object to the OEInterface. A parameterrecord takes the following form.! PARAMETER [ order priority ]! TYPE ! ALIAS ! BRIEF ! DEFAULT ! REQUIRED ! VISIBILITY ! KEYLESS ! LEGAL_VALUE ! ILLEGAL_VALUE ! LEGAL_RANGE ! ILLEGAL_RANGE ! DETAIL...! ENDThe order of individual fields appear within the parameter record is unimportant. Each parameter record mustbegin with !PARAMETER and end with !END, and each record must have a !TYPE field. All other fields withinthe parameter record are optional. So the simplest possible parameter record is.! PARAMETER [ order priority ]! TYPE ! ENDWhen OEConfigure parses this record it does the equivilant of the following C++ code.OEParameter∗ param = itf . AddParameter();param−>SetName();param−>SetOrderPriority ( [ order priority ] ) ;If [order priority] isn’t specified, zero is assumed.Legitamate values of arestring Creates a std::string parameter


15.23. OEConfigure 239double Creates a double parameterfloat Creates a float parameterbool Creates a bool parameterint Creates a int parameterfile Creates a OEPlatform::oeisstream parameterparam file Creates a OEPlatform::oeisstream parameter that is recognized as a text file holding parametersettings, by OEParseCommandLine.The remaining fields in a parameter record are optional and do the following:!ALIAS aliasparam−>AddAlias ( alias ) ;This field can appear multiple times.!BRIEF brief descriptionparam−>SetBrief ( brief description ) ;This field can only appear once.!DEFAULT default valueparam−>SetStringDefault ( default value ) ;This field can only appear once.!REQUIRED true or falseparam−>SetRequired ( true or false ) ;This field can only appear once.!VISIBILITY visibilityVisibility must be either “simple”, “normal” or “hidden” (without quotes). This causes either:param−>SetVisiblity ( ParamVis : : Simple ) ;param−>SetVisiblity ( ParamVis : : Normal ) ;param−>SetVisiblity ( ParamVis : : Hidden ) ;to be called respectively. This field can only appear once in a parameter record.!KEYLESS keyless settingparam−>SetKeyless ( keyless setting ) ;The keyless setting must be a non-negative integer. This field can only appear once in a parameter record.!LEGAL VALUE valueparam−>AddLegalValue ( value ) ;Parameters of type bool cannot have a !LEGAL VALUE field. This field can appear multiple times in aparameter record.


240 Chapter 15. OESystem Functions!ILLEGAL VALUE valueparam−>AddIllegalValue ( value ) ;Parameters of type bool cannot have an !ILLEGAL VALUE field. This field can appear multiple times ina parameter record.!LEGAL RANGE hi value low valueparam−>AddLegalRange ( hi value , low value ) ;Parameters of type bool, string, file and file param cannot have a !LEGAL RANGE field. Thisfield can appear multiple times in a parameter record.!ILLEGAL RANGE hi value low valueparam−>AddIllegalRange ( hi value , low value ) ;Parameters of type bool, string, file and file param cannot have an !ILLEGAL RANGE field.This field can appear multiple times in a parameter record.!DETAIL multi-lineAll the lines following the !DETAIL keyword up until a line beginning with another parameter record keywordare added to the parameter.This field can only appear once.15.23.2 Category record formatWhen OEConfigure encounters a category record it adds a child OEInterface object to the current OEInterface. Acategory record takes the following form:! CATEGORY [ order priority ]! DETAIL[ detailed description line 2][ detailed description line 3]...! BRIEF [ Parameter Record ][ Category Record ]! ENDThe order individual fields appear within the category record is unimportant. All fields within the category recordare optional. So the following is the minimal category allowed:! CATEGORY [ order priority ]! ENDWhen parsed by OEConfigure is equivilant to:OEInterface∗ child_itf = itf . AddInterface ( ) ;child_itf−>SetName();child_itf−>SetOrderPriority ( [ order priority ] ) ;If [order priority] is not specified 0 is assumed.Fields within the category record have the following meaning:


15.24. OECheckHelp 241!DETAIL multi-lineAll the lines following the !DETAIL keyword up until a line beginning with another category record keywordare added to the parameter.This field can appear once in a category record.!BRIEF brief descriptionparam−>SetBrief ( brief description ) ;This field can only appear once.parmameter record Parameter records can appear inside category records. Their format is the same as thoseoutside the category record, however the parameter will be added to the child interface. A category recordcan hold any number of parameter records.category record Category records can be nested within category records, thus creating a child OEInterfaceof a child OEInterface. There is no limit to the depth of nesting, and any number of nested category recordscan appear within a category record.15.24 OECheckHelpbool OECheckHelp ( const OEInterface& itf ,int argc ,char∗∗ argv ,bool help_for_no_args = true ,OEPlatform : : oeostream& ostr = OEERR ) ;This function checks if the command line entered by the user is requesting help for the programs interface. Thisfunction returns false and does nothing unless the first argument on the command line is “−−help”. If no argumentfollows help the following is sent to ostr.{program name} --help simple : Get a list of simple parameters{program name} --help all: Get a complete list of parameters{program name} --help defaults : List the defaults for all parameters{program name} --help : Get detailed help on a parameter{program name} --help html : Create an html help file for this programWhere program name is argv[0]. This list will also be shown if there are no command line arguments (i.e.,argc == 1) and help for no args is true.The help keywords do the following.simple Lists all simple parameters (i.e., those for which GetVisiblity returns ParamVis::Simple) andtheir brief description known to the itf or any of its child interfaces. Parameters appear in a hierarchy identicalto the hierarchy of the itf object and its child OEInterfaces. Parameters of a given OEInterface are sortedfirst by there order priority (e.g., the value returned by GetOrderPriority) and second alphabetically.Output is sent to ostr.all Lists all non-hidden parameters parameters (i.e., those for which GetVisiblity does not returnParamVis::Hidden) and their brief description known to the itf or any of its child interfaces. Parametersappear in a hierarchy identical to the hierarchy of the itf object and its child OEInterfaces. Parameters of agiven OEInterface are sorted first by there order priority (e.g., the value returned by GetOrderPriority)and second alphabetically. Output is sent to ostr.


242 Chapter 15. OESystem Functionsdefault Lists the defaults of all non-hidden parameters (i.e., those for which GetVisibility does not returnParamVis::Hidden). Parameters without a default will be listed with a message indicating theyhave no default. Parameters appear in a hierarchy identical to the hierarchy of the itf object and its childOEInterfaces. Parameters of a given OEInterface are sorted first by there order priority (e.g., thevalue returned by GetOrderPriority) and second alphabetically. Output is sent to ostr. Lists the brief and detailed description of a specific parameter as well as its type, visibility,default, required flag, keyless setting and any legal or illegal ranges or values. Output is sent to ostr.-html Creates an html help file ”argv[0] help.html” for the itf object.15.25 OEParseCommandLinebool OEParseCommandLine ( OEInterface& itf ,int argc ,char∗∗ argv ,const unsigned char∗ requirements = NULL ,unsigned int error_level = OEErrorLevel : : Error ) ;The overall purpose of this function is to set parameters in the itf object by parsing the command line, argc andargv. This function returns true if it was successful and false otherwise. Errors are reported at error level toOEThrow.Parameters are entered in key-value pairs after the executable name on the command line.E.g.program The order in which the parameter key-value pairs appear on the command line is unimportant, except when thesame key is specified twice in which case the second value specified is used.E.g.program is the same as the preceding example.The following special case rules also apply when parsing the command line.1. Boolean parameter keys can optionally not be followed by a boolean value in which case the boolean parameteris set to true. E.g.,andprogram −b true −x 5program −b −x 5are equivilant, provided that -b is a boolean parameter.2. Parameters of type ”param file” will be assumed to be text files containing key-value parameter pairs forthe OEInterface object, itf. These files will be parsed and the parameters set accordingly. The format ofthese files should be one key-value pair per line. Blank lines and lines begining with # will be ignored. If aparameter is set both in a parameter file and on the command line, the command line setting will be used.


15.25. OEParseCommandLine 2433. Parameters with non-zero keyless values (see GetKeyless() method of OEParameter) can be entered atthe end of the command line as a value without a key. The format is as followsprogram [ ] . . . [ ] . . .Any number of key-value pairs can be entered on the command line before the keyless values. Parsing fromleft to right the first argument on the command line not recognized as a key-value pair is assigned to theparameter with the keyless value 1. Additional arguments beyond the first are assigned to the parameter withkeyless value 2, 3, 4 and so on. If the itf object does not have a parameter with the appropriate keyless valueor has more than one parameter with the appropriate keyless value an error will be reported and the functionwill return false.Note: There is a potential ambiguity in the command line when the last key-value pair specified before thefirst keyless parameter is a boolean, as in the following example.program −b true keylessvalueIf -b is a boolean parameter true could either be the setting of -b or the first keyless parameter. OEParseCommandLineresolves this by always assuming that true, or any valid boolean setting (i.e., true/yes/on/t/y orfalse/no/off/f/n), is a setting for the boolean parameter -b and NOT the first keyless value.After OEParseCommandLine parses the command line it then checks that all required parameters have been set. Ifall required parameters have not been set an error is issued and the function returns false.The following are the types of requirements:single parameter requirements This type of requirement forces that a particular parameter must bespecified on the command line, in a parameter file, or by a default value. This requirement is turned on usingthe SetRequired method of the OEParameter class (or the !REQUIRED field on OEConfigure).multi-parameter requirements This type of requirement can include inter-dependent settings of parameters.These requirements are specified by passing requirements to this function, which is a speciallyformatted text file that has been converted into a null terminated character array. The format is a series ofone or more requirement records of the following format.! REQUIREMENT! OPTION [ [ ! ] key [ value ] [ [ ! ] key [ value ] . . .! OPTION [ [ ! ] key [ value ] [ [ ! ] key [ value ] . . ....! ERROR_MSG...! ENDOne or more !OPTION fields may appear in a requirement record. Each !OPTION field is a list of keys,optionally with values, to require. The rules for the format of the !OPTION line are as follows.1. If a key appears on the !OPTION line, but is not followed by a parameter value, then that parametermust have a valid setting (e.g., the parameter method IsSet must return true).2. If a key appears on the !OPTION line followed by a value, then that parameter must be set to thespecified value.3. If a key appears on the !OPTION line preceeded by a !, but is not followed by a parameter value, thenthat parameter must not have a valid setting (e.g., the parameter method IsSet must return false).


244 Chapter 15. OESystem FunctionsIf any !OPTION field of a requirement record is satisfied, the entire requirement is satisfied. No !OPTIONin the requirement record is satisfied, the error message is sent to OEThrow and the function returns false.The following is an example parameter record! REQUIREMENT! OPTION −a 5! OPTION !−b! OPTION −a −b !−c 1! ERROR_MSGThe command line must satisfy one of the following criteion1) −a is set to 52) −b is not set3) −a and −b are set and −c is not set to 1! ENDThis requirement record requires that the settings in itf follow the rules listed between !ERROR MSG and!END. If it does not those lines are sent to OEThrow and the function returns false.15.26 OEParseCommandLineLWbool OEParseCommandLineLW ( OEInterface& itf ,int argc ,char∗∗ argv ,const unsigned char∗ requirements = NULL ,unsigned int error_level = OEErrorLevel : : Error ) ;The overall purpose of this function is to set parameters in the itf object by parsing the command line, argc andargv. This is the same purpose as OEParseCommandLine, however, this function has different rules for parsing thecommand line, most notably nothing is entered as a key-value pair, and is in general designed for small lightweightinterfaces, hence the LW in the function name.When using this function all parameters of itf must fall into one of two categories.1. A boolean parameter with a default value of false and a name begining with a dash followed by a singlecharacter.2. A keyless parameter (i.e., a parameter with a non-zero keyless value).and the command line should be of the following form.program [ boolean parameter keys ] [ keyless parameter values ]boolean parameter keys Boolean parameters with keys listed listed in this part of the command line willbe set to true (those not appearing will use their default value which must be false). The characters of theboolean keys may also be combined into a single argument on the command line. This is easiest to illustratein the following example.andandprogram −a −b −c [ keyless parameter values ]program −abc [ keyless parameter values ]program −c −ba [ keyless parameter values ]


15.27. OEWriteSettings 245Are all equivilant, provided -a, -b and -c are boolean parameters with default values of false.keyless parameter values The first argument not recognized as a boolean parameter will be assigned asthe value of the parameter with a keyless value of 1, the second to the parameter with keyless value of 2, etcetc. If no parameter have the appropriate keyless value, or more than one have the required keyless value areerror is reported, and the function returns false.This function returns true if it was successful and false otherwise. Errors are reported at error level to OEThrow.15.27 OEWriteSettingsbool OEWriteSettings ( OEInterface& itf ,OEPlatform : : oeostream& ostr = OEOUT ,bool include_default = true ) ;The function writes the current setting of itf to ostr.If include default is true all parameter will be listed, otherwise only parameters specified by the user will be listed.The format of this output is such that if ostr is a file stream, the created file can be used as a parameter file (i.e.,passed to a param file parameter) in a subsequent run.The function returns true if it succeeeds and false otherwise.


CHAPTERSIXTEENOESystem Templates16.1 OEAndtemplateclass OEAnd : public OEUnaryPredicateThis class is a composition predicate which generates a predicate which is the logical and operation of the twopredicates passed as arguments.16.1.1 ConstructorOEAnd ( const OEUnaryPredicate &func1 ,const OEUnaryPredicate &func2 )16.2 OEFactorytemplate class OEFactoryThis class allows class instances of BaseClass to be registered with a unique class id, and using that unique ID,the OEFactory class can construct the registered implementation classes.16.2.1 ConstructBaseClass∗ Construct ( const ClassIdType& classid )Constructs an implementation of BaseClass and returns a BaseClass pointer to that object. The memorypointed to is not owned by the OEFactory and is the responsibility of whatever function called Construct.The specified subclass of BaseClass created is the ImplClass registered with classid. If no ImplClassis associated with classid, a NULL pointer is returned and a warning is issued.16.2.2 Registertemplate bool Register ( const ClassIdType& classid )246


16.3. OEGetDataType 247Registers the class ImplClass with the OEFactory under the given classid. ImplClass must be a constructablesubclass of BaseClass. The fuction will return false, and the ImplClass will not be registered, ifthe supplied classid is already in use, and true otherwise.16.3 OEGetDataTypetemplate const void ∗OEGetDataType ( )This template function provides a convenient and efficient mechanism for run-time type identification (RTTI). Aunique const void pointer is returned for each requested data type. Template classes which derive from a base classwhich has a data type identification interface can then be resolved by comparisons to data types returned by theOEGetDataType template function. Type comparisons are valid across compile units. Run-time type identificationusing this function is likely to be more efficient than built-in C++ RTTI.16.4 OEItertemplate class OEIterThe OESystem::OEIter template class is used to represent “iterator” functionality. The template is parameterizedover class T, defining the behavior of iterators of across collections of type T. The iterator can be thought of abehaving like a pointer to type T.OEIters are typically initialized by assigning them the value of an OESystem::OEIterBase (of compatible type T),return from an function.16.4.1 ConstructorsOEIter ( )OEIter ( const OEIter &rhs )OEIter ( const OEIterBase ∗rhs )16.4.2 operator =OEIter& operator = ( OEIterBase ∗rhs )OEIter& operator = ( OEIter &rhs )The assignment operator initializes the OEIter to the given OEIterBase, typically returned by an <strong>OEChem</strong> orOESystem function. If the OEIter has already been initialized, the internal OEIterBase is destroy and replacedwith the new value.An OEIter may be assigned the value of another OEIter in which case a copy of the rhs iterator is made using theOEIter::Copy method.16.4.3 operator ==bool operator ==( const OEIter &rhs ) const


248 Chapter 16. OESystem TemplatesReturns true if the item pointed to by the first iterator is the same as the item pointed to by the second iterator(using pointer equality). This operator is the negation of operator !=.16.4.4 operator !=bool operator !=( const OEIter &rhs ) constReturns true if the item pointed to by the first iterator is not the same as the item pointed to by the second iterator(using pointer inquality). This operator is the negation of operator ==.16.4.5 operator booloperator bool ( ) constReturns true if the current iterator position is valid. This should typically be checked before each dereference ofan iterator.16.4.6 operator − >T∗ operator −> ( )constDereference the iterator as a pointer. This operator returns a pointer to the current item pointed to by the iterator.16.4.7 operator *T& operator ∗ ( ) constDereference the iterator as a reference. This operator returns a C++ reference to the current item pointed to by theiterator.16.4.8 operator ++OEIter& operator ++ ( )The prefix ++ operator advances the iterator one position. A postfix ++ operator is not provided for an OEIter.16.4.9 operator –OEIter& operator −− ( )The prefix -- operator moves the iterator back one position, if possible. A postdix -- operator is not provided foran OEIter.16.4.10 operator +=OEIter& operator += ( int n )


16.5. OEIterBase 249The += operator advances the iterator n places forward.16.4.11 operator -=OEIter& operator −= ( int n )The -= operator attempts to move the iterator n places backward.16.4.12 CopyOEIterBase ∗Copy ( )The OEIter::Copy method may be used to duplicate (make a copy of) an OEIter. The returned value is anewly allocated OEIterBase* that should be immediately assigned to an OEIter. The current location inthe iterator is preserved by the copy.16.4.13 ToFirstOEIter& ToFirst ( )The OEIter::ToFirst method resets the iterator to its first item, if possible.16.4.14 ToLastOEIter& ToLast ( )The OEIter::ToLast method resets the iterator to its last item, if possible.16.4.15 Sortbool Sort ( const OEBinaryPredicate&)The OEIter::Sort method sorts contents of the iterator and resets the iterator to its first item. The reorderingis local to the given instance of the iterator (i.e., the container holding the items the iterator traverses isunchanged). Once this function is called the iterator is never delete safe, even if it normally would be.The OEBinaryPredicate passed to this function is used as the less comparison in the sort. It shouldreturn true if the first argument is less than the second argument and false otherwise. An item that is less thananother item will appear first after sorting.16.5 OEIterBasetemplate class OEIterBaseThe OEIterBase template in OESystem is an internal abstract template class. All iterators returned by OSystemand <strong>OEChem</strong> are pointers to instances derived from this class. However, users should not use or access thisclass/template directly. Instead the OEIterBase pointer should be assigned to an OEIter. The OEIter, for example,


250 Chapter 16. OESystem Templatesensures that the contents of the OEIterBase will be destroyed when the OEIter goes out of scope, thus preventingpotential memory leaks.16.6 OENottemplateclass OENot : public OEUnaryPredicateThis adaptor predicate generates a predicate which is the logical not of the predicate passed in on construction.16.6.1 ConstructorOENot ( const OEUnaryPredicate &func1 )16.7 OEOrtemplateclass OEOr : public OEUnaryPredicateThis adaptor predicate generates a predicate which is the logical or of the two predicates passed in on construction.16.7.1 ConstructorOEOr ( const OEUnaryPredicate &func1 ,const OEUnaryPredicate &func2 )16.8 OETypedParametertemplate class OETypedParameter : public OEParameterAn abstract base class derived from OEParameter which is templated upon the parameter type and adds memberfunctions to access the actual value and default settings of the parameter.16.8.1 GetDefaultbool GetDefault ( TT& dflt ) constGet the current default of the parameter. Returns true if the parameter’s default is set and the get succeeded. Falseis returned otherwise.16.8.2 GetSettingbool GetSetting ( TT& setting ) const{ return GetValue ( setting ) | | GetDefault ( setting ) ; }


16.9. OETypeId 251Get the current setting of the paramter. If the value is set, then the parameter’s value is retrieved, otherwise thecurrent default of the parameter is retrieved. Returns false if neither the value nor the default value were set forthis parameter. True is returned otherwise.16.8.3 GetValuebool GetValue ( TT& value )constGet the current value of the parameter. Returns true if the parameter’s value is set and the get succeeded. False isreturned otherwise.16.8.4 SetDefaultbool SetDefault ( const TT& dflt )Set the parameter default value. Returns true if successful and false otherwise.16.8.5 SetValuebool SetValue ( const TT& value )Set the parameter value. Returns true if successful and false otherwise.16.8.6 TypedParameterTypedIDconst void∗ TypedParameterTypeID ( ) const{ return OEGetDataType(); }16.9 OETypeIdtemplateclass OETypeId16.10 OEUnaryFunctiontemplateclass OEUnaryFunctionvirtual Result operator ( ) ( const Arg &) const = 0 ;virtual OEUnaryFunction ∗CreateCopy ( ) = 0 ;This is the default functor base-class in <strong>OEChem</strong>. It provides an operator() which takes a const argument and isa const function. CreateCopy is a virtual constructor which allows copying of concrete derived objects using areference to this base class.16.10.1 Specializations


252 Chapter 16. OESystem Templatestemplateclass OEUnaryFunctionvirutal Result operator ( ) ( const Arg &) = 0 ;virtual OEUnaryFunction ∗CreateCopy ( ) = 0 ;This is a specialization of the functor base-class in <strong>OEChem</strong>. This specialization provides an operator() whichtakes a const argument and is a volatile. CreateCopy is a virtual constructor which allows copying of concretederived objects using a reference to this base class.templateclass OEUnaryFunctionvirutal Result operator ( ) ( Arg &) const = 0 ;virtual OEUnaryFunction ∗CreateCopy ( ) = 0 ;This is a specialization of the functor base-class in <strong>OEChem</strong>. This specialization provides an operator() whichtakes a volatile argument and is a const. CreateCopy is a virtual constructor which allows copying of concretederived objects using a reference to this base class.templateclass OEUnaryFunctionvirutal Result operator ( ) ( Arg &) = 0 ;virtual OEUnaryFunction ∗CreateCopy ( ) = 0 ;This is a specialization of the functor base-class in <strong>OEChem</strong>. This specialization provides an operator() whichtakes a volatile argument and is a volatile. CreateCopy is a virtual constructor which allows copying of concretederived objects using a reference to this base class.16.11 OEUnaryPredicatetemplateclass OEUnaryPredicate : public OEUnaryFunctionvirtual bool operator ( ) ( const Arg&) const = 0virtual OEUnaryFunction ∗CreateCopy ( ) = 0This abstract base-class defines predicates in <strong>OEChem</strong>. Predicates are a special class of functors which, by convention,has several restriction. These restrictions make predicates predictable and reliable. To the degree possible,these restrictions are enforced by the api. CreateCopy is a virtual constructor which allows copying of concretederived objects using a reference to this base class.By definition, a predicates is a functor which always return a boolean. By convention, the operator() of a predicatedoes not modify the object it takes as an argument and itself is not modified by the evaluation. These conventionsguarentee that the result of a series of predicate evaluations will not be order dependent.


CHAPTERSEVENTEENOESystem Globals17.1 OEThrowOEErrorHandler OEThrowThis is the globally available error handler that is used to report all diagnostics generated by the <strong>OEChem</strong>, OESystemand OEPlatform libraries. The behavior of OEThrow may be customized via the various methods availbleto OEErrorHandler. For example, warning and error messages may be redirected to a file or string stream,instead of to OEPlatform::oeerr (the default).253


Part VOEMath Library254


The OpenEye mathematical math library, OEMath, contains functionality for performing numerical calculations.All functions and constants are in the OEMath namespace.255


CHAPTEREIGHTEENOEMath Constants18.1 Deg2Radconst double Deg2Rad = 0.0174532925199433Conversion coefficient for angles from degrees to radians.18.2 Piconst double Pi = 3.1415926535897931Numerical constant pi, π, the circumference of a circle divided by its diameter.18.3 Pi2const double Pi2 = 6.2831853071795862Twice the numerical value of pi, π. This is the number of radians in a complete revolution.18.4 Rad2Degconst double Rad2Deg = 57.295779513082323Conversion coefficient for angles from radians to degrees.256


CHAPTERNINETEENOEMath Template FunctionsMost of OEMath’s geometry functions operate on co-ordinates, that are represented by arrays of either floats,doubles or long doubles. The use of templates allows these algorithms to be specialized for the type of the coordinates,“T”.By convention, in the declarations described below input read-only parameters are named p, q, r, s, etc..., whilstoutput and in-out parameters are named x, y and z.19.1 OEGeom2DAddtemplatestatic void OEGeom2DAdd ( T ∗x , const T ∗p )templatestatic void OEGeom2DAdd ( T ∗x , const T ∗p , const T ∗q )Two dimensional vector addition. The first form computes x+=p and the second form computes x = p + q.19.2 OEGeom2DAngletemplatestatic double OEGeom2DAngle ( const T ∗p , const T ∗q , const T ∗r )Determine the angle in two dimensions between p, q and r. The result is in radians.19.3 OEGeom2DCopytemplatestatic void OEGeom2DCopy ( T ∗x , const T ∗p )Two dimensional vector assignment. The vector x is assigned the value of p.19.4 OEGeom2DDistance257


258 Chapter 19. OEMath Template Functionstemplatestatic double OEGeom2DDistance ( const T ∗p , const T ∗q )Determine the distance in two dimensions between p and q.19.5 OEGeom2DDistance2templatestatic double OEGeom2DDistance2 ( const T ∗p , const T ∗q )Determine the squared distance in two dimensions between p and q.19.6 OEGeom2DDotProdtemplatestatic double OEGeom2DDotProd ( const T ∗p , const T ∗q )Determine the dot-product in two dimensions between p and q.19.7 OEGeom2DMidpointtemplatestatic void OEGeom2DMidpoint ( T ∗x , const T ∗p , const T ∗q )Two dimensional midpoint calculation. Return x = (p+q)/2.19.8 OEGeom2DNormalizetemplatestatic void OEGeom2DNormalize ( T ∗x )Normalize the two dimensional vector x to a unit vector.19.9 OEGeom2DSubtracttemplatestatic void OEGeom2DSubtract ( T ∗x , const T ∗p )templatestatic void OEGeom2DSubtract ( T ∗x , const T ∗p , const T ∗q )Two dimensional vector subtraction. The first form computes x-=p and the second form computes x = p - q.19.10 OEGeom2DScale


19.11. OEGeom3DAbsTorsion 259templatestatic void OEGeom2DScale ( T ∗x , const T p )templatestatic void OEGeom2DScale ( T ∗x , const T p , const T ∗q )Two dimensional vector scaling. The first form computes x*=p and the second form computes x = p * q.19.11 OEGeom3DAbsTorsiontemplatestatic double OEGeom3DAbsTorsion ( const T ∗p , const T ∗q ,const T ∗r , const T ∗s )Determine the absolute value of the torsion between three dimensional co-ordinates p, q, r and s. The result is inradians.19.12 OEGeom3DAddtemplatestatic void OEGeom3DAdd ( T ∗x , const T ∗p )templatestatic void OEGeom3DAdd ( T ∗x , const T ∗p , const T ∗q )Three dimensional vector addition. The first form computes x+=p and the second form computes x = p + q.19.13 OEGeom3DAngletemplatestatic double OEGeom3DAngle ( const T ∗p , const T ∗q , const T ∗r )Determine the angle in three dimensions between p, q and r. The result is in radians.19.14 OEGeom3DAngleCoordtemplatestatic void OEGeom3DAngleCoord ( T ∗dst , const T∗ center , const T∗ r1 ,T ang , T len )templatestatic void OEGeom3DAngleCoord ( T ∗dst , const T∗ center , const T∗ r1 ,const T∗ n , T ang , T len )19.15 OEGeom3DCopytemplatestatic void OEGeom3DCopy ( T ∗x , const T ∗p )


260 Chapter 19. OEMath Template Functions19.16 OEGeom3DCrossProdtemplatestatic void OEGeom3DCrossProd ( T ∗x , const T ∗p , const T ∗q )templatestatic void OEGeom3DCrossProd ( T ∗x , const T ∗p , const T ∗q ,const T ∗r )19.17 OEGeom3DDistancetemplatestatic double OEGeom3DDistance ( const T ∗p , const T ∗q )19.18 OEGeom3DDistance2templatestatic double OEGeom3DDistance2 ( const T ∗p , const T ∗q )19.19 OEGeom3DDotProdtemplatestatic double OEGeom3DDotProd ( const T ∗p , const T ∗q )19.20 OEGeom3DEulerRotatetemplatestatic void OEGeom3DEulerRotate ( T ∗xyz , const double ∗angles ,unsigned int ncoord )19.21 OEGeom3DMidpointtemplatestatic void OEGeom3DMidpoint ( T ∗x , const T ∗p , const T ∗q )Three dimensional midpoint calculation. Return x = (p+q)/2.19.22 OEGeom3DNormalizetemplatestatic void OEGeom3DNormalize ( T ∗x )


19.23. OEGeom3DRotate 26119.23 OEGeom3DRotatetemplatestatic void OEGeom3DRotate ( T ∗xyz , const U ∗m ,unsigned int ncoord )templatestatic void OEGeom3DRotate ( T ∗xyz , const T ∗m ,unsigned int ∗idx ,unsigned int ncoord )19.24 OEGeom3DRotVectorToTransformtemplatestatic void OEGeom3DRotVectorToTransform ( T ∗m , T ∗tran ,const U ∗p1 , const U ∗p2 ,const V theta )19.25 OEGeom3DSubtracttemplatestatic void OEGeom3DSubtract ( T ∗x , const T ∗p )templatestatic void OEGeom3DSubtract ( T ∗x , const T ∗p , const T ∗q )19.26 OEGeom3DScaletemplatestatic void OEGeom3DScale ( T ∗x , const T p )templatestatic void OEGeom3DScale ( T ∗x , const T p , const T ∗q )19.27 OEGeom3DTorsiontemplatestatic double OEGeom3DTorsion ( const T ∗p , const T ∗q ,const T ∗r , const T ∗s )19.28 OEGeom3DTranslatetemplatestatic void OEGeom3DTranslate ( T ∗xyz , const T ∗t ,unsigned int ncoord )templatestatic void OEGeom3DTranslate ( T ∗xyz , const T ∗t ,


262 Chapter 19. OEMath Template Functionsunsigned int ∗idx ,unsigned int ncoord )19.29 OEGeom3DVolumetemplatestatic double OEGeom3DVolume ( const T ∗p , const T ∗q ,const T ∗r , const T ∗s )19.30 OEGeom3DPlanarCoordtemplatestatic void OEGeom3DPlanarCoord ( T ∗dst , const T∗ center , const T∗ r1 ,const T∗ r2 , T len )19.31 OEGeom3DTetraCoordtemplatestatic void OEGeom3DTetraCoord ( T ∗dst , const T∗ center , const T∗ r1 ,const T∗ r2 , T len )templatestatic void OEGeom3DTetraCoord ( T ∗dst , const T∗ center , const T∗ r1 ,const T∗ r2 , const T∗ r3 , T len )19.32 OEGeom3DEulerToRotMatrixtemplatestatic void OEGeom3DEulerToRotMatrix ( T ∗RMat , double phi ,double theta , double psi )templatestatic void OEGeom3DEulerToRotMatrix ( T ∗RMat ,const double ∗angles )19.33 OEGeomQuaternionMultiplytemplatestatic void OEGeomQuaternionMultiply ( T ∗Product ,const T∗ qLhs ,const T∗ qRhs )19.34 OEGeomNormalizeQuaternion


19.35. OEGeom3DQuaternionToRotMatrix 263templatestatic void OEGeomNormalizeQuaternion ( T ∗quaternion )19.35 OEGeom3DQuaternionToRotMatrixtemplatestatic void OEGeom3DQuaternionToRotMatrix ( T ∗RMat ,const double ∗quat )19.36 OEGeom3DMatrixMultiplytemplatestatic void OEGeom3DMatrixMultiply ( T ∗Product ,const T∗ init ,const T∗ add )19.37 OEGeom3DQuaternionRotatetemplatestatic void OEGeom3DQuaternionRotate ( T ∗Product ,const T∗ init ,const T∗ add )19.38 OEGeom3DUnitQuaternionRotatetemplatestatic void OEGeom3DUnitQuaternionRotate ( T ∗Product ,const T∗ init ,const T∗ add )


Part VIOEPlatform Library264


CHAPTERTWENTYOEPlatform Classes and MemberFunctions20.1 OEDirectoryScanclass OEDirectoryScanThe OEDirectoryScan class provides a portable way of retrieving the names of all the files and subdirectoriesin a given directory.20.1.1 ConstructorsOEDirectoryScan ( const char ∗dname )The constructor for OEDirectoryScan specifies the name of the directory to scan.(char*)0, is taken to mean the current directory and is equivalent to ".".A NULL pointer,20.1.2 operator booloperator bool ( ) constThe operator bool method can be used to check whether the OEDirectoryScan has been successfullyopened and is still valid. A return value of true does not guarantee that the next call to the Next method will notreturn (const char*)0.20.1.3 Closevoid Close ( )The Close method closes the OEDirectoryScan and frees any system resources. This method is invokedautomatically by the classes’ destructor. Following a call to Close, operator bool will always return false.20.1.4 Next265


266 Chapter 20. OEPlatform Classes and Member Functionsconst char ∗Next ( )Return the next file name sequentially in the directory scan. This function automatically advances the directorypointer. The returned value is a pointer to the local filename, i.e. without its directory prefix. Upon reaching theend of the directory, this function returns (const char*)0, and the OEDirectoryScan is closed.20.2 oeifstreamclass oeifstream : public oeistreamImplements an input stream capable of reading from a specified file or from any generic data source with anassociated file descriptor.20.2.1 Constructorsoeifstream ( )oeifstream ( int fd )oeifstream ( const char ∗filename )oeifstream ( const std : : string &filename )Creates a new oeifstream. If a valid file descriptor (fd) is passed to the constructor, the stream will use theassociated data source for input. Otherwise, the constructors expect the name of an existing file from which toread. If no parameter is passed to the constructor, the stream can later be opened using the open command definedin OEPlatform::oeistream or the openfd command defined in this class.20.2.2 fdint fd ( )constReturns the system dependent file descriptor associated with the stream’s data source.20.2.3 openfdbool openfd ( int fd , bool closefd )Sets the data source of the stream to the specified file descriptor fd. If closefd is false, the underlying datasource is not closed before changing to the new data source.20.3 oeigzstreamclass oeigzstream : public oeiwrapperstreamImplements a wrapper stream capable of dynamically uncompressing gzipped data read off of the wrapped stream.20.3.1 Constructors


20.4. oeipstream 267oeigzstream ( )oeigzstream ( oeistream ∗is , bool del )Creates a new oeigzstream. See OEPlatform::oeiwrapperstream for more details on the functionalityof this class.20.4 oeipstreamclass oeipstream : public oeifstreamImplements an input stream capable of reading data from the piped output of a process generated by a specifiedcommand.20.4.1 Constructorsoeipstream ( const char ∗pipecmd )oeipstream ( const std : : string &pipecmd )Creates a new oeipstream that uses the piped output from a process generated by the specified command as itsinput source.20.5 oeisstreamclass oeisstream : public oeistreamImplements an input stream that uses a string of data already in memory as the input source.20.5.1 Constructorsoeisstream ( )oeisstream ( char ∗buffer , unsigned int len , bool copy = true )oeisstream ( const char ∗buffer , unsigned int len , bool copy = true )oeisstream ( const std : : string &buffer )oeisstream ( const oeisstream &rhs )Creates a new oeisstream. Passing any of the specified parameters to the one of the non-default constructors isequivalent to creating a new oeisstream with the default constructor and then calling the appropriate set methodon that stream.If the copy constructor is used, the newly created oeisstream will read from the same data string as the stream beingcopied from. If the copy parameter was set to true on the stream being copied from, the new stream will createits own local copy to read from, otherwise it will just point to the same place in memory as the original stream. Inaddition, the newly constructed stream’s reading pointer will be set to the same location as the one in the streambeing copied from.Regardless of whether or not a local copy is made, the stream takes no responsibility for the management of theoriginal input source’s memory.20.5.2 Operators


268 Chapter 20. OEPlatform Classes and Member Functionsoeisstream& operator = ( const oeisstream &rhs )Clears the current stream and sets the input source of this stream to be the same as the one in the assigned stream.If the copy parameter was set to true on the assigned stream, the stream will create its own local copy to readfrom, otherwise it will just point to the same place in memory as the assigned stream. In addition, the stream’sreading pointer will be set to the same location as the one in the assigned stream.20.5.3 clearvoid clear ( )Clears the association with input source associated with this stream. If the copy parameter was set to false whenthis stream was assigned or constructed, no changes will be made to the original data source.20.5.4 getbufferbool getbuffer ( std : : string &buffer ) constCopies the entire contents of the input source into the specified string regardless of the current location of thereading pointer and returns whether or not this was successful.20.5.5 resetbool reset ( )Resets the reading pointer to the beginning of the input stream and returns whether or not this was successful. Thisis equivalent to calling the rewind method defined in OEPlatform::oestream.20.5.6 setbool set ( char ∗buffer , unsigned int len , bool copy )bool set ( const char ∗buffer , unsigned int len , bool copy )bool set ( const std : : string &buffer )Sets the input source of this stream based on the specified parameters. The buffer parameter specifies the datastring to be used as the input source. If the char * constructors are used, the length of the input buffer must bespecified as well as whether or not a local copy of the buffer should be made and used as the input source. If thestd::string method is used, a local copy of the input string will be made and used as the input source.Regardless of whether or not a local copy is made, the stream takes no responsibility for the management of theoriginal input source’s memory.20.6 oeistdstreamclass oeistdstream : public oeistream


20.7. oeistream 269Implements a wrapper stream around a standard C++ input stream (std::istream).20.6.1 Constructorsoeistdstream ( )oeistdstream ( std : : istream ∗isptr , bool del )Creates a new oeistdstream. Passing the isptr and del parameters is equivalent to using the default constructorand then calling set(isptr, del) on the newly created stream.20.6.2 clearvoid clear ( )Clears the pointer to the wrapped stream. If the del parameter was set to true when the wrapped stream was set,the wrapped stream will be deleted before it is cleared.20.6.3 setbool set ( std : : istream ∗isptr , bool del )Sets isptr to be the stream wrapped by this class. If del is true, the wrapped stream will be deleted when theclear method is called or when this class is deleted. It is important to understand that by setting del to true,ownership of the stream’s memory is transfered to this class, and if it is false, you retain the responsibility formanaging the stream’s memory.20.6.4 streamstd : : istream ∗stream ( )Returns a pointer to the wrapped stream if present, otherwise 0.20.7 oeistreamclass oeistream : public oestreamDefines the platform independent interface and implementation for a generic input data stream class.20.7.1 Constructorsoeistream ( )Creates an instance of an oeistream. This class is designed to provide an interface and some functionality; however,this class does not define a data source and therefore instances of this class have no independent functionality.20.7.2 operator >>


270 Chapter 20. OEPlatform Classes and Member Functionsvirtual oeistream &operator >> ( oeistream& ( f ) ( oeistream&))virtual oeistream &operator >> ( oestream& ( f ) ( oestream&))Use of these operators executes the specified function (f) on the stream in question. In order for proper compilationand execution, the specified function must be prototyped according to the <strong>API</strong> shown above.virtual oeistream &operator >> ( oeostream &)This operator sends all of the remaining input on the stream to the specified oeostream.virtual oeistream &operator >> ( bool &)virtual oeistream &operator >> ( char &)virtual oeistream &operator >> ( signed char &)virtual oeistream &operator >> ( unsigned char &)virtual oeistream &operator >> ( std : : string &)virtual oeistream &operator >> ( short &)virtual oeistream &operator >> ( int &)virtual oeistream &operator >> ( long &)virtual oeistream &operator >> ( unsigned short &)virtual oeistream &operator >> ( unsigned int &)virtual oeistream &operator >> ( unsigned long &)virtual oeistream &operator >> ( float &)virtual oeistream &operator >> ( double &)These operators read the next whitespace-delimited token on the input stream, converts it into the appropriate datatype, and stores that value in the specified parameter. The use of these operators on non-text streams is undefined.20.7.3 closevoid close ( )Closes the input stream. All future attempts to read from this stream will fail until it is opened again with newinput.20.7.4 getbool get ( char &c )bool get ( signed char &c )bool get ( unsigned char &c )Gets the next byte off of the stream and assigns its value to the parameter c. Returns whether or not the byte readequals EOF.20.7.5 getbyteint getbyte ( )Returns the next byte off of the stream.20.7.6 getlinebool getline ( char ∗buffer , oefpos_t max )bool getline ( signed char ∗buffer , oefpos_t max )bool getline ( unsigned char ∗buffer , oefpos_t max )bool getline ( std : : string &buffer , oefpos_t max )bool getline ( std : : string &buffer )


20.7. oeistream 271Retrieves the next text line from the stream and directly copies its contents into the buffer parameter. Thenewline character is not copied with the rest of the contents. The max parameter specifies the maximum number ofcharacters allowed per line. If a newline character is not found within the specified number of characters, only thespecified number of characters will be copied into the buffer and all the remaining characters in the stream beforethe next newline character will be discarded.20.7.7 gettokenbool gettoken ( char ∗buffer , oefpos_t max )bool gettoken ( signed char ∗buffer , oefpos_t max )bool gettoken ( unsigned char ∗buffer , oefpos_t max )bool gettoken ( std : : string &buffer , oefpos_t max )Retrieves the next whitespace delimited token from the stream and directly copies its contents into the bufferparameter. This function discards the whitespace characters read when searching for the next token. The maxparameter specifies the maximum number of characters allowed per token. If a whitespace character is not foundwithin the specified number of characters, only the specified number of characters will be copied into the bufferand all the remaining characters in the stream before the next whitespace character will be discarded.20.7.8 openbool open ( const char ∗name )bool open ( const std : : string &name )bool open ( unsigned char ∗buffer , oefpos_t len )Opens the input stream with data from the specified sources. Passing a name parameter will result in invocationof a protected virtual method to appropriate handle the specified input source. Passing a pointer to a characterbuffer along with the buffer’s size will result in the stream wrapping the buffer and using that as the stream datasource. Returns whether or not data can now be read from the stream.20.7.9 peekbyteint peekbyte ( )Returns the value of the next byte without removing that byte from the input stream. Returns -1 if the stream is notvalid.20.7.10 readoefpos_t read ( char ∗buffer , oefpos_t len )oefpos_t read ( signed char ∗buffer , oefpos_t len )oefpos_t read ( unsigned char ∗buffer , oefpos_t len )oefpos_t read ( std : : string &buffer , oefpos_t len )Reads the next len number of bytes off of the stream, stores them in the specified buffer and returns the numberof bytes actually read. It is the user’s responsibility when using any of the three char * versions to make surethat the specified buffer has been properly allocated and has enough room to store len bytes. This functiondoes not add a NULL terminator to the end of the buffer.20.7.11 skip


272 Chapter 20. OEPlatform Classes and Member Functionsbool skip ( oefpos_t len )Discards the next number of bytes specified by len in the stream. Returns whether or not there are any bytes leftin the stream.20.7.12 skipbytebool skipbyte ( )Discards the next byte in the stream. Returns whether or not there are any bytes left in the stream.20.7.13 skiplinebool skipline ( )Discards the next text line in the stream. Returns whether or not there are any bytes left in the stream.20.8 oeiwrapperstreamclass oeiwrapperstream : public oeistreamImplements a wrapper class to seamless contain and abstract the functionality of another oeistream.20.8.1 Constructorsoeiwrapperstream ( )oeiwrapperstream ( oeistream ∗isptr , bool del )Creates a new oeiwrapperstream. Passing the isptr and del parameters is equivalent to using the default constructorand then calling set(isptr, del) on the newly created stream.20.8.2 clearvoid clear ( )Clears the pointer to the wrapped stream. If the del parameter was set to true when the wrapped stream was set,the wrapped stream will be deleted before it is cleared.20.8.3 setbool set ( oeistream ∗isptr , bool del )Sets isptr to be the stream wrapped by this class. If del is true, the wrapped stream will be deleted when theclear method is called or when this class is deleted. It is important to understand that by setting del to true,


20.9. OEMutex 273ownership of the stream’s memory is transfered to this class, and if it is false, you retain the responsibility formanaging the stream’s memory.20.8.4 streamoeistream ∗stream ( )Returns a pointer to the wrapped stream if present, otherwise 0.20.9 OEMutexstruct OEMutexThe OEMutex class provides a portable MUTual EXclusion device, that is useful for protecting shared data structuresfom concurrent modification.20.9.1 Acquirevoid Acquire ( )The OEMutex::Acquire method acquires (locks) the OEMutex. If the OEMutex is unlocked, it is locked bythis calls and becomes owned by the calling thread. If the OEMutex is already locked, by this or another thread,OEMutex::Acquire suspends the calling thread until the OEMutex is released.20.9.2 Releasevoid Release ( )The OEMutex::Release method releases (unlocks) the OEMutex. The OEMutex object must have previouslybeen locked by the calling thread.20.10 oeofstreamclass oeofstream : public oeostreamImplements an output stream capable of writing to a specified file or to any generic data source with an associatedfile descriptor.20.10.1 Constructorsoeofstream ( )oeofstream ( int fd )oeofstream ( const char ∗filename )oeofstream ( const std : : string &filename )Creates a new oeofstream. If a valid file descriptor (fd) is passed to the constructor, the stream will use theassociated data target for output. Otherwise, the constructors expect the name of file to be written to. If the named


274 Chapter 20. OEPlatform Classes and Member Functionsfile does not exist, it will be created. If no parameter is passed to the constructor, the stream can later be openedusing the open command defined in OEPlatform::oeostream or the openfd command defined in thisclass.20.10.2 appendbool append ( const char ∗filename )bool append ( const std : : string &filename )Opens the specified file to which data will be appended. Returns whether or not the file was successfully opened(or created as necessary).20.10.3 fdint fd ( )constReturns the system dependent file descriptor associated with the stream’s data target.20.10.4 openfdbool openfd ( int fd , bool closefd )Sets the data target of the stream to the specified file descriptor fd. If closefd is false, the underlying data targetis not closed before changing to the new data source.20.11 oeogzstreamclass oeogzstream : public oeowrapperstreamImplements a wrapper stream capable of dynamically compressing data in gzip format and then passing that alongto the wrapped stream.20.11.1 Constructorsoeogzstream ( )oeogzstream ( oeostream ∗os , bool del )Creates a new oeogzstream. See OEPlatform::oeowrapperstream for more details on the functionalityof this class.20.12 oeopstreamclass oeopstream : public oeofstream


20.13. oeosstream 275Implements an output stream capable of writing data down a pipe to the specified command.20.12.1 Constructorsoeopstream ( const char ∗pipecmd )oeopstream ( const std : : string &pipecmd )Creates a new oeopstream that pipes its output to the process created by the specified command.20.13 oeosstreamclass oeosstream : public oeostreamImplements an output stream that writes into an internally contained string.20.13.1 Constructorsoeosstream ( )oeosstream ( const char ∗buffer )oeosstream ( const unsigned char ∗buffer , oefpos_t len )oeosstream ( const oeosstream &rhs )Creates a new oeosstream which is immediately ready to be written to. Passing any of the specified parametersto one of the non-default constructors is equivalent to creating a new oeosstream with the default constructor andthen calling the appropriate set command.If the copy constructor is used, the entire contents of the other stream’s internal string are copied into the newlyconstructed stream’s internal string.20.13.2 Operatorsoeosstream& operator =( const oeosstream &)Clears the contents of the current internal string and copies the entire contents of the other stream’s internal stringinto the current one.20.13.3 clearvoid clear ( )Clears the contents of the internal string.20.13.4 setbool set ( const char ∗buffer )bool set ( const unsigned char ∗buffer , oefpos_t len )


276 Chapter 20. OEPlatform Classes and Member FunctionsSets the contents of the internal string to the contents of the specified buffer. If the len parameter is notspecified, this method will copy the contents of the specified buffer until a null character is reached. The nullcharacter is not copied. Returns whether or not the contents were successfully copied.20.13.5 strstd : : string str ( )Returns a copy of the current internal string.20.14 oeostdstreamclass oeostdstream : public oeostreamImplements a wrapper stream around a standard C++ output stream (std::ostream).20.14.1 Constructorsoeostdstream ( )oeostdstream ( std : : ostream ∗osptr , bool del )Creates a new oeostdstream. Passing the osptr and del parameters is equivalent to using the default constructorand then calling set(osptr, del) on the newly created stream.20.14.2 clearvoid clear ( )Clears the pointer to the wrapped stream. If the del parameter was set to true when the wrapped stream was set,the wrapped stream will be deleted before it is cleared.20.14.3 setbool set ( std : : ostream ∗osptr , bool del )Sets osptr to be the stream wrapped by this class. If del is true, the wrapped stream will be deleted when theclear method is called or when this class is deleted. It is important to understand that by setting del to true,ownership of the stream’s memory is transfered to this class, and if it is false, you retain the responsibility formanaging the stream’s memory.20.14.4 streamstd : : ostream ∗stream ( )


20.15. oeostream 277Returns a pointer to the wrapped stream if present, otherwise 0.20.15 oeostreamclass oeostream : public oestreamDefines the platform independent interface and implementation for a generic output data stream class.20.15.1 Constructorsoeostream ( )Creates an instance of an oeostream. This class is designed to provide an interface and some functionality; however,this class does not define a data target and therefore writing data to an instance of this is equivalent to writing tonull.20.15.2 operator


278 Chapter 20. OEPlatform Classes and Member Functionsbool flush ( )Flushes the remaining data in the output buffer onto the stream and returns whether or not it was successful.Explicit calls to this function are only necessary when one needs to make sure that all of the data that has beenstored in the output buffer is actually on the output stream at that time. The output buffer is automatically flushedwhen it becomes full.20.15.5 openbool open ( const char ∗name )bool open ( const std : : string &name )bool open ( unsigned char ∗buffer , oefpos_t len )Opens the output stream to the specified sources. Passing a name parameter will result in invocation of a protectedvirtual method to appropriate handle the specified output source. Passing a pointer to a character buffer alongwith the buffer’s size will result in the stream wrapping the buffer and using that as the stream data destination.Returns whether or not data can now be written to the stream.20.15.6 putbytebool putbyte ( char c )Pushes the specified byte c onto the output stream and returns whether or not this was successful.20.15.7 writeoefpos_t write ( const char ∗buffer , oefpos_t len )oefpos_t write ( const signed char ∗buffer , oefpos_t len )oefpos_t write ( const unsigned char ∗buffer , oefpos_t len )oefpos_t write ( const std : : string &buffer , oefpos_t len )Writes len number of bytes from the specified data source (buffer) onto the output stream and returns thenumber of bytes that were able to be written.20.16 oeowrapperstreamclass oeowrapperstream : public oeostreamImplements a wrapper class to seamless contain and abstract the functionality of another oeostream.20.16.1 Constructorsoeowrapperstream ( )oeowrapperstream ( oeostream ∗osptr , bool del )Creates a new oeowrapperstream. Passing the osptr and del parameters is equivalent to using the defaultconstructor and then calling set(osptr, del) on the newly created stream.20.16.2 clear


20.17. oestream 279void clear ( )Clears the pointer to the wrapped stream. If the del parameter was set to true when the wrapped stream was set,the wrapped stream will be deleted before it is cleared.20.16.3 setbool set ( oeostream ∗osptr , bool del )Sets osptr to be the stream wrapped by this class. If del is true, the wrapped stream will be deleted when theclear method is called or when this class is deleted. It is important to understand that by setting del to true,ownership of the stream’s memory is transfered to this class, and if it is false, you retain the responsibility formanaging the stream’s memory.20.16.4 streamoeostream ∗stream ( )Returns a pointer to the wrapped stream if present, otherwise 0.20.17 oestreamclass oestreamThe OEPlatform::oestream class is the base class which sets up the platform independent interface forstreaming any type of data.20.17.1 Constructorsoestream ( )Creates an instance of an oestream. This class exists solely to provide an interface, therefore, instances of this classhave no independently meaningful functionality.20.17.2 operator booloperator bool ( )constEvaluates the stream to a Boolean value based on whether the end of the stream has been reached. This is equivalentto !eof().20.17.3 eofbool eof ( )const


280 Chapter 20. OEPlatform Classes and Member FunctionsReturns whether the end of the stream has been reached.20.17.4 lengthoefpos_t length ( )Returns the number of bytes that have been read from or written to the stream.20.17.5 rewindbool rewind ( )Sets the data pointer position in the stream to the beginning of the stream.20.17.6 seekbool seek ( oefpos_t pos )bool seek ( oeoff_t offset , seek_dir dir )Sets the current position of the data pointer. This is accomplished by specifying the desired position or by specifyingan offset distance and a directionality from the current position. Directionality is specified using the followingenumeration:enum seek_dir { beg = 0 , cur = 1 , end = 2 } ;20.17.7 sizeoefpos_t size ( )Returns the size of the stream in bytes.20.17.8 telloefpos_t tell ( )constReturns the current position of the data pointer in the stream.20.18 OETryMutexstruct OETryMutexThe OETryMutex class provides a portable MUTual EXclusion device, that is useful for protecting shared datastructures fom concurrent modification. This version also contains OETryMutex::Try function that allows fora failed acquire. OETryMutex is slightly more costly than OEMutex20.18.1 Acquire


20.18. OETryMutex 281void Acquire ( )The OETryMutex::Acquire method acquires (locks) the OETryMutex. If the OETryMutex is unlocked, itis locked by this calls and becomes owned by the calling thread. If the OETryMutex is already locked, by this oranother thread, OETryMutex::Acquire suspends the calling thread until the OETryMutex is released.20.18.2 Releasevoid Release ( )The OETryMutex::Release method releases (unlocks) the OETryMutex. The OETryMutex object musthave previously been locked by the calling thread.20.18.3 Tryvoid Try ( )The OETryMutex::Try method attempts to acquire (lock) the OETryMutex. If the OETryMutex is unlocked,it is locked by this call, becomes owned by the calling thread, and returns true. If the OETryMutex isalready locked, by this or another thread, OETryMutex::Try returns false.


CHAPTERTWENTYONEOEPlatform Functions21.1 OECloseIStreamvoid OECloseIStream ( oeistream ∗is )Closes the specified input stream. This function only works on oeistreams created with theOEPlatform::OEOpenIStream function and is also the only way in which they should be closed.21.2 OECloseOStreamvoid OECloseOStream ( oeostream ∗os )Closes the specified output stream. This function only works on oeostreams created with theOEPlatform::OEOpenOStream function and is also the only way in which they should be closed.21.3 OECompressionAvailablebool OECompressionAvailable ( const char ∗format = "gz" )This function returns whether or not compress/uncompress functionality is available for the specified compressionformat.21.4 OECompressbool OECompress ( std : : string &compressed , const char ∗original ,unsigned int len , const char ∗format = "gz" )bool OECompress ( std : : string &compressed , const std : : string &original ,const char ∗format = "gz" )These functions compress the data in the original data buffer using the specified compression format and storesthe compressed data in the compressed string. Returns whether or not the specified compression format was282


21.5. OECreateDirectory 283available and if the data was successfully compressed using that format.21.5 OECreateDirectorybool OECreateDirectory ( const char ∗dname )This function provides a portable way of creating a new subdirectory. Upon success, this function returns the valuetrue.21.6 oeendloeostream &oeendl ( oeostream &)Pushes a newline character onto the specified output stream and then flushes that stream. This is equivalent to thestd::endl function.21.7 oeendsoeostream &oeends ( oeostream &)Pushes a null character onto the specified output stream. This is equivalent to the std::ends function.21.8 oeflushoeostream &oeflush ( oeostream &)Flushes the specified output stream. This is equivalent to the std::flush function.21.9 OEGetUserNamestd : : string OEGetUserName ( )This function can be used to return the user name of the current user, returned as an STL string. The currentimplementation returns the value “User” or “Windows User” if the user name could not be determined. Futureimplementations of this function may return an empty string upon failure.21.10 OEOpenIStreamoeistream ∗OEOpenIStream ( const char ∗source )


284 Chapter 21. OEPlatform FunctionsCreates and returns an oeistream capable of reading the input specified by the source parameter. The sourceparameter is initially parsed to determine whether a colon delimited protocol was specified. If no protocol wasspecified, it is assumed that the source parameter refers to a filename. If a protocol was specified, the functionchecks to see whether an input stream allocator and deallocator have been registered to handle the appropriateprotocol. If the specified protocol has been registered, the appropriate input stream will be created and returned,otherwise the function will return 0. Allocators and deallocators for specific protocols can be registered using theOEPlatform::OERegisterIStream function.Example:oeistream ∗is = OEOpenIStream ( "pipe: echo \"hello world\"" ) ;In addition, this function will attempt to assess whether or not the input data is compressed. If the data is compressedin a supported format, the appropriate decompression wrapper stream will be used to dynamically decompressthe data.All streams created with this function MUST be closed with the OEPlatform::OECloseIStream function.21.11 OEOpenOStreamoeostream ∗OEOpenOStream ( const char ∗target )Creates and returns an oeostream capable of writing to the specified target parameter. The target parameteris initially parsed to determine whether a colon delimited protocol was specified. If no protocol was specified,it is assumed that the target parameter refers to a filename. If a protocol was specified, the function checksto see whether an output stream allocator and deallocator have been registered to handle to the appropriate protocol.If the specified protocol has been registered, the appropriate output stream will be created and returned,otherwise the function will return 0. Allocators and deallocators for specific protocols can be registered using theOEPlatform::OERegisterOStream function.Example:oeostream ∗os = OEOpenOStream ( "pipe: uniq > output.txt" ) ;In addition, this function will attempt to assess whether or not the output data target expects compressed data. If theexpected format is supported, the appropriate compression wrapper stream will be used to dynamically compressthe data.All streams created with this function MUST be closed with the OEPlatform::OECloseOStream function.21.12 OERegisterIStreamtypedef oeistream ∗(∗oeistream_alloc_t ) ( const char ∗ ) ;typedef void (∗oeistream_dealloc_t ) ( oeistream ∗ ) ;bool OERegisterIStream ( const char ∗protocol , oeistream_alloc_t alloc ,oeistream_dealloc_t dealloc )Registers the specified input stream allocation and deallocation functions to be used with the specified protocol.


21.13. OERegisterOStream 285See OEPlatform::OEOpenIStream for details on how these functions are used.21.13 OERegisterOStreamtypedef oeostream ∗(∗oeostream_alloc_t ) ( const char ∗ ) ;typedef void (∗oeostream_dealloc_t ) ( oeostream ∗ ) ;bool OERegisterOStream ( const char ∗protocol , oeostream_alloc_t alloc ,oeostream_dealloc_t dealloc )Registers the specified output stream allocation and deallocation functions to be used with the specifiedprotocol. See OEPlatform::OEOpenOStream for details on how these functions are used.21.14 OERenameFilebool OERenameFile ( const char ∗oldfname , const char ∗newfname )The OERenameFile function can be used to portably rename a file. The “oldfname” argument denotes theoriginal file name, which is renamed to the filename specified by “newfname”. This function returns true uponsuccess.21.15 OESleepvoid OESleep ( unsigned long milliseconds )The OESleep function can be used suspend execution of the current process (or thread) for at least the specifiednumber of milliseconds.21.16 OEUncompressbool OEUncompress ( std : : string &uncompressed , const char ∗compressed ,unsigned int len , const char ∗format = "gz" )bool OEUncompress ( std : : string &uncompressed , const std : : string &compressed ,const char ∗format = "gz" )These functions uncompress the data in the compressed data buffer using the specified compression format andstores the uncompressed data in the uncompressed string. Returns whether or not the specified compressionformat was available and if the data was successfully uncompressed using that format.21.17 OEUnlinkbool OEUnlink ( const char ∗fname )


286 Chapter 21. OEPlatform FunctionsThe OEUnlink function in OEPlatform can be used to portably delete or remove a file. Deleting a file that is stillopen by a process results in implementation defined behavior. This function returns true upon success.21.18 OEUnlinkDirectorybool OEUnlinkDirectory ( const char ∗dname )The OEUnlinkDirectory function is used to portably delete or remove a directory. All files and subdirectoriesof the given directory should be deleted before calling this function. This function returns true upon success.21.19 operator


CHAPTERTWENTYTWOOEPlatform Globals22.1 oeerroeofstream oeerrThis is a globally available output stream that writes directly to stderr.22.2 oeinoeifstream oeinThis is a globally available input stream that reads directly from stdin.22.3 oenuloeostream oenulThis is a globally available output stream that writes directly to null.22.4 oeoutoeofstream oeoutThis is a globally available output stream that writes directly to stdout.287

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!