Ejemplo n.º 1
0
        /// <summary>
        /// Copies the candidate graph, transfers the L-mapping, and returns the resultant candidate.
        /// </summary>
        public candidate CopyAndApplyOption(option opt, candidate cand, bool doMinimize)
        {
            var newCand = cand.copy();
            var newOpt  = opt.copy();

            SearchProcess.transferLmappingToChild(newCand.graph, cand.graph, newOpt);
            ApplyOption(newOpt, newCand, doMinimize);
            return(newCand);
        }
Ejemplo n.º 2
0
 protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
 {
     if (e.ClickCount >= 2)
     {
         SearchIO.addAndShowGraphWindow(_opt.copy(),
                                        "Location for Option " + _opt.optionNumber + " from RuleSet " +
                                        _opt.ruleSetIndex
                                        + " Rule #" + _opt.ruleNumber + ": " + StrLocation);
     }
     base.OnPreviewMouseDown(e);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns whether the graph violates angle or carboxyl-blocking constraints.
        /// </summary>
        private static bool IsValidChild(candidate cand, option opt)
        {
            var newCand = cand.copy();
            var newOpt  = opt.copy();

            SearchProcess.transferLmappingToChild(newCand.graph, cand.graph, newOpt);
            newOpt.apply(newCand.graph, null);

            var mol     = OBFunctions.designgraphtomol(newCand.graph);
            var mapping = OBFunctions.findcarboxylates(mol);

            if (mapping.Count < 2)
            {
                return(true);
            }

            var carbA  = mol.GetAtom(mapping[0][1]); // carbon in carboxylate
            var aA     = mol.GetAtom(mapping[0][3]); // atom that the carbon connects to
            var carbB  = mol.GetAtom(mapping[1][1]);
            var aB     = mol.GetAtom(mapping[1][3]);
            var pAngle = OBFunctions.pairwiseangle(carbA, aA, carbB, aB); // angle between carboxylates

            return(!OBFunctions.carboxylatesBlocked(mol, aA, carbA, aB, carbB) && pAngle >= AngleFloor);
        }