⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 carbonyleliminationreactiontest.java

📁 化学图形处理软件
💻 JAVA
字号:
/* $RCSfile$ * $Author: miguelrojasch $ * $Date: 2006-05-11 14:25:07 +0200 (Do, 11 Mai 2006) $ * $Revision: 6221 $ * *  Copyright (C) 2004-2007  Miguel Rojas <miguel.rojas@uni-koeln.de> *  * Contact: cdk-devel@lists.sourceforge.net *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser General Public License for more details. *  * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */package org.openscience.cdk.test.reaction.type;import junit.framework.Assert;import junit.framework.Test;import junit.framework.TestSuite;import org.openscience.cdk.DefaultChemObjectBuilder;import org.openscience.cdk.exception.CDKException;import org.openscience.cdk.interfaces.IAtom;import org.openscience.cdk.interfaces.IMolecule;import org.openscience.cdk.interfaces.IMoleculeSet;import org.openscience.cdk.interfaces.IReactionSet;import org.openscience.cdk.isomorphism.UniversalIsomorphismTester;import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer;import org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator;import org.openscience.cdk.reaction.IReactionProcess;import org.openscience.cdk.reaction.type.CarbonylEliminationReaction;import org.openscience.cdk.smiles.SmilesParser;import org.openscience.cdk.test.CDKTestCase;import org.openscience.cdk.tools.manipulator.ReactionManipulator;/** * TestSuite that runs a test for the CarbonylEliminationReactionTest. * Generalized Reaction: RC-C#[O+] => R[C] + |C#[O+] * * @cdk.module test-reaction */public class CarbonylEliminationReactionTest extends CDKTestCase {		private IReactionProcess type;	/**	 * Constructror of the CarbonylEliminationReactionTest object	 *	 */	public  CarbonylEliminationReactionTest() {		type  = new CarbonylEliminationReaction();	}    	public static Test suite() {		return new TestSuite(CarbonylEliminationReactionTest.class);	}	/**	 * A unit test suite for JUnit. Reaction: C-C#[O+] => [C+] + [|C-]#[O+]	 * Automatic sarch of the centre active.	 *	 * @return    The test suite	 */	public void testAutomaticSearchCentreActiveExample1() throws ClassNotFoundException, CDKException, java.lang.Exception {        		/*[C*]-C-C*/		IMolecule molecule = (new SmilesParser(org.openscience.cdk.DefaultChemObjectBuilder.getInstance())).parseSmiles("C-C#[O+]");       		IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet();		setOfReactants.addMolecule(molecule);		        Object[] params = {Boolean.FALSE};        type.setParameters(params);        IReactionSet setOfReactions = type.initiate(setOfReactants, null);                Assert.assertEquals(1, setOfReactions.getReactionCount());        Assert.assertEquals(2, setOfReactions.getReaction(0).getProductCount());                IMolecule product1 = setOfReactions.getReaction(0).getProducts().getMolecule(0);		        /*C=C*/        IMolecule molecule2 = (new SmilesParser(org.openscience.cdk.DefaultChemObjectBuilder.getInstance())).parseSmiles("[C+]");        QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(product1);		Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(molecule2,qAC));				IMolecule product2 = setOfReactions.getReaction(0).getProducts().getMolecule(1);		        /*[C*]*/		molecule2 = (new SmilesParser(org.openscience.cdk.DefaultChemObjectBuilder.getInstance())).parseSmiles("[C-]#[O+]");        		        qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(product2);		Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(molecule2,qAC));		Assert.assertEquals(4,setOfReactions.getReaction(0).getMappingCount());		IAtom mappedProductA1 = (IAtom)ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(0));		assertEquals(mappedProductA1, product1.getAtom(0));        IAtom mappedProductA2 = (IAtom)ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(1));        assertEquals(mappedProductA2, product2.getAtom(0));        IAtom mappedProductA3 = (IAtom)ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(2));        assertEquals(mappedProductA3, product2.getAtom(1));       	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -