org.openscience.cdk.Bond类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.openscience.cdk.Bond类的一些代码示例,展示了Bond类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bond类的具体详情如下:
包路径:org.openscience.cdk.Bond
类名称:Bond

Bond介绍

[英]Implements the concept of a covalent bond between two or more atoms. A bond is considered to be a number of electrons connecting two or more of atoms. It should be noted that the majority of applications will consider 2-center bonds, especially since the bond orders currently supported are really only valid for 2-center bonds. However the code does support multi-center bonds, though the orders may not make sense at this point. In general code that assumes bonds are 2-centered can use this class seamlessly, as the semantics are identical to the older versions. Care shoud be exercised when using multi-center bonds using this class as the orders may not make sense.
[中]实现两个或多个原子之间共价键的概念。键被认为是连接两个或多个原子的多个电子。应该注意的是,大多数应用会考虑2个中心债券,特别是因为目前所支持的债券订单实际上只适用于2个中心债券。然而,该代码确实支持多中心债券,尽管在这一点上订单可能没有意义。一般来说,假定绑定是以2为中心的代码可以无缝地使用此类,因为语义与旧版本相同。使用此类多中心债券时应小心,因为订单可能没有意义。

代码示例

代码示例来源:origin: cdk/cdk

/**
 * {@inheritDoc}
 */
@Override
public IBond newBond() {
  return new Bond();
}

代码示例来源:origin: org.openscience.cdk/cdk-data

/**
 * Returns a one line string representation of this Container. This method is
 * conform RFC #9.
 *
 * @return The string representation of this Container
 */
@Override
public String toString() {
  StringBuffer resultString = new StringBuffer(32);
  resultString.append("Bond(").append(this.hashCode());
  if (getOrder() != null) {
    resultString.append(", #O:").append(getOrder());
  }
  resultString.append(", #S:").append(getStereo());
  if (getAtomCount() > 0) {
    resultString.append(", #A:").append(getAtomCount());
    for (int i = 0; i < atomCount; i++) {
      resultString.append(", ").append(atoms[i] == null ? "null" : atoms[i].toString());
    }
  }
  resultString.append(", ").append(super.toString());
  resultString.append(')');
  return resultString.toString();
}

代码示例来源:origin: org.openscience.cdk/cdk-data

/** {@inheritDoc} */
@Override
public boolean isAromatic() {
  return getFlag(CDKConstants.ISAROMATIC);
}

代码示例来源:origin: cdk/cdk

Atom a9 = new Atom("H");
mol.addAtom(a9);
Bond b1 = new Bond(a1, a2, IBond.Order.SINGLE);
mol.addBond(b1);
Bond b2 = new Bond(a1, a3, IBond.Order.SINGLE);
mol.addBond(b2);
Bond b3 = new Bond(a1, a4, IBond.Order.SINGLE);
mol.addBond(b3);
Bond b4 = new Bond(a5, a2, IBond.Order.SINGLE);
mol.addBond(b4);
Bond b5 = new Bond(a2, a6, IBond.Order.SINGLE);
mol.addBond(b5);
Bond b6 = new Bond(a3, a7, IBond.Order.SINGLE);
mol.addBond(b6);
Bond b7 = new Bond(a3, a8, IBond.Order.SINGLE);
mol.addBond(b7);
Bond b8 = new Bond(a7, a5, IBond.Order.SINGLE);
mol.addBond(b8);
Bond b9 = new Bond(a5, a9, IBond.Order.SINGLE);
mol.addBond(b9);
satcheck.saturate(mol);
Assert.assertEquals(IBond.Order.SINGLE, b1.getOrder());
Assert.assertEquals(IBond.Order.DOUBLE, b2.getOrder());
Assert.assertEquals(IBond.Order.SINGLE, b6.getOrder());
Assert.assertEquals(IBond.Order.SINGLE, b8.getOrder());
Assert.assertEquals(IBond.Order.DOUBLE, b4.getOrder());

代码示例来源:origin: cdk/cdk

@Test
public void testBondAromatic() throws Exception {
  IAtomContainer mol = new AtomContainer();
  // surely, this bond is not aromatic... but fortunately, file formats do not care about chemistry
  Atom atom = new Atom("C");
  Atom atom2 = new Atom("C");
  mol.addAtom(atom);
  mol.addAtom(atom2);
  Bond bond = new Bond(atom, atom2, IBond.Order.SINGLE);
  bond.setFlag(CDKConstants.ISAROMATIC, true);
  mol.addBond(bond);
  IAtomContainer roundTrippedMol = CMLRoundTripTool.roundTripMolecule(convertor, mol);
  Assert.assertEquals(2, roundTrippedMol.getAtomCount());
  Assert.assertEquals(1, roundTrippedMol.getBondCount());
  IBond roundTrippedBond = roundTrippedMol.getBond(0);
  Assert.assertEquals(bond.getFlag(CDKConstants.ISAROMATIC), roundTrippedBond.getFlag(CDKConstants.ISAROMATIC));
  Assert.assertEquals(bond.getOrder(), roundTrippedBond.getOrder());
}

代码示例来源:origin: cdk/cdk

@Test
public void testBondID() throws Exception {
  IAtomContainer mol = new AtomContainer();
  Atom atom = new Atom("C");
  Atom atom2 = new Atom("O");
  mol.addAtom(atom);
  mol.addAtom(atom2);
  Bond bond = new Bond(atom, atom2, IBond.Order.SINGLE);
  bond.setID("b1");
  mol.addBond(bond);
  IAtomContainer roundTrippedMol = CMLRoundTripTool.roundTripMolecule(convertor, mol);
  IBond roundTrippedBond = roundTrippedMol.getBond(0);
  Assert.assertEquals(bond.getID(), roundTrippedBond.getID());
}

代码示例来源:origin: cdk/cdk

@Test
public void testBondStereo() throws Exception {
  IAtomContainer mol = new AtomContainer();
  Atom atom = new Atom("C");
  Atom atom2 = new Atom("O");
  mol.addAtom(atom);
  mol.addAtom(atom2);
  Bond bond = new Bond(atom, atom2, IBond.Order.SINGLE);
  IBond.Stereo stereo = IBond.Stereo.DOWN;
  bond.setStereo(stereo);
  mol.addBond(bond);
  IAtomContainer roundTrippedMol = CMLRoundTripTool.roundTripMolecule(convertor, mol);
  Assert.assertEquals(2, roundTrippedMol.getAtomCount());
  Assert.assertEquals(1, roundTrippedMol.getBondCount());
  IBond roundTrippedBond = roundTrippedMol.getBond(0);
  Assert.assertEquals(bond.getStereo(), roundTrippedBond.getStereo());
}

代码示例来源:origin: cdk/cdk

@Test
public void testCreateIDs_IChemObject() {
  IAtomContainer mol = new AtomContainer();
  Atom atom1 = new Atom("C");
  Atom atom2 = new Atom("C");
  mol.addAtom(atom1);
  mol.addAtom(atom2);
  Bond bond = new Bond(atom1, atom2);
  mol.addBond(bond);
  IDCreator.createIDs(mol);
  Assert.assertEquals("a1", atom1.getID());
  Assert.assertEquals("b1", bond.getID());
  List<String> ids = AtomContainerManipulator.getAllIDs(mol);
  Assert.assertEquals(4, ids.size());
}

代码示例来源:origin: cdk/cdk

/** {@inheritDoc} */
@Override
public Order getOrder() {
  logger.debug("Getting order: ", super.getOrder());
  return super.getOrder();
}

代码示例来源:origin: cdk/cdk

/** {@inheritDoc} */
@Override
public String getID() {
  logger.debug("Getting ID: ", super.getID());
  return super.getID();
}

代码示例来源:origin: cdk/cdk

/** {@inheritDoc} */
@Override
public IBond.Stereo getStereo() {
  logger.debug("Getting stereo: ", super.getStereo());
  return super.getStereo();
}

代码示例来源:origin: cdk/cdk

Atom a12 = new Atom("O");
mol.addAtom(a12);
Bond b1 = new Bond(a2, a1, IBond.Order.SINGLE);
mol.addBond(b1);
Bond b2 = new Bond(a1, a3, IBond.Order.SINGLE);
mol.addBond(b2);
Bond b3 = new Bond(a1, a4, IBond.Order.SINGLE);
mol.addBond(b3);
Bond b4 = new Bond(a5, a3, IBond.Order.SINGLE);
mol.addBond(b4);
Bond b5 = new Bond(a3, a6, IBond.Order.SINGLE);
mol.addBond(b5);
Bond b6 = new Bond(a7, a4, IBond.Order.SINGLE);
mol.addBond(b6);
Bond b7 = new Bond(a4, a8, IBond.Order.SINGLE);
mol.addBond(b7);
Bond b8 = new Bond(a6, a9, IBond.Order.SINGLE);
mol.addBond(b8);
Bond b9 = new Bond(a6, a10, IBond.Order.SINGLE);
mol.addBond(b9);
Bond b10 = new Bond(a8, a10, IBond.Order.SINGLE);
mol.addBond(b10);
Bond b11 = new Bond(a8, a11, IBond.Order.SINGLE);
mol.addBond(b11);
Bond b12 = new Bond(a10, a12, IBond.Order.SINGLE);
mol.addBond(b12);
satcheck.saturate(mol);
Assert.assertEquals(IBond.Order.DOUBLE, b1.getOrder());
Assert.assertEquals(IBond.Order.SINGLE, b2.getOrder());

代码示例来源:origin: cdk/cdk

/**
 * @cdk.bug 1713398
 */
@Test
public void testBondAromatic_Double() throws Exception {
  IAtomContainer mol = new AtomContainer();
  // surely, this bond is not aromatic... but fortunately, file formats do not care about chemistry
  Atom atom = new Atom("C");
  Atom atom2 = new Atom("C");
  mol.addAtom(atom);
  mol.addAtom(atom2);
  Bond bond = new Bond(atom, atom2, IBond.Order.DOUBLE);
  bond.setFlag(CDKConstants.ISAROMATIC, true);
  mol.addBond(bond);
  IAtomContainer roundTrippedMol = CMLRoundTripTool.roundTripMolecule(convertor, mol);
  Assert.assertEquals(2, roundTrippedMol.getAtomCount());
  Assert.assertEquals(1, roundTrippedMol.getBondCount());
  IBond roundTrippedBond = roundTrippedMol.getBond(0);
  Assert.assertEquals(bond.getFlag(CDKConstants.ISAROMATIC), roundTrippedBond.getFlag(CDKConstants.ISAROMATIC));
  Assert.assertEquals(bond.getOrder(), roundTrippedBond.getOrder());
}

代码示例来源:origin: org.openscience.cdk/cdk-data

/**
 * {@inheritDoc}
 */
@Override
public IBond newBond() {
  return new Bond();
}

代码示例来源:origin: cdk/cdk

Atom c4 = new Atom("C");
c4.setImplicitHydrogenCount(2);
Bond b1 = new Bond(c1, c2, IBond.Order.SINGLE);
Bond b2 = new Bond(c3, c2, IBond.Order.SINGLE);
Bond b3 = new Bond(c3, c4, IBond.Order.SINGLE);
m.addBond(b3);
satcheck.saturate(m);
Assert.assertEquals(IBond.Order.DOUBLE, b1.getOrder());
Assert.assertEquals(IBond.Order.SINGLE, b2.getOrder());
Assert.assertEquals(IBond.Order.DOUBLE, b3.getOrder());

代码示例来源:origin: cdk/cdk

/**
 * Returns a one line string representation of this Container. This method is
 * conform RFC #9.
 *
 * @return The string representation of this Container
 */
@Override
public String toString() {
  StringBuffer resultString = new StringBuffer(32);
  resultString.append("Bond(").append(this.hashCode());
  if (getOrder() != null) {
    resultString.append(", #O:").append(getOrder());
  }
  resultString.append(", #S:").append(getStereo());
  if (getAtomCount() > 0) {
    resultString.append(", #A:").append(getAtomCount());
    for (int i = 0; i < atomCount; i++) {
      resultString.append(", ").append(atoms[i] == null ? "null" : atoms[i].toString());
    }
  }
  resultString.append(", ").append(super.toString());
  resultString.append(')');
  return resultString.toString();
}

代码示例来源:origin: org.openscience.cdk/cdk-data

/** {@inheritDoc} */
@Override
public boolean isInRing() {
  return getFlag(CDKConstants.ISINRING);
}

代码示例来源:origin: cdk/cdk

@Override
  public IChemObject newTestObject() {
    return new Bond();
  }
});

代码示例来源:origin: cdk/cdk

Atom a16 = new Atom("H");
mol.addAtom(a16);
Bond b1 = new Bond(a2, a1, IBond.Order.SINGLE);
mol.addBond(b1);
Bond b2 = new Bond(a3, a2, IBond.Order.SINGLE);
mol.addBond(b2);
Bond b3 = new Bond(a2, a4, IBond.Order.SINGLE);
mol.addBond(b3);
Bond b4 = new Bond(a5, a4, IBond.Order.SINGLE);
mol.addBond(b4);
Bond b5 = new Bond(a4, a6, IBond.Order.SINGLE);
mol.addBond(b5);
Bond b6 = new Bond(a7, a5, IBond.Order.SINGLE);
mol.addBond(b6);
Bond b7 = new Bond(a8, a5, IBond.Order.SINGLE);
mol.addBond(b7);
Bond b8 = new Bond(a6, a9, IBond.Order.SINGLE);
mol.addBond(b8);
Bond b9 = new Bond(a6, a10, IBond.Order.SINGLE);
mol.addBond(b9);
Bond b10 = new Bond(a11, a8, IBond.Order.SINGLE);
mol.addBond(b10);
Bond b11 = new Bond(a8, a12, IBond.Order.SINGLE);
mol.addBond(b11);
Bond b12 = new Bond(a9, a13, IBond.Order.SINGLE);
mol.addBond(b12);
Bond b13 = new Bond(a12, a9, IBond.Order.SINGLE);
mol.addBond(b13);
Bond b14 = new Bond(a14, a12, IBond.Order.SINGLE);

代码示例来源:origin: cdk/cdk

/** {@inheritDoc} */
@Override
public boolean isAromatic() {
  return getFlag(CDKConstants.ISAROMATIC);
}

相关文章