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


C# IAtomContainer.getProperties方法代码示例

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


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

示例1: setBondEnergy

		/**
		 * Sets the bond energy.
		 * 
		 * @param mol the mol
		 * @param bondEnergy the bond energy
		 * 
		 * @return the i atom container
		 */

		private IAtomContainer setBondEnergy(IAtomContainer origMol, IAtomContainer mol, Double bondEnergy)
		{
			var props = mol.getProperties();
			var bondEnergyOrig = (String)origMol.getProperty("BondEnergy");
			if (bondEnergyOrig != null)
			{
                var sumEnergy = Convert.ToDouble(bondEnergyOrig, CultureInfo.InvariantCulture) + bondEnergy;
				props.put("BondEnergy", sumEnergy.ToString(CultureInfo.InvariantCulture));
			}
			else
			{
				props.put("BondEnergy", bondEnergy.ToString(CultureInfo.InvariantCulture));
			}

			mol.setProperties(props);
			return mol;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:26,代码来源:Fragmenter.cs

示例2: createMolecule

		private IMolecule createMolecule(IAtomContainer atomContainer, String bondEnergy, int treeDepth)
		{
			IMolecule molecule = new Molecule(atomContainer);

			molecule.setProperties(atomContainer.getProperties());
			molecule.setProperty("BondEnergy", bondEnergy);
			molecule.setProperty("TreeDepth", treeDepth.toString());

			return molecule;
		}
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:10,代码来源: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

示例4: checkForCompleteNeutralLoss

		/**
		 * Check for the other atoms nearby in the fragment.
		 * 
		 * @param candidateOxygen
		 *            the candidate oxygen atom
		 * @param frag
		 *            the frag
		 * @param proton
		 *            the proton
		 * 
		 * @return true, if successful
		 * @throws CloneNotSupportedException
		 * @throws CDKException
		 */

		private IAtomContainer checkForCompleteNeutralLoss(IAtomContainer frag, IAtom candidateAtom, double neutralLossMass)
		{
			IAtomContainer ret = new AtomContainer();

			// create a copy from the original fragment
			var part = new List<IBond>();
			part = traverse(frag, candidateAtom, part);
			var fragCopy = makeAtomContainer(candidateAtom, part);

			// set properties again
			var properties = frag.getProperties();
			fragCopy.setProperties(properties);

			// now get the other atoms from the neutral loss
			var atomsToFind = new List<string>();
			var addHydrogen = false;
			// one hydrogen is lost with the neutral loss
			if (neutralLoss[neutralLossMass].HydrogenDifference == -1)
			{
				foreach (var isotope in neutralLoss[neutralLossMass].ElementalComposition.isotopes().ToWindowsEnumerable<IIsotope>())
				{
					var c = neutralLoss[neutralLossMass].ElementalComposition.getIsotopeCount(isotope);

					for (var i = 0; i < c; i++)
					{
						atomsToFind.Add(isotope.getSymbol());
					}
				}
			}
			else
			{
				foreach (var isotope in neutralLoss[neutralLossMass].TopoFragment.isotopes().ToWindowsEnumerable<IIsotope>())
				{
					var c = neutralLoss[neutralLossMass].ElementalComposition.getIsotopeCount(isotope);

					for (var i = 0; i < c; i++)
					{
						atomsToFind.Add(isotope.getSymbol());
					}
					addHydrogen = true;
				}
			}

			// at most 2 bonds between the oxygen and other atoms (at most 1 H and 2
			// C)
			var count = neutralLoss[neutralLossMass].Distance;
			// list storing all atoms to be removed later on if complete neutral
			// loss was found
			var foundAtoms = new List<IAtom>();
			// list storing all bonds to remove
			var foundBonds = new List<IBond>();
			// list storing all bonds already checked
			var checkedBonds = new List<IBond>();
			// list storing all checked atoms
			var checkedAtoms = new List<IAtom>();
			// queue storing all bonds to check for a particular distance
			var bondQueue = new List<IBond>();
			// List storing all bonds to be checked for the next distance
			var bondsFurther = new List<IBond>();
			// get all bonds from this atom distance = 1

			var bondList = fragCopy.getConnectedBondsList(candidateAtom);
			foreach (var bond in bondList.ToWindowsEnumerable<IBond>())
			{
				if (bond != null)
				{
					bondQueue.Add(bond);
				}
			}

			var hydrogenStartAtom = neutralLoss[neutralLossMass].HydrogenOnStartAtom;
			var firstBonds = true;

			while (count > 0)
			{
				IBond currentBond = null;
				if (bondQueue.Count > 0)
				{
					currentBond = bondQueue[bondQueue.Count - 1];
					bondQueue.RemoveAt(bondQueue.Count - 1);
				}

				// check for already tried bonds
				if (checkedBonds.Contains(currentBond) && currentBond != null)
				{
//.........这里部分代码省略.........
开发者ID:NonlinearDynamics,项目名称:MetFrag.NET,代码行数:101,代码来源:PostProcessor.cs


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