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


C# IAtomContainer.bonds方法代码示例

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


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

示例1: preprocessMolecule

		private bool preprocessMolecule(IAtomContainer original)
		{
			//prepare atom weights
			var atomWeightCanBeCalculated = prepareAtomWeights(original);
			// If the SDF contains an "R" or something, we don't know its mass, so this whole endevour is fruitless
			// (since we won't be able to match the fragment masses to the peaks).
			if (!atomWeightCanBeCalculated)
			{
				return false;
			}

			//mark all the bonds and atoms with numbers --> identify them later on        
			originalMolecule = markAllBonds(original);

			//do ring detection with the original molecule
			var allRingsFinder = new AllRingsFinder();

			// Steve: Set a really large timeout, because we don't want to crash just because it took a long time.
			// The size limit of 7 below should stop it looping forever.
			allRingsFinder.setTimeout(int.MaxValue);
			// TODO: Steve: The 7 is a max ring size - I added this to prevent it getting in to infinite loops (7 comes from MetFrag
			// where it is used in some other random class). Don't know if we need to change this??
			allRings = allRingsFinder.findAllRings(originalMolecule, Integer.valueOf(7));
			aromaticBonds = new List<IBond>();

			CDKHueckelAromaticityDetector.detectAromaticity(originalMolecule);

			foreach (var bond in originalMolecule.bonds().ToWindowsEnumerable<IBond>())
			{
				//lets see if it is a ring and aromatic
				var rings = allRings.getRings(bond);
				//don't split up aromatic rings...see constructor for option
				for (var i = 0; i < rings.getAtomContainerCount(); i++)
				{
					var aromatic = AromaticityCalculator.isAromatic((IRing)rings.getAtomContainer(i), originalMolecule);
					if (aromatic)
					{
						aromaticBonds.Add(bond);
						break;
					}
				}
			}
			return true;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:44,代码来源:Fragmenter.cs

示例2: MoleculeNumbering

		public static IAtomContainer MoleculeNumbering(IAtomContainer mol)
		{
			var count = 0;
			var countBond = 0;
			var alreadyDone = new List<IAtom>();

			foreach (var bond in mol.bonds().ToWindowsEnumerable<IBond>())
			{
				bond.setID(countBond.ToString(CultureInfo.InvariantCulture));
				countBond++;

				foreach (var atom in bond.atoms().ToWindowsEnumerable<IAtom>())
				{
					if (!alreadyDone.Contains(atom))
					{
						atom.setID(count.ToString(CultureInfo.InvariantCulture));
						count++;
						alreadyDone.Add(atom);
					}
				}
			}

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

示例3: GetAtomBondsDictionary

		private IDictionary<IAtom, IList<IBond>> GetAtomBondsDictionary(IAtomContainer atomContainer)
		{
			var dict = new Dictionary<IAtom, IList<IBond>>();
			foreach (var bond in atomContainer.bonds().ToWindowsEnumerable<IBond>())
			{
				foreach (var atom in bond.atoms().ToWindowsEnumerable<IAtom>())
				{
					if (!dict.ContainsKey(atom))
					{
						dict[atom] = new List<IBond>();
					}
					dict[atom].Add(bond);
				}
			}
			return dict;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:16,代码来源:Fragmenter.cs

示例4: getSplitableBonds

		private List<IBond> getSplitableBonds(IAtomContainer atomContainer, IDictionary<IAtom, IList<IBond>> atomBonds)
		{
			// find the splitable bonds
			var splitableBonds = new List<IBond>();

			foreach (var bond in atomContainer.bonds().ToWindowsEnumerable<IBond>())
			{
				var isTerminal = false;

				// lets see if it is a terminal bond...we dont want to split up the hydrogen
				foreach (var atom in bond.atoms().ToWindowsEnumerable<IAtom>())
				{
					//dont split up "terminal" H atoms
					if (atomBonds[atom].Count == 1 && atom.getSymbol().StartsWith("H"))
					{
						//terminal hydrogen...ignore it
						isTerminal = true;
						break;
					}
				}

				if (!isTerminal)
				{
					splitableBonds.Add(bond);
				}
			}
			return splitableBonds;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:28,代码来源:Fragmenter.cs

示例5: PostProcess

		/**
		 * Post process a fragment. --> find neutral possible neutral losses read in
		 * from the file
		 * 
		 * @param original
		 *            the original
		 * 
		 * @return the i atom container set
		 * 
		 * @throws CDKException
		 *             the CDK exception
		 * @throws CloneNotSupportedException
		 *             the clone not supported exception
		 */

		public List<IAtomContainer> PostProcess(IAtomContainer original, double neutralLossMass)
		{
			// Render.Draw(original, "Original Main");

			var ret = new List<IAtomContainer>();
			allRings = new RingSet();

			if (allRingsOrig.getAtomContainerCount() > 0)
			{
				// get the rings which are not broken up yet
				var bondMap = new Dictionary<IBond, int>();
				var count = 0;

				foreach (var bondOrig in original.bonds().ToWindowsEnumerable<IBond>())
				{
					bondMap[bondOrig] = count;
					count++;
				}

				// check for rings which are not broken up!
				IRingSet validRings = new RingSet();
				for (var i = 0; i < allRingsOrig.getAtomContainerCount(); i++)
				{
					var bondcount = 0;

					foreach (var bondRing in allRingsOrig.getAtomContainer(i).bonds().ToWindowsEnumerable<IBond>())
					{
						if (bondMap.ContainsKey(bondRing))
						{
							bondcount++;
						}
					}
					if (bondcount == allRingsOrig.getAtomContainer(i).getBondCount())
					{
						validRings.addAtomContainer(allRingsOrig.getAtomContainer(i));
					}
				}
				// rings which are not split up
				allRings = validRings;
			}

			IAtomContainer temp = new AtomContainer();
			var doneAtoms = new List<IAtom>();
			var doneBonds = new List<IBond>();

			// now find out the important atoms of the neutral loss
			var atomToStart = neutralLoss[neutralLossMass].AtomToStart;

			foreach (var bond in original.bonds().ToWindowsEnumerable<IBond>())
			{
				if (doneBonds.Contains(bond))
				{
					continue;
				}
				else
				{
					doneBonds.Add(bond);
				}

				// check if this was checked b4
				foreach (var atom in bond.atoms().ToWindowsEnumerable<IAtom>())
				{
					if (doneAtoms.Contains(atom))
					{
						continue;
					}
					else
					{
						doneAtoms.Add(atom);
					}

					// a possible hit
					if (atom.getSymbol().Equals(atomToStart) && !allRings.contains(atom))
					{
						// Render.Draw(original, "BEFORE");
						// check if it is a terminal bond...and not in between!
						var atomList = original.getConnectedAtomsList(atom);
						var atomCount = 0;
						foreach (var iAtom in atomList.ToWindowsEnumerable<IAtom>())
						{
							// dont check
							if (iAtom.getSymbol().Equals("H"))
							{
								continue;
							}
//.........这里部分代码省略.........
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:101,代码来源:PostProcessor.cs


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