use of org.openscience.cdk.ChemFile 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.ChemFile 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.ChemFile in project cdk by cdk.
the class Gaussian98ReaderTest method testNMRReading.
@Test
public void testNMRReading() throws Exception {
IAtomContainer atomContainer;
// boolean foundOneShieldingEntry = false;
// Double shielding = null;
Object object;
int shieldingCounter;
String filename = "g98ReaderNMRTest.log";
InputStream ins = this.getClass().getResourceAsStream(filename);
BufferedReader inputReader = new BufferedReader(new InputStreamReader(ins));
Gaussian98Reader g98Reader = new Gaussian98Reader(inputReader);
ChemFile chemFile = g98Reader.read(new ChemFile());
g98Reader.close();
List<IAtomContainer> atomContainersList = ChemFileManipulator.getAllAtomContainers(chemFile);
Assert.assertNotNull(atomContainersList);
Assert.assertTrue(atomContainersList.size() == 54);
// logger.debug("Found " + atomContainers.length + " atomContainers");
Iterator<IAtomContainer> iterator = atomContainersList.iterator();
int counter = 0;
while (iterator.hasNext()) {
IAtomContainer ac = iterator.next();
shieldingCounter = 0;
atomContainer = ac;
for (int g = 0; g < atomContainer.getAtomCount(); g++) {
object = atomContainer.getAtom(g).getProperty(CDKConstants.ISOTROPIC_SHIELDING);
if (object != null) {
// shielding = (Double)object;
shieldingCounter++;
}
}
if (counter < 53)
Assert.assertTrue(shieldingCounter == 0);
else
Assert.assertTrue(shieldingCounter == ac.getAtomCount());
// logger.debug("AtomContainer " + (f + 1) + " has " + atomContainers[f].getAtomCount() + " atoms and " + shieldingCounter + " shielding entries");
counter++;
}
}
use of org.openscience.cdk.ChemFile 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());
}
use of org.openscience.cdk.ChemFile in project cdk by cdk.
the class HINReaderTest method testAromaticRingsLine.
/**
* @cdk.bug 2984581
* @throws Exception
*/
@Test
public void testAromaticRingsLine() throws Exception {
String filename = "bug2984581.hin";
InputStream ins = this.getClass().getResourceAsStream(filename);
ISimpleChemObjectReader reader = new HINReader(ins);
IChemFile content = reader.read(new ChemFile());
reader.close();
List<IAtomContainer> cList = ChemFileManipulator.getAllAtomContainers(content);
Assert.assertEquals(1, cList.size());
}
Aggregations