use of org.openscience.cdk.AtomContainer in project ambit-mirror by ideaconsult.
the class TestUtilities method testAtomAttribsOnChangingBond.
public void testAtomAttribsOnChangingBond() throws Exception {
IAtomContainer mol = new AtomContainer();
IAtom a1 = new Atom("C");
mol.addAtom(a1);
IAtom a2 = new Atom("C");
mol.addAtom(a2);
IAtom a3 = new Atom("N");
mol.addAtom(a3);
IAtom h1 = new Atom("H");
mol.addAtom(h1);
IBond bh1 = new Bond(a1, h1, IBond.Order.SINGLE);
// IAtom h2 = new Atom("H"); mol.addAtom(h2); IBond bh2 = new
// Bond(a2,h2, IBond.Order.SINGLE);
IBond b = new Bond(a1, a2);
IBond b2 = new Bond(a2, a3);
mol.addBond(b);
b.setOrder(IBond.Order.DOUBLE);
mol.addBond(b2);
b2.setOrder(IBond.Order.SINGLE);
mol.addBond(bh1);
// mol.addBond(bh2);
// IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles("CCCCC");
// IBond b = mol.getBond(0);
System.out.println(SmartsHelper.getAtomsAttributes(mol));
System.out.println(SmartsHelper.getBondAttributes(mol));
// FlagExplicitHAtoms = true;
// preProcess(mol);
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
// CDKHydrogenAdder adder =
// CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance());
// adder.addImplicitHydrogens(mol);
System.out.println("percieveAtomTypesAndConfigureAtoms");
System.out.println(SmartsHelper.getAtomsAttributes(mol));
System.out.println(SmartsHelper.getBondAttributes(mol));
b.setOrder(IBond.Order.TRIPLE);
for (IAtom atom : mol.atoms()) {
atom.setHybridization((IAtomType.Hybridization) CDKConstants.UNSET);
// atom.setImplicitHydrogenCount(null);
// atom.setFormalNeighbourCount((Integer) CDKConstants.UNSET);
/*
* atom.setAtomTypeName((String) CDKConstants.UNSET);
*
* atom.setMaxBondOrder((IBond.Order) CDKConstants.UNSET);
* atom.setBondOrderSum((Double) CDKConstants.UNSET);
* atom.setCovalentRadius((Double) CDKConstants.UNSET);
* atom.setValency((Integer) CDKConstants.UNSET);
* atom.setFormalCharge((Integer) CDKConstants.UNSET);
* atom.setHybridization((IAtomType.Hybridization)
* CDKConstants.UNSET); atom.setFormalNeighbourCount((Integer)
* CDKConstants.UNSET);
* atom.setFlag(CDKConstants.IS_HYDROGENBOND_ACCEPTOR, false);
* atom.setFlag(CDKConstants.IS_HYDROGENBOND_DONOR, false);
* atom.setProperty(CDKConstants.CHEMICAL_GROUP_CONSTANT,
* CDKConstants.UNSET); atom.setFlag(CDKConstants.ISAROMATIC,
* false); atom.setProperty("org.openscience.cdk.renderer.color",
* CDKConstants.UNSET); atom.setAtomicNumber((Integer)
* CDKConstants.UNSET); atom.setExactMass((Double)
* CDKConstants.UNSET);
*/
}
// AtomContainerManipulator.clearAtomConfigurations(mol);
// a1.setHybridization((IAtomType.Hybridization)CDKConstants.UNSET);
// a2.setHybridization((IAtomType.Hybridization)CDKConstants.UNSET);
/*
* AtomContainerManipulator.clearAtomConfigurations(mol);
* mol.removeBond(b); IBond b1 = new Bond(a1,a2);
* b1.setOrder(IBond.Order.SINGLE); mol.addBond(b1);
*/
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
System.out.println("after molecule change");
System.out.println(SmartsHelper.getAtomsAttributes(mol));
System.out.println(SmartsHelper.getBondAttributes(mol));
}
use of org.openscience.cdk.AtomContainer in project cdk by cdk.
the class SybylAtomTypeMatcherTest method testAmmonia.
@Test
public void testAmmonia() throws Exception {
IAtomContainer mol = new AtomContainer();
IAtom atom = new Atom("H");
IAtom atom2 = new Atom("N");
IAtom atom3 = new Atom("H");
IAtom atom4 = new Atom("H");
IAtom atom5 = new Atom("H");
mol.addAtom(atom);
mol.addAtom(atom2);
atom2.setFormalCharge(+1);
mol.addAtom(atom3);
mol.addAtom(atom4);
mol.addAtom(atom5);
mol.addBond(0, 1, Order.SINGLE);
mol.addBond(1, 2, Order.SINGLE);
mol.addBond(1, 3, Order.SINGLE);
mol.addBond(1, 4, Order.SINGLE);
String[] expectedTypes = { "H", "N.4", "H", "H", "H" };
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}
use of org.openscience.cdk.AtomContainer in project cdk by cdk.
the class SybylAtomTypeMatcherTest method testThioAmide.
@Test
public void testThioAmide() throws Exception {
IAtomContainer mol = new AtomContainer();
IAtom atom = new Atom("S");
IAtom atom2 = new Atom("C");
IAtom atom3 = new Atom("N");
mol.addAtom(atom);
mol.addAtom(atom2);
mol.addAtom(atom3);
mol.addBond(0, 1, Order.DOUBLE);
mol.addBond(1, 2, Order.SINGLE);
String[] expectedTypes = { "S.2", "C.2", "N.am" };
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}
use of org.openscience.cdk.AtomContainer in project cdk by cdk.
the class SybylAtomTypeMatcherTest method testCarbokation.
@Test
public void testCarbokation() throws Exception {
IAtomContainer mol = new AtomContainer();
IAtom atom = new Atom("H");
IAtom atom2 = new Atom("C");
atom2.setFormalCharge(+1);
IAtom atom3 = new Atom("H");
IAtom atom4 = new Atom("H");
mol.addAtom(atom);
mol.addAtom(atom2);
mol.addAtom(atom3);
mol.addAtom(atom4);
mol.addBond(0, 1, Order.SINGLE);
mol.addBond(1, 2, Order.SINGLE);
mol.addBond(1, 3, Order.SINGLE);
String[] expectedTypes = { "H", "C.cat", "H", "H" };
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}
use of org.openscience.cdk.AtomContainer in project cdk by cdk.
the class SybylAtomTypeMatcherTest method testMnF4.
@Test
public void testMnF4() throws Exception {
IAtomContainer mol = new AtomContainer();
IAtom atom = new Atom("F");
IAtom atom2 = new Atom("Mn");
IAtom atom3 = new Atom("F");
IAtom atom4 = new Atom("F");
IAtom atom5 = new Atom("F");
mol.addAtom(atom);
atom.setFormalCharge(-1);
mol.addAtom(atom2);
atom2.setFormalCharge(+2);
mol.addAtom(atom3);
atom3.setFormalCharge(-1);
mol.addAtom(atom4);
atom4.setFormalCharge(-1);
mol.addAtom(atom5);
atom5.setFormalCharge(-1);
String[] expectedTypes = { "F", "Mn", "F", "F", "F" };
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}
Aggregations