/** {@inheritDoc} */ @Override public IAtomContainerSet getMoleculeSet() { logger.debug("Getting setOfMolecules: ", super.getMoleculeSet()); return super.getMoleculeSet(); }
/** * Returns a String representation of the contents of this * IChemObject. * * @return String representation of content */ @Override public String toString() { StringBuffer buffer = new StringBuffer(64); buffer.append("ChemModel("); buffer.append(hashCode()); if (getMoleculeSet() != null) { buffer.append(", "); buffer.append(getMoleculeSet().toString()); } if (getCrystal() != null) { buffer.append(", "); buffer.append(getCrystal().toString()); } if (getReactionSet() != null) { buffer.append(", "); buffer.append(getReactionSet().toString()); } buffer.append(')'); return buffer.toString(); }
/** * Returns a String representation of the contents of this * IChemObject. * * @return String representation of content */ @Override public String toString() { StringBuffer buffer = new StringBuffer(64); buffer.append("ChemModel("); buffer.append(hashCode()); if (getMoleculeSet() != null) { buffer.append(", "); buffer.append(getMoleculeSet().toString()); } if (getCrystal() != null) { buffer.append(", "); buffer.append(getCrystal().toString()); } if (getReactionSet() != null) { buffer.append(", "); buffer.append(getReactionSet().toString()); } buffer.append(')'); return buffer.toString(); }
int i = 0; String eol = System.getProperty("line.separator"); for (IAtomContainer container : model.getMoleculeSet() .atomContainers()) { if (model.getMoleculeSet().getAtomContainerCount() > 1) { dialogText.append(GT.get("Structure") + " #" + (i + 1) + eol);
@Test public void testExample() throws Exception { String testfile = "!Header mm1gp 100\n" + "!Info 1\n" + "!Atoms 6\n" + "0 6 \n" + "1 6 \n" + "2 1 \n" + "3 1 \n" + "4 1 \n" + "5 1 \n" + "!Bonds 5\n" + "1 0 D \n" + "2 0 S \n" + "3 0 S \n" + "4 1 S \n" + "5 1 S \n" + "!Coord\n" + "0 0.06677 -0.00197151 4.968e-07 \n" + "1 -0.0667699 0.00197154 -5.19252e-07 \n" + "2 0.118917 -0.097636 2.03406e-06 \n" + "3 0.124471 0.0904495 -4.84021e-07 \n" + "4 -0.118917 0.0976359 -2.04017e-06 \n" + "5 -0.124471 -0.0904493 5.12591e-07 \n" + "!Charges\n" + "0 -0.2\n" + "1 -0.2\n" + "2 0.1\n" + "3 0.1\n" + "4 0.1\n" + "5 0.1\n" + "!End"; StringReader stringReader = new StringReader(testfile); GhemicalMMReader reader = new GhemicalMMReader(stringReader); ChemModel model = (ChemModel) reader.read((ChemObject) new ChemModel()); reader.close(); Assert.assertNotNull(model); Assert.assertNotNull(model.getMoleculeSet()); IAtomContainerSet som = model.getMoleculeSet(); Assert.assertNotNull(som); Assert.assertEquals(1, som.getAtomContainerCount()); IAtomContainer m = som.getAtomContainer(0); Assert.assertNotNull(m); Assert.assertEquals(6, m.getAtomCount()); Assert.assertEquals(5, m.getBondCount()); // test reading of formal charges org.openscience.cdk.interfaces.IAtom a = m.getAtom(0); Assert.assertNotNull(a); Assert.assertEquals(6, a.getAtomicNumber().intValue()); Assert.assertEquals(-0.2, a.getCharge(), 0.01); Assert.assertEquals(0.06677, a.getPoint3d().x, 0.01); }