Пример #1
0
        /// <summary>
        /// Calculate the angle between 2 carboxylates
        /// </summary>
        public static double CalAngle(OBMol mol)
        {
            var mapping = OBFunctions.findcarboxylates(mol);
            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(pAngle);
        }
Пример #2
0
        /// <summary>
        /// Whether the candidate has enough carboxylates and conforms to angle- and carboxylate-blocking constraints.
        /// </summary>
        public static bool CanCalculateReward(OBMol mol)
        {
            var mapping = OBFunctions.findcarboxylates(mol);

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

            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);
        }
Пример #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);
        }