/* (C) 2022 Cadence Design Systems, Inc. (Cadence) All rights reserved. TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is provided to current licensees or subscribers of Cadence products or SaaS offerings (each a "Customer"). Customer is hereby permitted to use, copy, and modify the Sample Code, subject to these terms. Cadence claims no rights to Customer's modifications. Modification of Sample Code is at Customer's sole and exclusive risk. Sample Code may require Customer to have a then current license or subscription to the applicable Cadence offering. THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be liable for any damages or liability in connection with the Sample Code or its use. */ using System; using OpenEye.OEChem; using OpenEye.OEGrid; using OpenEye.OEShape; public class UserColor { public static void Main(string [] args) { if (args.Length != 2) OEChem.OEThrow.Usage("UserColor "); oemolistream reffs = new oemolistream(args[0]); oemolistream fitfs = new oemolistream(args[1]); OEGraphMol refmol = new OEGraphMol(); OEChem.OEReadMolecule(reffs, refmol); // Modify ImplicitMillsDean color force field by // adding user defined color interactions OEColorForceField cff = new OEColorForceField(); cff.Init(OEColorFFType.ImplicitMillsDean); cff.ClearInteractions(); uint donorType = cff.GetType("donor"); uint accepType = cff.GetType("acceptor"); cff.AddInteraction(donorType, donorType, "gaussian", -1.0f, 1.0f); cff.AddInteraction(accepType, accepType, "gaussian", -1.0f, 1.0f); // Prepare reference molecule for calculation // With default options this will add required color atoms // Set the modified color force field for addignment OEOverlapPrep prep = new OEOverlapPrep(); prep.SetColorForceField(cff); prep.Prep(refmol); // Get appropriate function to calculate exact color // Set appropriate options to use the user defined color OEColorOptions options = new OEColorOptions(); options.SetColorForceField(cff); OEExactColorFunc colorFunc = new OEExactColorFunc(options); colorFunc.SetupRef(refmol); OEOverlapResults res = new OEOverlapResults(); foreach (OEGraphMol fitmol in fitfs.GetOEGraphMols()) { prep.Prep(fitmol); colorFunc.Overlap(fitmol, res); Console.WriteLine("Fit Title: {0} ColorTanimoto: {1}", fitmol.GetTitle(), res.GetColorTanimoto()); } } }