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


C# IAtomContainer.atoms方法代码示例

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


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

示例1: AddImplicitHydrogens

		public bool AddImplicitHydrogens(IAtomContainer molecule)
		{
			try
			{
				var builder = molecule.getBuilder();
				var matcher = CDKAtomTypeMatcher.getInstance(builder);

				foreach (var atom in molecule.atoms().ToWindowsEnumerable<IAtom>())
				{
					var type = matcher.findMatchingAtomType(molecule, atom);
					AtomTypeManipulator.configure(atom, type);
				}
				var hAdder = CDKHydrogenAdder.getInstance(builder);
				hAdder.addImplicitHydrogens(molecule);

				AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule);
			}
				//there is a bug in cdk?? error happens when there is a S or Ti in the molecule
			catch (IllegalArgumentException)
			{
				return false;
			}

			return true;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:25,代码来源:ImplicitHydrogenAdder.cs

示例2: GetMolecularFormula

		public static IMolecularFormula GetMolecularFormula(IAtomContainer atomContainer)
		{
			var formula = new MolecularFormula();
			var charge = 0;
			var hydrogen = new Atom("H");

			foreach (var iAtom in atomContainer.atoms().ToWindowsEnumerable<IAtom>())
			{
				formula.addIsotope(iAtom);
				charge += iAtom.getFormalCharge().intValue();
				var implicitHydrogenCount = iAtom.getImplicitHydrogenCount();
				var implicitHydrogenCountValue = implicitHydrogenCount != null ? implicitHydrogenCount.intValue() : (int?) null;

				if (implicitHydrogenCountValue.HasValue && implicitHydrogenCountValue.Value > 0)
				{
					formula.addIsotope(hydrogen, implicitHydrogenCountValue.Value);
				}
			}

			formula.setCharge(new Integer(charge));
			return formula;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:22,代码来源:MolecularFormulaTools.cs

示例3: get3DCentreOfMass

        /// <summary>  Calculates the center of mass for the <code>Atom</code>s in the
        /// AtomContainer for the 2D coordinates.
        /// See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
        /// 
        /// </summary>
        /// <param name="ac">     AtomContainer for which the center of mass is calculated
        /// </param>
        /// <returns>         Description of the Return Value
        /// </returns>
        /// <cdk.keyword>     center of mass </cdk.keyword>
        /// <cdk.dictref>    blue-obelisk:calculate3DCenterOfMass </cdk.dictref>
        public static Point3d get3DCentreOfMass(IAtomContainer ac)
        {
            double x = 0.0;
            double y = 0.0;
            double z = 0.0;

            double totalmass = 0.0;

            System.Collections.IEnumerator atoms = ac.atoms();
            //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
            while (atoms.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                IAtom a = (IAtom)atoms.Current;
                double mass = a.getExactMass();
                totalmass += mass;
                x += mass * a.X3d;
                y += mass * a.Y3d;
                z += mass * a.Z3d;
            }

            return new Point3d(x / totalmass, y / totalmass, z / totalmass);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:34,代码来源:GeometryTools.cs

示例4: removeAliphatic

 /// <summary>  Removes all external aliphatic chains by chopping them off from the
 /// ends
 /// 
 /// </summary>
 /// <param name="ac">               The AtomContainer to work with
 /// </param>
 /// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
 /// </exception>
 private void removeAliphatic(IAtomContainer ac)
 {
     bool removedSomething;
     IAtom atom = null;
     do
     {
         removedSomething = false;
         //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
         for (System.Collections.IEnumerator e = ac.atoms(); e.MoveNext(); )
         {
             //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
             atom = (IAtom)e.Current;
             if (ac.getBondCount(atom) == 1)
             {
                 ac.removeAtomAndConnectedElectronContainers(atom);
                 removedSomething = true;
             }
         }
     }
     while (removedSomething);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:AllRingsFinder.cs


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