本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}