use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class BondToolsTest method testGiveAngleFromMiddle_IAtom_IAtom_IAtom.
@Test
public void testGiveAngleFromMiddle_IAtom_IAtom_IAtom() throws Exception {
String filename = "testdoublebondconfig.mol";
InputStream ins = this.getClass().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(2.0943946986086157, BondTools.giveAngleFromMiddle(mol.getAtom(0), mol.getAtom(2), mol.getAtom(3)), 0.2);
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class BondToolsTest method testCloseEnoughToBond_IAtom_IAtom_double.
/**
* Make sure the the rebonding is working.
*/
@Test
public void testCloseEnoughToBond_IAtom_IAtom_double() throws Exception {
String filename = "viagra.xyz";
InputStream ins = this.getClass().getResourceAsStream(filename);
XYZReader reader = new XYZReader(ins);
AtomTypeFactory atf = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", SilentChemObjectBuilder.getInstance());
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
for (IAtom iAtom : mol.atoms()) {
atf.configure(iAtom);
}
Assert.assertTrue(BondTools.closeEnoughToBond(mol.getAtom(0), mol.getAtom(1), 1));
Assert.assertFalse(BondTools.closeEnoughToBond(mol.getAtom(0), mol.getAtom(8), 1));
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class BondToolsTest method testIsStereo_IAtomContainer_IAtom.
@Test
public void testIsStereo_IAtomContainer_IAtom() throws Exception {
String filename = "trigonal_bipyramidal.mol";
InputStream ins = this.getClass().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertTrue(BondTools.isStereo(mol, mol.getAtom(0)));
Assert.assertFalse(BondTools.isStereo(mol, mol.getAtom(1)));
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class BondToolsTest method testIsTrigonalBipyramidalOrOctahedral_IAtomContainer_IAtom.
@Test
public void testIsTrigonalBipyramidalOrOctahedral_IAtomContainer_IAtom() throws Exception {
String filename = "trigonal_bipyramidal.mol";
InputStream ins = this.getClass().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0);
Assert.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol, mol.getAtom(0)), 1);
Assert.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol, mol.getAtom(1)), 0);
}
use of org.openscience.cdk.ChemObject in project cdk by cdk.
the class RDFProtonDescriptor_GDRTest method testExample1.
@Test
public void testExample1() throws Exception {
// firstly read file to molecule
String filename = "hydroxyamino.mol";
InputStream ins = this.getClass().getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT);
ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
IChemSequence seq = chemFile.getChemSequence(0);
IChemModel model = seq.getChemModel(0);
IAtomContainerSet som = model.getMoleculeSet();
IAtomContainer mol = som.getAtomContainer(0);
for (int i = 0; i < mol.getAtomCount(); i++) {
// System.out.println("Atom: " + mol.getAtom(i).getSymbol());
if (mol.getAtom(i).getAtomicNumber() == IElement.H) {
// secondly perform calculation on it.
RDFProtonDescriptor_GDR descriptor = new RDFProtonDescriptor_GDR();
DescriptorValue dv = descriptor.calculate(mol.getAtom(i), mol);
IDescriptorResult result = dv.getValue();
// System.out.println("array: " + result.toString());
Assert.assertNotNull(result);
Assert.assertEquals(dv.getNames().length, result.length());
}
}
}
Aggregations