Пример #1
0
        public static ModelBuilder3D GetInstance(TemplateHandler3D templateHandler, string ffname)
        {
            if (ffname == null || ffname.Length == 0)
            {
                throw new CDKException("The given ffname is null or empty!");
            }
            if (templateHandler == null)
            {
                throw new CDKException("The given template handler is null!");
            }

            var builderCode = $"{templateHandler.GetType().FullName}#{ffname}";

            return(memyselfandi.GetOrAdd(builderCode, n => new ModelBuilder3D(templateHandler, ffname)));
        }
        public void TestMapTemplatesCyclicMol2()
        {
            TemplateHandler3D  tmphandler3d = TemplateHandler3D.Instance;
            string             cyclicMolSmi = "CC(C)(C)NC(=O)C1CN(CCN1CC(CC(Cc1ccccc1)C(=O)NC1c2ccccc2CC1O)O)Cc1cccnc1";
            IChemObjectBuilder builder      = ChemObjectBuilder.Instance;
            SmilesParser       smiparser    = new SmilesParser(builder);
            var molecule = smiparser.ParseSmiles(cyclicMolSmi);
            ForceFieldConfigurator forcefconf = new ForceFieldConfigurator();

            forcefconf.SetForceFieldConfigurator("mmff94");
            IRingSet       rings                  = forcefconf.AssignAtomTyps(molecule);
            var            ringSystems            = RingPartitioner.PartitionRings(rings);
            IRingSet       largestRingSet         = RingSetManipulator.GetLargestRingSet(ringSystems);
            IAtomContainer allAtomsInOneContainer = RingSetManipulator.GetAllInOneContainer(largestRingSet);

            tmphandler3d.MapTemplates(allAtomsInOneContainer, allAtomsInOneContainer.Atoms.Count);
            for (int j = 0; j < allAtomsInOneContainer.Atoms.Count; j++)
            {
                Assert.IsNotNull(allAtomsInOneContainer.Atoms[j].Point3D);
            }
        }
Пример #3
0
 private static BitArray ParseBitSet(string str)
 {
     return(TemplateHandler3D.GetBitSetFromFile(Strings.Tokenize(str, '\t', ' ', ';', '{', ',', '}')));
 }
Пример #4
0
 /// <summary>
 /// Constructor for the ModelBuilder3D object.
 /// </summary>
 /// <param name="templateHandler">templateHandler Object</param>
 /// <param name="ffname">name of force field</param>
 private ModelBuilder3D(TemplateHandler3D templateHandler, string ffname)
 {
     SetTemplateHandler(templateHandler);
     SetForceField(ffname);
 }
Пример #5
0
 /// <summary>
 /// Sets the templateHandler attribute of the ModelBuilder3D object.
 /// </summary>
 /// <param name="templateHandler">The new templateHandler value</param>
 private void SetTemplateHandler(TemplateHandler3D templateHandler)
 {
     this.templateHandler = templateHandler ?? throw new ArgumentNullException(nameof(templateHandler), "The given template handler is null!");
 }