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


C# IAtomContainer.getAtomCount方法代码示例

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


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

示例1: markAllBonds

		public IAtomContainer markAllBonds(IAtomContainer original)
		{
			MoleculeTools.MoleculeNumbering(original);
			atomsContained = original.getAtomCount();
			return original;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:6,代码来源:Fragmenter.cs

示例2: identicalAtoms

		/**
		 * Very quick and easy isomorphism check.
		 * 
		 * @param molecule1 the molecule1
		 * @param fragsToCompare the frags to compare
		 * 
		 * @return true, if successful
		 */

		private bool identicalAtoms(IAtomContainer molecule1, List<IAtomContainer> fragsToCompare)
		{
			var molFormula = MolecularFormulaTools.GetMolecularFormula(molecule1);
			var molFormulaString = MolecularFormulaTools.GetString(molFormula);

			for (var i = 0; i < fragsToCompare.Count; i++)
			{
				//no match
				if (molecule1.getBondCount() != fragsToCompare[i].getBondCount() && molecule1.getAtomCount() != fragsToCompare[i].getAtomCount())
				{
					continue;
				}

				//Molecular Formula redundancy check
				var molFormulaFrag = MolecularFormulaTools.GetMolecularFormula(fragsToCompare[i]);
				var molFormulaFragString = MolecularFormulaTools.GetString(molFormulaFrag);
				if (molFormulaString.Equals(molFormulaFragString))
				{
					return true;
				}
			}

			//no match found
			return false;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:34,代码来源:Fragmenter.cs

示例3: splitMolecule

		private IEnumerable<IAtomContainer> splitMolecule(IAtomContainer atomContainer, IBond bond, IDictionary<IAtom, IList<IBond>> atomBonds)
		{
			//if this bond is in a ring we have to split another bond in this ring where at least one 
			//bond is in between. Otherwise we wont have two fragments. Else normal split.

			var ret = new List<IAtomContainer>();

			//get bond energy for splitting this bond
			var currentBondEnergy = BondEnergies.Lookup(bond);			

			//bond is in a ring....so we have to split up another bond to break it
			var rings = allRings.getRings(bond);
			if (rings.getAtomContainerCount() != 0)
			{
				foreach (var bondInRing in rings.getAtomContainer(0).bonds().ToWindowsEnumerable<IBond>())
				{
					//if the bonds are the same...this wont split up the ring
					if (bondInRing == bond)
					{
						continue;
					}

					//check for already tried bonds
					var check = new BondPair(bond, bondInRing);
					if (knownBonds.Contains(check))
					{
						continue;
					}
					knownBonds.Add(new BondPair(bond, bondInRing));


					var set = new List<IAtomContainer>();
					var bondListList = new List<List<IBond>>();
					var fragWeightList = new List<Double>();

					foreach (var currentAtom in bond.atoms().ToWindowsEnumerable<IAtom>())
					{
						//List with bonds in Ring
						var partRing = new List<IBond>();
						//reset the weight because it is computed inside the traverse
						currentFragWeight = 0.0;
						//initialize new atom list
						atomList = new List<IAtom>();

						//clone current atom because a single electron is being added...homolytic cleavage
						partRing = traverse(atomBonds, currentAtom, partRing, bond, bondInRing);

						bondListList.Add(partRing);
						fragWeightList.Add(currentFragWeight);

						var temp = makeAtomContainer(currentAtom, partRing);
						//set the properties again!
						var properties = atomContainer.getProperties();
						temp.setProperties(properties);


						//*********************************************************
						//BOND ENERGY CALCULATION
						//calculate bond energy
						var currentBondEnergyRing = BondEnergies.Lookup(bondInRing);

						//*********************************************************

						//now set property
						temp = setBondEnergy(temp, (currentBondEnergyRing + currentBondEnergy));
						set.Add(temp);
					}

					//now maybe add the fragments to the list
					for (var j = 0; j < set.Count; j++)
					{
						//Render.Draw(set.getAtomContainer(j), "");
						if (set[j].getAtomCount() > 0 && set[j].getBondCount() > 0 && set[j].getAtomCount() != atomContainer.getAtomCount())
						{
							//now check the current mass
							var fragMass = getFragmentMass(set[j], fragWeightList[j]);
							//check the weight of the current fragment
							if (!isHeavyEnough(fragMass))
							{
								continue;
							}

							//returns true if isomorph
							//set the current sum formula
							var fragmentFormula = MolecularFormulaTools.GetMolecularFormula(set[j]);
							var currentSumFormula = MolecularFormulaTools.GetString(fragmentFormula);

							if (isIdentical(set[j], currentSumFormula))
							{
								continue;
							}

							//add the fragment to the return list
							ret.Add(set[j]);
						}
					}
				}
			}
			else
			{
//.........这里部分代码省略.........
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:101,代码来源:Fragmenter.cs


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