/** * Method which assigns van der Waals radii to the biopolymer * default org/openscience/cdk/config/data/pdb_atomtypes.xml * stored in the variable String vanDerWaalsFile. */ public void assignVdWRadiiToProtein() { AtomTypeFactory atf = null; IAtom[] atoms = AtomContainerManipulator.getAtomArray(protein); try { atf = AtomTypeFactory.getInstance(vanDerWaalsFile, atoms[0].getBuilder()); } catch (Exception ex1) { System.out.println("Problem with AtomTypeFactory due to:" + ex1.toString()); } for (int i = 0; i < atoms.length; i++) { try { atf.configure(atoms[i]); } catch (Exception ex2) { logger.error("Problem with atf.configure due to:" + ex2.toString()); } } }
if (cdkType != null) { try { cdkAtomTypeFactory.configure(oAtom); } catch (CDKException cdke) { logger.warn("Could not configure", resName, " ", atomName);
if (cdkType != null) { try { cdkAtomTypeFactory.configure(oAtom); } catch (CDKException cdke) { logger.warn("Could not configure", resName, " ", atomName);
/** * Make sure the the rebonding is working. */ @Test public void testCloseEnoughToBond_IAtom_IAtom_double() throws Exception { String filename = "data/xyz/viagra.xyz"; InputStream ins = this.getClass().getClassLoader().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); Iterator<IAtom> atoms = mol.atoms().iterator(); while (atoms.hasNext()) { atf.configure(atoms.next()); } Assert.assertTrue(BondTools.closeEnoughToBond(mol.getAtom(0), mol.getAtom(1), 1)); Assert.assertFalse(BondTools.closeEnoughToBond(mol.getAtom(0), mol.getAtom(8), 1)); }
@Test public void testConfigure_IAtom() throws Exception { IAtomType atomType; IAtom atom = new org.openscience.cdk.Atom(); atom.setAtomTypeName("C.ar"); AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/mol2_atomtypes.xml", new ChemObject().getBuilder()); atomType = factory.configure(atom); Assert.assertNotNull(atomType); Assert.assertEquals("C", atom.getSymbol()); }
@Test public void testRebond_IAtomContainer() throws Exception { RebondTool rebonder = new RebondTool(2.0, 0.5, 0.5); IAtomContainer methane = new AtomContainer(); methane.addAtom(new Atom("C", new Point3d(0.0, 0.0, 0.0))); methane.addAtom(new Atom("H", new Point3d(0.6, 0.6, 0.6))); methane.addAtom(new Atom("H", new Point3d(-0.6, -0.6, 0.6))); methane.addAtom(new Atom("H", new Point3d(0.6, -0.6, -0.6))); methane.addAtom(new Atom("H", new Point3d(-0.6, 0.6, -0.6))); // configure atoms AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", methane.getBuilder()); //org.openscience.cdk.interfaces.IAtom[] atoms = methane.getAtoms(); for (int i = 0; i < methane.getAtomCount(); i++) { factory.configure(methane.getAtom(i)); } // rebond rebonder.rebond(methane); Assert.assertEquals(5, methane.getAtomCount()); Assert.assertEquals(4, methane.getBondCount()); } }