当前位置: 首页>>代码示例>>C#>>正文


C# IAtomContainer.getBondOrderSum方法代码示例

本文整理汇总了C#中IAtomContainer.getBondOrderSum方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.getBondOrderSum方法的具体用法?C# IAtomContainer.getBondOrderSum怎么用?C# IAtomContainer.getBondOrderSum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAtomContainer的用法示例。


在下文中一共展示了IAtomContainer.getBondOrderSum方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: calculateNumberOfImplicitHydrogens

		public virtual int calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container)
		{
			return this.calculateNumberOfImplicitHydrogens(atom, container.getBondOrderSum(atom), container.getMaximumBondOrder(atom), container.getConnectedAtoms(atom).Length);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:4,代码来源:ValencyHybridChecker.cs

示例2: couldMatchAtomType

		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtomContainer container, IAtom atom, IAtomType type)
		{
			double bondOrderSum = container.getBondOrderSum(atom);
			double maxBondOrder = container.getMaximumBondOrder(atom);
			return couldMatchAtomType(atom, bondOrderSum, maxBondOrder, type);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:ValencyHybridChecker.cs

示例3: hasPerfectConfiguration

		public virtual bool hasPerfectConfiguration(IAtom atom, IAtomContainer ac)
		{
			double bondOrderSum = ac.getBondOrderSum(atom);
			double maxBondOrder = ac.getMaximumBondOrder(atom);
			IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
			if (atomTypes.Length == 0)
				return true;
			//logger.debug("*** Checking for perfect configuration ***");
			try
			{
				//logger.debug("Checking configuration of atom " + ac.getAtomNumber(atom));
				//logger.debug("Atom has bondOrderSum = " + bondOrderSum);
				//logger.debug("Atom has max = " + bondOrderSum);
			}
			catch (System.Exception exc)
			{
			}
			for (int f = 0; f < atomTypes.Length; f++)
			{
				if (bondOrderSum == atomTypes[f].BondOrderSum && maxBondOrder == atomTypes[f].MaxBondOrder)
				{
					try
					{
						//logger.debug("Atom " + ac.getAtomNumber(atom) + " has perfect configuration");
					}
					catch (System.Exception exc)
					{
					}
					return true;
				}
			}
			try
			{
				//logger.debug("*** Atom " + ac.getAtomNumber(atom) + " has imperfect configuration ***");
			}
			catch (System.Exception exc)
			{
			}
			return false;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:40,代码来源:SaturationChecker.cs

示例4: isSaturated

		/// <summary> Checks wether an Atom is saturated by comparing it with known AtomTypes.
		/// It returns true if the atom is an PseudoAtom and when the element is not in the list.
		/// </summary>
		public virtual bool isSaturated(IAtom atom, IAtomContainer container)
		{
			if (atom is IPseudoAtom)
			{
				//logger.debug("don't figure it out... it simply does not lack H's");
				return true;
			}
			
			IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
			if (atomTypes.Length == 0)
			{
				//logger.warn("Missing entry in atom type list for ", atom.Symbol);
				return true;
			}
			double bondOrderSum = container.getBondOrderSum(atom);
			double maxBondOrder = container.getMaximumBondOrder(atom);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			
			//logger.debug("Checking saturation of atom ", atom.Symbol);
			//logger.debug("bondOrderSum: ", bondOrderSum);
			//logger.debug("maxBondOrder: ", maxBondOrder);
			//logger.debug("hcount: ", hcount);
			//logger.debug("charge: ", charge);
			
			bool elementPlusChargeMatches = false;
			for (int f = 0; f < atomTypes.Length; f++)
			{
				IAtomType type = atomTypes[f];
				if (couldMatchAtomType(atom, bondOrderSum, maxBondOrder, type))
				{
					if (bondOrderSum + hcount == type.BondOrderSum && maxBondOrder <= type.MaxBondOrder)
					{
						//logger.debug("We have a match: ", type);
						//logger.debug("Atom is saturated: ", atom.Symbol);
						return true;
					}
					else
					{
						// ok, the element and charge matche, but unfulfilled
						elementPlusChargeMatches = true;
					}
				} // else: formal charges don't match
			}
			
			if (elementPlusChargeMatches)
			{
				//logger.debug("No, atom is not saturated.");
				return false;
			}
			
			// ok, the found atom was not in the list
			throw new CDKException("The atom with element " + atom.Symbol + " and charge " + charge + " is not found.");
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:57,代码来源:ValencyHybridChecker.cs

示例5: calculateNumberOfImplicitHydrogens

		public virtual int calculateNumberOfImplicitHydrogens(IAtom atom, IAtomContainer container, bool throwExceptionForUnknowAtom)
		{
			return this.calculateNumberOfImplicitHydrogens(atom, container.getBondOrderSum(atom), container.getConnectedBonds(atom), throwExceptionForUnknowAtom);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:4,代码来源:SaturationChecker.cs

示例6: saturate

		/// <summary> The method is known to fail for certain compounds. For more information, see
		/// cdk.test.limitations package.
		/// 
		/// </summary>
		public virtual void  saturate(IAtomContainer atomContainer)
		{
			/* newSaturate(atomContainer);
			}
			public void oldSaturate(AtomContainer atomContainer) throws CDKException { */
			IAtom partner = null;
			IAtom atom = null;
			IAtom[] partners = null;
			IAtomType[] atomTypes1 = null;
			IAtomType[] atomTypes2 = null;
			IBond bond = null;
			for (int i = 1; i < 4; i++)
			{
				// handle atoms with degree 1 first and then proceed to higher order
				for (int f = 0; f < atomContainer.AtomCount; f++)
				{
					atom = atomContainer.getAtomAt(f);
					//logger.debug("symbol: ", atom.Symbol);
					atomTypes1 = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
					if (atomTypes1.Length > 0)
					{
						//logger.debug("first atom type: ", atomTypes1[0]);
						if (atomContainer.getBondCount(atom) == i)
						{
							if (atom.getFlag(CDKConstants.ISAROMATIC) && atomContainer.getBondOrderSum(atom) < atomTypes1[0].BondOrderSum - atom.getHydrogenCount())
							{
								partners = atomContainer.getConnectedAtoms(atom);
								for (int g = 0; g < partners.Length; g++)
								{
									partner = partners[g];
									//logger.debug("Atom has " + partners.Length + " partners");
									atomTypes2 = getAtomTypeFactory(atom.Builder).getAtomTypes(partner.Symbol);
									if (atomTypes2.Length == 0)
										return ;
									if (atomContainer.getBond(partner, atom).getFlag(CDKConstants.ISAROMATIC) && atomContainer.getBondOrderSum(partner) < atomTypes2[0].BondOrderSum - partner.getHydrogenCount())
									{
										//logger.debug("Partner has " + atomContainer.getBondOrderSum(partner) + ", may have: " + atomTypes2[0].BondOrderSum);
										bond = atomContainer.getBond(atom, partner);
										//logger.debug("Bond order was " + bond.Order);
										bond.Order = bond.Order + 1;
										//logger.debug("Bond order now " + bond.Order);
										break;
									}
								}
							}
							if (atomContainer.getBondOrderSum(atom) < atomTypes1[0].BondOrderSum - atom.getHydrogenCount())
							{
								//logger.debug("Atom has " + atomContainer.getBondOrderSum(atom) + ", may have: " + atomTypes1[0].BondOrderSum);
								partners = atomContainer.getConnectedAtoms(atom);
								for (int g = 0; g < partners.Length; g++)
								{
									partner = partners[g];
									//logger.debug("Atom has " + partners.Length + " partners");
									atomTypes2 = getAtomTypeFactory(atom.Builder).getAtomTypes(partner.Symbol);
									if (atomTypes2.Length == 0)
										return ;
									if (atomContainer.getBondOrderSum(partner) < atomTypes2[0].BondOrderSum - partner.getHydrogenCount())
									{
										//logger.debug("Partner has " + atomContainer.getBondOrderSum(partner) + ", may have: " + atomTypes2[0].BondOrderSum);
										bond = atomContainer.getBond(atom, partner);
										//logger.debug("Bond order was " + bond.Order);
										bond.Order = bond.Order + 1;
										//logger.debug("Bond order now " + bond.Order);
										break;
									}
								}
							}
						}
					}
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:76,代码来源:SaturationChecker.cs

示例7: couldMatchAtomType

		/// <summary> Determines if the atom can be of type AtomType.</summary>
		public virtual bool couldMatchAtomType(IAtomContainer atomContainer, IAtom atom, IAtomType atomType)
		{
			//logger.debug("   ... matching atom ", atom.Symbol, " vs ", atomType);
			if (atomContainer.getBondOrderSum(atom) + atom.getHydrogenCount() < atomType.BondOrderSum)
			{
				//logger.debug("    Match!");
				return true;
			}
			//logger.debug("    No Match");
			return false;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:SaturationChecker.cs

示例8: getCurrentMaxBondOrder

		/// <summary> Returns the currently maximum formable bond order for this atom.
		/// 
		/// </summary>
		/// <param name="atom"> The atom to be checked
		/// </param>
		/// <param name="ac">   The AtomContainer that provides the context
		/// </param>
		/// <returns>       the currently maximum formable bond order for this atom
		/// </returns>
		public virtual double getCurrentMaxBondOrder(IAtom atom, IAtomContainer ac)
		{
			IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
			if (atomTypes.Length == 0)
				return 0;
			double bondOrderSum = ac.getBondOrderSum(atom);
			int hcount = atom.getHydrogenCount();
			double max = 0;
			double current = 0;
			for (int f = 0; f < atomTypes.Length; f++)
			{
				current = hcount + bondOrderSum;
				if (atomTypes[f].BondOrderSum - current > max)
				{
					max = atomTypes[f].BondOrderSum - current;
				}
			}
			return max;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:28,代码来源:SaturationChecker.cs

示例9: isOverSaturated

		/// <summary> Checks if the current atom has exceeded its bond order sum value.
		/// 
		/// </summary>
		/// <param name="atom">The Atom to check
		/// </param>
		/// <param name="ac">  The atomcontainer context
		/// </param>
		/// <returns>      oversaturated or not
		/// </returns>
		public virtual bool isOverSaturated(IAtom atom, IAtomContainer ac)
		{
			IAtomType[] atomTypes = getAtomTypeFactory(atom.Builder).getAtomTypes(atom.Symbol);
			if (atomTypes.Length == 0)
				return false;
			double bondOrderSum = ac.getBondOrderSum(atom);
			double maxBondOrder = ac.getMaximumBondOrder(atom);
			int hcount = atom.getHydrogenCount();
			int charge = atom.getFormalCharge();
			try
			{
				//logger.debug("*** Checking saturation of atom " + ac.getAtomNumber(atom) + " ***");
				//logger.debug("bondOrderSum: " + bondOrderSum);
				//logger.debug("maxBondOrder: " + maxBondOrder);
				//logger.debug("hcount: " + hcount);
			}
			catch (System.Exception exc)
			{
			}
			for (int f = 0; f < atomTypes.Length; f++)
			{
				if (bondOrderSum - charge + hcount > atomTypes[f].BondOrderSum)
				{
					//logger.debug("*** Good ! ***");
					return true;
				}
			}
			//logger.debug("*** Bad ! ***");
			return false;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:39,代码来源:SaturationChecker.cs


注:本文中的IAtomContainer.getBondOrderSum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。