本文整理汇总了Java中org.openscience.cdk.interfaces.IAtomContainer.getBond方法的典型用法代码示例。如果您正苦于以下问题:Java IAtomContainer.getBond方法的具体用法?Java IAtomContainer.getBond怎么用?Java IAtomContainer.getBond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openscience.cdk.interfaces.IAtomContainer
的用法示例。
在下文中一共展示了IAtomContainer.getBond方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseBond
import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
* Append the symbol for the bond order between <code>a1</code> and <code>a2</code>
* to the <code>line</code>.
*
*@param line the StringBuffer that the bond symbol is appended to.
*@param a1 Atom participating in the bond.
*@param a2 Atom participating in the bond.
*@param atomContainer the AtomContainer that the SMILES string is generated
* for.
*@param useAromaticity true=aromaticity or sp2 will trigger lower case letters, wrong=only sp2
*/
private void parseBond(StringBuffer line, IAtom a1, IAtom a2, IAtomContainer atomContainer, boolean useAromaticity)
{
//logger.debug("in parseBond()");
if (useAromaticity && a1.getFlag(CDKConstants.ISAROMATIC) && a2.getFlag(CDKConstants.ISAROMATIC))
{
return;
}
if (atomContainer.getBond(a1, a2) == null)
{
return;
}
IBond.Order type = atomContainer.getBond(a1, a2).getOrder();
if (type == IBond.Order.SINGLE) {
} else if (type == IBond.Order.DOUBLE) {
line.append("=");
} else if (type == IBond.Order.TRIPLE) {
line.append("#");
} else {
// //logger.debug("Unknown bond type");
}
}
示例2: makeGraph
import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private void makeGraph(IAtomContainer base){
graph = new SparseUndirectedGraph();
for(int i=0; i<base.getAtomCount(); i++){
graph.add(i);
atomsToNodes.put(base.getAtom(i), i);
nodesToAtoms.put(i, base.getAtom(i));
for(int j=0; j<i; j++){
IBond bond = base.getBond(base.getAtom(i), base.getAtom(j));
if( bond != null){
Edge newEdge = new SimpleEdge(i,j);
bondsToEdges.put(bond, newEdge);
edgesToBonds.put(newEdge, bond);
graph.add( newEdge);
}
}
}
}
示例3: isCOOHPOOHSOOHGroup
import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private boolean isCOOHPOOHSOOHGroup(IAtom a, IAtomContainer mol) {
int falseNeighbor = 0;
boolean doubleBondSeen = false;
boolean singleBondSeen = false;
boolean hydrogenSeen = false;
for (final IAtom n : mol.getConnectedAtomsList(a)) {
if (!n.getAtomicNumber().equals(8)) {
if (falseNeighbor == 1) {
return false;
} else {
falseNeighbor++;
}
} else {
// Oxygen neighbor check bond type
final IBond b = mol.getBond(a, n);
if (b.getOrder().equals(IBond.Order.SINGLE)) {
if (!singleBondSeen) {
singleBondSeen = true;
if (n.getImplicitHydrogenCount() > 0)
hydrogenSeen = true;
} else {
return false;
}
} else if (b.getOrder().equals(IBond.Order.DOUBLE)) {
if (!doubleBondSeen) {
doubleBondSeen = true;
} else {
return false;
}
}
}
}
if (doubleBondSeen && singleBondSeen && hydrogenSeen) {
return true;
} else {
return false;
}
}
示例4: getBondRefs
import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static BondRef[] getBondRefs(IAtomContainer mol) {
final int numAtoms = mol.getAtomCount();
final int numBonds = mol.getBondCount();
BondRef[] bonds = new BondRef[numBonds];
final Map<IAtom, AtomRef> atomCache = new IdentityHashMap<>(mol.getAtomCount());
for (int i = 0; i < numAtoms; i++) {
final IAtom atom = mol.getAtom(i);
final AtomRef atomrf = new AtomRef(i,
atom,
new ArrayList<BondRef>());
atomCache.put(atomrf.atom, atomrf);
}
for (int i = 0; i < numBonds; i++) {
final IBond bond = mol.getBond(i);
AtomRef beg = atomCache.get(bond.getAtom(0));
AtomRef end = atomCache.get(bond.getAtom(1));
final BondRef bondref = new BondRef(bond, i, beg, end);
beg.bonds.add(bondref);
end.bonds.add(bondref);
bonds[i] = bondref;
}
return bonds;
}
示例5: getAtomRefs
import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static AtomRef[] getAtomRefs(IAtomContainer mol) {
final int numAtoms = mol.getAtomCount();
final int numBonds = mol.getBondCount();
AtomRef[] atoms = new AtomRef[numAtoms];
final Map<IAtom, AtomRef> atomCache = new IdentityHashMap<>(mol.getAtomCount());
for (int i = 0; i < numAtoms; i++) {
final IAtom atom = mol.getAtom(i);
final AtomRef atomrf = new AtomRef(i,
atom,
new ArrayList<BondRef>());
atomCache.put(atomrf.atom, atomrf);
atoms[i] = atomrf;
}
for (int i = 0; i < numBonds; i++) {
final IBond bond = mol.getBond(i);
AtomRef beg = atomCache.get(bond.getAtom(0));
AtomRef end = atomCache.get(bond.getAtom(1));
final BondRef bondref = new BondRef(bond, i, beg, end);
beg.bonds.add(bondref);
end.bonds.add(bondref);
}
return atoms;
}