use of ambit2.core.groups.SuppleAtomContainer in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testAddLonePair_ILonePair.
@Test
public void testAddLonePair_ILonePair() {
IAtomContainer acetone = new SuppleAtomContainer();
IAtom c = MoleculeTools.newAtom(builder, "C");
IAtom o = MoleculeTools.newAtom(builder, "O");
acetone.addAtom(c);
acetone.addAtom(o);
IBond b1 = MoleculeTools.newBond(builder, c, o, IBond.Order.DOUBLE);
acetone.addBond(b1);
ILonePair lp1 = MoleculeTools.newLonePair(builder, o);
ILonePair lp2 = MoleculeTools.newLonePair(builder, o);
acetone.addLonePair(lp1);
acetone.addLonePair(lp2);
Assert.assertEquals(2, acetone.getConnectedLonePairsCount(o));
Assert.assertEquals(0, acetone.getConnectedLonePairsCount(c));
}
use of ambit2.core.groups.SuppleAtomContainer in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testAddAtom_IAtom.
// @Test public void testSetElectronContainerCount_int() {
// IAtomContainer container = new SuppleAtomContainer();
// container.setElectronContainerCount(2);
//
// Assert.assertEquals(2, container.getElectronContainerCount());
// }
// @Test public void testSetAtomCount_int() {
// IAtomContainer container = new SuppleAtomContainer();
// container.setAtomCount(2);
//
// Assert.assertEquals(2, container.getAtomCount());
// }
// @Test public void testGetAtoms() {
// // acetone molecule
// IAtomContainer acetone = new SuppleAtomContainer();
// IAtom c1 = MoleculeTools.newAtom(builder,"C");
// IAtom c2 = MoleculeTools.newAtom(builder,"C");
// IAtom o = MoleculeTools.newAtom(builder,"O");
// IAtom c3 = MoleculeTools.newAtom(builder,"C");
// acetone.addAtom(c1);
// acetone.addAtom(c2);
// acetone.addAtom(c3);
// acetone.addAtom(o);
//
// Assert.assertEquals(4, acetone.getAtoms().length);
// }
@Test
public void testAddAtom_IAtom() {
// acetone molecule
IAtomContainer acetone = new SuppleAtomContainer();
IAtom c1 = MoleculeTools.newAtom(builder, "C");
IAtom c2 = MoleculeTools.newAtom(builder, "C");
IAtom o = MoleculeTools.newAtom(builder, "O");
IAtom c3 = MoleculeTools.newAtom(builder, "C");
acetone.addAtom(c1);
acetone.addAtom(c2);
acetone.addAtom(c3);
acetone.addAtom(o);
int counter = 0;
for (IAtom atom : acetone.atoms()) {
counter++;
}
Assert.assertEquals(4, counter);
// test force growing of default arrays
for (int i = 0; i < 11; i++) {
acetone.addAtom(MoleculeTools.newAtom(builder));
acetone.addBond(MoleculeTools.newBond(builder));
}
}
use of ambit2.core.groups.SuppleAtomContainer in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testRemoveLonePair_ILonePair.
@Test
public void testRemoveLonePair_ILonePair() {
IAtomContainer mol = new SuppleAtomContainer();
IAtom c = MoleculeTools.newAtom(builder, "C");
IAtom c1 = MoleculeTools.newAtom(builder, "C");
mol.addAtom(c);
mol.addAtom(c1);
ILonePair lp = MoleculeTools.newLonePair(builder, c1);
mol.addLonePair(lp);
ILonePair lp1 = MoleculeTools.newLonePair(builder, c);
mol.addLonePair(lp1);
mol.removeLonePair(lp);
Assert.assertEquals(1, mol.getLonePairCount());
Assert.assertEquals(lp1, mol.getLonePair(0));
}
use of ambit2.core.groups.SuppleAtomContainer in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testGetSingleElectronNumber_ISingleElectron.
@Test
public void testGetSingleElectronNumber_ISingleElectron() {
IAtomContainer mol = new SuppleAtomContainer();
IAtom c = MoleculeTools.newAtom(builder, "C");
IAtom c1 = MoleculeTools.newAtom(builder, "C");
mol.addAtom(c);
mol.addAtom(c1);
mol.addSingleElectron(1);
ISingleElectron se = MoleculeTools.newSingleElectron(builder, c);
mol.addSingleElectron(se);
Assert.assertEquals(1, mol.getSingleElectronNumber(se));
}
use of ambit2.core.groups.SuppleAtomContainer in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testClone_IAtom2.
@Test
public void testClone_IAtom2() throws Exception {
IAtomContainer molecule = new SuppleAtomContainer();
IAtom carbon = MoleculeTools.newAtom(builder, "C");
carbon.setPoint2d(new Point2d(2, 4));
// 1
molecule.addAtom(carbon);
// test cloning of Atoms
IAtomContainer clonedMol = (IAtomContainer) molecule.clone();
carbon.setPoint2d(new Point2d(3, 1));
Assert.assertEquals(clonedMol.getAtom(0).getPoint2d().x, 2.0, 0.001);
}
Aggregations