use of org.openscience.cdk.AtomContainerSet in project cdk by cdk.
the class MoleculeSetManipulatorTest method testRemoveElectronContainer_IAtomContainerSet_IElectronContainer.
@Test
public void testRemoveElectronContainer_IAtomContainerSet_IElectronContainer() {
IAtomContainerSet ms = new AtomContainerSet();
IAtomContainer mol = new AtomContainer();
mol.addAtom(new Atom("O"));
mol.addAtom(new Atom("O"));
mol.addBond(0, 1, IBond.Order.DOUBLE);
IBond bond = mol.getBond(0);
ms.addAtomContainer(mol);
IBond otherBond = new Bond(new Atom(), new Atom());
MoleculeSetManipulator.removeElectronContainer(ms, otherBond);
Assert.assertEquals(1, MoleculeSetManipulator.getBondCount(ms));
MoleculeSetManipulator.removeElectronContainer(ms, bond);
Assert.assertEquals(0, MoleculeSetManipulator.getBondCount(ms));
}
use of org.openscience.cdk.AtomContainerSet in project cdk by cdk.
the class SDFWriterTest method testWrite_IAtomContainerSet_SingleMolecule.
@Test
public void testWrite_IAtomContainerSet_SingleMolecule() throws Exception {
StringWriter writer = new StringWriter();
IAtomContainerSet molSet = new AtomContainerSet();
IAtomContainer molecule = new AtomContainer();
molecule.addAtom(new Atom("C"));
molSet.addAtomContainer(molecule);
SDFWriter sdfWriter = new SDFWriter(writer);
sdfWriter.write(molSet);
sdfWriter.close();
Assert.assertTrue(writer.toString().contains("$$$$"));
}
use of org.openscience.cdk.AtomContainerSet in project cdk by cdk.
the class CMLRoundTripTest method testChemModel.
/**
* @cdk.bug 1455346
*/
@Test
public void testChemModel() throws Exception {
ChemModel model = new ChemModel();
IAtomContainerSet moleculeSet = new AtomContainerSet();
IAtomContainer mol = new AtomContainer();
PseudoAtom atom = new PseudoAtom("N");
mol.addAtom(atom);
moleculeSet.addAtomContainer(mol);
model.setMoleculeSet(moleculeSet);
IChemModel roundTrippedModel = CMLRoundTripTool.roundTripChemModel(convertor, model);
IAtomContainerSet roundTrippedMolSet = roundTrippedModel.getMoleculeSet();
Assert.assertNotNull(roundTrippedMolSet);
Assert.assertEquals(1, roundTrippedMolSet.getAtomContainerCount());
IAtomContainer roundTrippedMolecule = roundTrippedMolSet.getAtomContainer(0);
Assert.assertNotNull(roundTrippedMolecule);
Assert.assertEquals(1, roundTrippedMolecule.getAtomCount());
}
use of org.openscience.cdk.AtomContainerSet in project cdk by cdk.
the class INChIHandler method startDocument.
@Override
public void startDocument() {
chemFile = new ChemFile();
chemSequence = new ChemSequence();
chemModel = new ChemModel();
setOfMolecules = new AtomContainerSet();
}
use of org.openscience.cdk.AtomContainerSet in project cdk by cdk.
the class SMILESReaderTest method testReadingSmiFile_3.
@Test
public void testReadingSmiFile_3() throws Exception {
String filename = "test3.smi";
logger.info("Testing: " + filename);
InputStream ins = this.getClass().getResourceAsStream(filename);
SMILESReader reader = new SMILESReader(ins);
IAtomContainerSet som = reader.read(new AtomContainerSet());
Assert.assertEquals(5, som.getAtomContainerCount());
}
Aggregations