/** * Adds a reactant to this reaction with a stoichiometry coefficient. * * @param reactant Molecule added as reactant to this reaction * @param coefficient Stoichiometry coefficient for this molecule * @see #getReactants */ @Override public void addReactant(IAtomContainer reactant, Double coefficient) { reactants.addAtomContainer(reactant, coefficient); }
/** * Adds an agent to this reaction. * * @param agent Molecule added as agent to this reaction * @see #getAgents */ @Override public void addAgent(IAtomContainer agent) { agents.addAtomContainer(agent); }
/** * Adds an agent to this reaction. * * @param agent Molecule added as agent to this reaction * @see #getAgents */ @Override public void addAgent(IAtomContainer agent) { agents.addAtomContainer(agent); notifyChanged(); }
/** * Adds a reactant to this reaction with a stoichiometry coefficient. * * @param reactant Molecule added as reactant to this reaction * @param coefficient Stoichiometry coefficient for this molecule * @see #getReactants */ @Override public void addReactant(IAtomContainer reactant, Double coefficient) { reactants.addAtomContainer(reactant, coefficient); notifyChanged(); }
/** * Adds a reactant to this reaction with a stoichiometry coefficient. * * @param reactant Molecule added as reactant to this reaction * @param coefficient Stoichiometry coefficient for this molecule * @see #getReactants */ @Override public void addReactant(IAtomContainer reactant, Double coefficient) { reactants.addAtomContainer(reactant, coefficient); notifyChanged(); }
/** * Get the expected set of molecules. * TODO:reaction. Set the products * * @return The IAtomContainerSet */ private IAtomContainerSet getExpectedProducts() { IAtomContainerSet setOfProducts = builder.newInstance(IAtomContainerSet.class); setOfProducts.addAtomContainer(null); return setOfProducts; } }
/** * Get the expected set of molecules. * TODO:reaction. Set the products * * @return The IAtomContainerSet */ private IAtomContainerSet getExpectedProducts() { IAtomContainerSet setOfProducts = builder.newInstance(IAtomContainerSet.class); setOfProducts.addAtomContainer(null); return setOfProducts; } }
private IChemModel readChemModel(IChemModel chemModel) throws CDKException { IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet(); if (setOfMolecules == null) { setOfMolecules = chemModel.getBuilder().newInstance(IAtomContainerSet.class); } IAtomContainer m = readMolecule(chemModel.getBuilder().newInstance(IAtomContainer.class)); if (m != null) { setOfMolecules.addAtomContainer(m); } chemModel.setMoleculeSet(setOfMolecules); return chemModel; }
private IChemModel readChemModel(IChemModel chemModel) throws CDKException { IAtomContainerSet setOfMolecules = chemModel.getMoleculeSet(); if (setOfMolecules == null) { setOfMolecules = chemModel.getBuilder().newInstance(IAtomContainerSet.class); } IAtomContainer m = readMolecule(chemModel.getBuilder().newInstance(IAtomContainer.class)); if (m != null) { setOfMolecules.addAtomContainer(m); } chemModel.setMoleculeSet(setOfMolecules); return chemModel; }
@Test public void testGetAtomContainer_int() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); Assert.assertNotNull(som.getAtomContainer(2)); // third molecule should exist Assert.assertNull(som.getAtomContainer(3)); // fourth molecule must not exist }
public void undo() { if(chemModel.getMoleculeSet()==null) chemModel.setMoleculeSet(chemModel.getBuilder().newInstance(IAtomContainerSet.class)); chemModel.getMoleculeSet().addAtomContainer(oldContainer); chemModel.getReactionSet().removeReaction(ReactionSetManipulator.getReactionByAtomContainerID(chemModel.getReactionSet(), movedContainer.getID())); }
@Test public void testPartialFilledStructureMerger4() throws Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainerSet acs = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); acs.addAtomContainer(sp.parseSmiles("[C]CCC[CH2]")); acs.addAtomContainer(sp.parseSmiles("[C]CC[CH2]")); acs.addAtomContainer(sp.parseSmiles("[CH2]")); PartialFilledStructureMerger pfsm = new PartialFilledStructureMerger(); IAtomContainer result = pfsm.generate(acs); Assert.assertTrue(ConnectivityChecker.isConnected(result)); Assert.assertTrue(new SaturationChecker().allSaturated(result)); }
@Test public void testPartialFilledStructureMerger3() throws Exception { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainerSet acs = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); acs.addAtomContainer(sp.parseSmiles("[CH2]CCC[CH2]")); acs.addAtomContainer(sp.parseSmiles("[CH2]C[CH2]")); acs.addAtomContainer(sp.parseSmiles("[CH2][CH2]")); PartialFilledStructureMerger pfsm = new PartialFilledStructureMerger(); IAtomContainer result = pfsm.generate(acs); Assert.assertTrue(ConnectivityChecker.isConnected(result)); Assert.assertTrue(new SaturationChecker().allSaturated(result)); }
@Test public void testRemoveAtomContainer_IAtomContainer() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); IAtomContainer ac1 = som.getBuilder().newInstance(IAtomContainer.class); IAtomContainer ac2 = som.getBuilder().newInstance(IAtomContainer.class); som.addAtomContainer(ac1); som.addAtomContainer(ac2); som.removeAtomContainer(ac1); Assert.assertEquals(1, som.getAtomContainerCount()); Assert.assertEquals(ac2, som.getAtomContainer(0)); }
@Test public void testGetAtomContainers() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); Assert.assertEquals(0, som.getAtomContainerCount()); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); Assert.assertEquals(3, som.getAtomContainerCount()); Assert.assertNotNull(som.getAtomContainer(0)); Assert.assertNotNull(som.getAtomContainer(1)); Assert.assertNotNull(som.getAtomContainer(2)); }
@Test public void testGetMultiplier_int() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); Assert.assertEquals(1.0, som.getMultiplier(0), 0.00001); }
/** * Test if we get the expected {@link IllegalArgumentException} when we pass * an {@link IAtomContainer} without 2D coordinates. */ @Test(expected = IllegalArgumentException.class) public void testCalculateBounds_IAtomContainerSet_SingleAtom() { IAtomContainer container = new AtomContainer(); container.addAtom(container.getBuilder().newInstance(IAtom.class, "C")); IAtomContainerSet set = container.getBuilder().newInstance(IAtomContainerSet.class); set.addAtomContainer(container); BoundsCalculator.calculateBounds(set); }
@Test public void testSetMultiplier_int_Double() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); Assert.assertEquals(1.0, som.getMultiplier(0), 0.00001); som.setMultiplier(0, 2.0); Assert.assertEquals(2.0, som.getMultiplier(0), 0.00001); }
@Test public void testSetMultiplier_IAtomContainer_Double() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); IAtomContainer container = som.getBuilder().newInstance(IAtomContainer.class); som.addAtomContainer(container); Assert.assertEquals(1.0, som.getMultiplier(container), 0.00001); som.setMultiplier(container, 2.0); Assert.assertEquals(2.0, som.getMultiplier(container), 0.00001); }
@Test public void testCloneDuplication() throws Exception { IAtomContainerSet containerSet = (IAtomContainerSet) newChemObject(); containerSet.addAtomContainer(containerSet.getBuilder().newInstance(IAtomContainer.class)); Object clone = containerSet.clone(); Assert.assertTrue(clone instanceof IAtomContainerSet); IAtomContainerSet clonedSet = (IAtomContainerSet) clone; Assert.assertNotSame(containerSet, clonedSet); Assert.assertEquals(containerSet.getAtomContainerCount(), clonedSet.getAtomContainerCount()); }