use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class CPSADescriptorTest method testUnChargedMolecule.
@Test
public void testUnChargedMolecule() throws Exception {
String filename = "cpsa-uncharged.sdf";
InputStream ins = this.getClass().getResourceAsStream(filename);
ISimpleChemObjectReader reader = new MDLV2000Reader(ins);
ChemFile content = (ChemFile) reader.read((ChemObject) new ChemFile());
List cList = ChemFileManipulator.getAllAtomContainers(content);
IAtomContainer ac = (IAtomContainer) cList.get(0);
DoubleArrayResult retval = (DoubleArrayResult) descriptor.calculate(ac).getValue();
int ndesc = retval.length();
for (int i = 0; i < ndesc; i++) Assert.assertTrue(retval.get(i) != Double.NaN);
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class PMPReaderTest method testTwoAceticAcid.
@Test
public void testTwoAceticAcid() throws Exception {
String filename = "two_aceticacid.pmp";
InputStream ins = this.getClass().getResourceAsStream(filename);
PMPReader reader = new PMPReader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
reader.close();
Assert.assertNotNull(chemFile);
Assert.assertEquals(1, chemFile.getChemSequenceCount());
IChemSequence seq = chemFile.getChemSequence(0);
Assert.assertNotNull(seq);
Assert.assertEquals(2, seq.getChemModelCount());
IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
ICrystal crystal = model.getCrystal();
Assert.assertNotNull(crystal);
Assert.assertEquals(32, crystal.getAtomCount());
Assert.assertEquals(28, crystal.getBondCount());
model = seq.getChemModel(1);
Assert.assertNotNull(model);
crystal = model.getCrystal();
Assert.assertNotNull(crystal);
Assert.assertEquals(32, crystal.getAtomCount());
Assert.assertEquals(28, crystal.getBondCount());
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class XYZReaderTest method testViagra.
@Test
public void testViagra() throws Exception {
String filename = "viagra.xyz";
logger.info("Testing: ", filename);
InputStream ins = this.getClass().getResourceAsStream(filename);
XYZReader reader = new XYZReader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
reader.close();
Assert.assertNotNull(chemFile);
Assert.assertEquals(1, chemFile.getChemSequenceCount());
org.openscience.cdk.interfaces.IChemSequence seq = chemFile.getChemSequence(0);
Assert.assertNotNull(seq);
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
Assert.assertEquals(1, som.getAtomContainerCount());
IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(63, m.getAtomCount());
Assert.assertEquals(0, m.getBondCount());
Assert.assertEquals("N", m.getAtom(0).getSymbol());
Assert.assertNotNull(m.getAtom(0).getPoint3d());
Assert.assertEquals(-3.4932, m.getAtom(0).getPoint3d().x, 0.0001);
Assert.assertEquals(-1.8950, m.getAtom(0).getPoint3d().y, 0.0001);
Assert.assertEquals(0.1795, m.getAtom(0).getPoint3d().z, 0.0001);
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class XYZReaderTest method testComment.
@Test
public void testComment() throws Exception {
String filename = "viagra_withComment.xyz";
logger.info("Testing: ", filename);
InputStream ins = this.getClass().getResourceAsStream(filename);
XYZReader reader = new XYZReader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
reader.close();
Assert.assertNotNull(chemFile);
Assert.assertEquals(1, chemFile.getChemSequenceCount());
org.openscience.cdk.interfaces.IChemSequence seq = chemFile.getChemSequence(0);
Assert.assertNotNull(seq);
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
IAtomContainerSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
Assert.assertEquals(1, som.getAtomContainerCount());
IAtomContainer m = som.getAtomContainer(0);
Assert.assertNotNull(m);
Assert.assertEquals(63, m.getAtomCount());
Assert.assertEquals(0, m.getBondCount());
// atom 63: H 3.1625 3.1270 -0.9362
Assert.assertEquals("H", m.getAtom(62).getSymbol());
Assert.assertNotNull(m.getAtom(62).getPoint3d());
Assert.assertEquals(3.1625, m.getAtom(62).getPoint3d().x, 0.0001);
Assert.assertEquals(3.1270, m.getAtom(62).getPoint3d().y, 0.0001);
Assert.assertEquals(-0.9362, m.getAtom(62).getPoint3d().z, 0.0001);
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class GhemicalReaderTest method testEthene.
@Test
public void testEthene() throws Exception {
String filename = "ethene.mm1gp";
InputStream ins = this.getClass().getResourceAsStream(filename);
GhemicalMMReader reader = new GhemicalMMReader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
reader.close();
Assert.assertNotNull(chemFile);
Assert.assertEquals(1, chemFile.getChemSequenceCount());
org.openscience.cdk.interfaces.IChemSequence seq = chemFile.getChemSequence(0);
Assert.assertNotNull(seq);
Assert.assertEquals(1, seq.getChemModelCount());
org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0);
Assert.assertNotNull(model);
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());
}
Aggregations