亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? deducebondsystemtool.java

?? 化學圖形處理軟件
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*  $RCSfile: $
 *  $Author: egonw $
 *  $Date: 2006-04-20 17:59:04 -0400 (Thu, 20 Apr 2006) $
 *  $Revision: 6064 $
 *
 *  Copyright (C) 2002-2007  The Chemistry Development Kit (CDK) project
 *
 *  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.
 *  All I ask is that proper credit is given for my work, which includes
 *  - but is not limited to - adding the above copyright notice to the beginning
 *  of your source code files, and to any copyright notice that you may distribute
 *  with programs based on this work.
 *
 *  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.smiles;

import java.util.ArrayList;
import java.util.List;

import org.openscience.cdk.Atom;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.Ring;
import org.openscience.cdk.RingSet;
import org.openscience.cdk.aromaticity.HueckelAromaticityDetector;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IRing;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.ringsearch.AllRingsFinder;
import org.openscience.cdk.ringsearch.SSSRFinder;
import org.openscience.cdk.tools.HydrogenAdder;
import org.openscience.cdk.tools.IValencyChecker;
import org.openscience.cdk.tools.LoggingTool;
import org.openscience.cdk.tools.SmilesValencyChecker;
/**
 * Tool that tries to deduce bond orders based on connectivity and hybridization
 * for a number of common ring systems.
 *
 * @author Todd Martin
 * @cdk.module smiles
 * @cdk.keyword bond order
 */
public class DeduceBondSystemTool {

	private AllRingsFinder allRingsFinder;
    private LoggingTool logger;
    private HydrogenAdder hAdder;
    private IValencyChecker valencyChecker;
	
    private List listOfRings = null;
    
	private int counter = 0;
	private boolean interrupted;

    /**
     * Constructor for the DeduceBondSystemTool object.
     */
    public DeduceBondSystemTool() {
    	allRingsFinder = new AllRingsFinder();
        logger = new LoggingTool(this);
        valencyChecker = new SmilesValencyChecker();
        hAdder = new HydrogenAdder();
    }

    public boolean isOK(IMolecule m) throws CDKException {
    	IRingSet rs = allRingsFinder.findAllRings(m);
    	storeRingSystem(m, rs);
    	boolean StructureOK=this.isStructureOK(m);
    	IRingSet irs=this.removeExtraRings(m);
    	
    	if (irs==null) throw new CDKException("error in AllRingsFinder.findAllRings");
    	
    	int count=this.getBadCount(m,irs);

    	if (StructureOK && count==0) {
    		return true;
    	} else {
    		return false;
    	}
    }

    public IMolecule fixAromaticBondOrders(IMolecule molecule) throws CDKException {
        //logger.debug("here");
    	
    	IRingSet rs = allRingsFinder.findAllRings(molecule);
    	storeRingSystem(molecule, rs);
    	
        IRingSet ringSet = null;

        // TODO remove rings with nonsp2 carbons(?) and rings larger than 7 atoms
        ringSet = removeExtraRings(molecule);
        
        if (ringSet==null) throw new CDKException("failure in AllRingsFinder.findAllRings");
        
        ArrayList MasterList = new ArrayList();

        //this.counter=0;// counter which keeps track of all current possibilities for placing double bonds
        
        this.FixPyridineNOxides(molecule,ringSet);
        

        for (int i = 0; i <= ringSet.getAtomContainerCount() - 1; i++) {

            IRing ring = (IRing) ringSet.getAtomContainer(i);

            if (ring.getAtomCount() == 5) {
                fiveMemberedRingPossibilities(molecule, ring, MasterList);
            } else if (ring.getAtomCount() == 6) {
                sixMemberedRingPossibilities(molecule, ring, MasterList);
            } else if (ring.getAtomCount() == 7){
                sevenMemberedRingPossibilities(molecule, ring, MasterList);
                //TODO- add code for all 7 membered aromatic ring possibilities not just 3 bonds
            } else {
            	//TODO: what about other rings systems?
            	logger.debug("Found ring of size: " + ring.getAtomCount());
            }
        }

        IMoleculeSet som = molecule.getBuilder().newMoleculeSet();

//		int number=1; // total number of possibilities
//		
//		for (int ii=0;ii<=MasterList.size()-1;ii++) {
//		ArrayList ringlist=(ArrayList)MasterList.get(ii);
//		number*=ringlist.size();
//		}
//		logger.debug("number= "+number);			


        int [] choices = null;

        //if (number> 1000000) return null;

        choices = new int [MasterList.size()];

        if (MasterList.size() > 0) {
            IMolecule iMolecule = loop(System.currentTimeMillis(), molecule, 0, MasterList, choices, som);
            if (iMolecule instanceof IMolecule) return iMolecule;
        }


        int mincount = 99999999;

        int best = -1; // one with minimum number of bad atoms

        // minimize number of potentially bad nitrogens among molecules in the set

        for (int i = 0; i <= som.getAtomContainerCount() - 1; i++) {

            IMolecule mol = som.getMolecule(i);

            ringSet = removeExtraRings(mol);
            
            if (ringSet==null) continue;
            
            int count = getBadCount(mol, ringSet);

            //logger.debug(i + "\t" + count);

            if (count < mincount) {
                mincount = count;
                best = i;
            }
            
        }

        if (som.getAtomContainerCount() > 0) return som.getMolecule(best);
        return molecule;
    }

    private void FixPyridineNOxides(IMolecule molecule,IRingSet ringSet) {
    	
    	//convert n(=O) to [n+][O-]
    	
    	for (int i=0;i<molecule.getAtomCount();i++) {
    		IAtom ai=molecule.getAtom(i);
    		
    		if (ai.getSymbol().equals("N") && ai.getFormalCharge()==0) {
    			if (inRingSet(ai,ringSet)) {
    				List ca=molecule.getConnectedAtomsList(ai);
    				for (int j=0;j<ca.size();j++){
    					IAtom caj=(IAtom)ca.get(j);
    					
    					if (caj.getSymbol().equals("O") && molecule.getBond(ai,caj).getOrder()==2) {
    						ai.setFormalCharge(1);
    						caj.setFormalCharge(-1);
    						molecule.getBond(ai,caj).setOrder(1);
    					}
    				}// end for (int j=0;j<ca.size();j++)
    				
    			} // end if (inRingSet(ai,ringSet)) {
    		} // end if (ai.getSymbol().equals("N") && ai.getFormalCharge()==0)
    		
    	} // end for (int i=0;i<molecule.getAtomCount();i++)
    	
	
	
    }
    private void applyBonds(IMolecule m, ArrayList al) {

        //logger.debug("");

        for (int i = 0; i <= al.size() - 1; i++) {

            String s = (String) al.get(i);
            String s1 = s.substring(0, s.indexOf("-"));
            String s2 = s.substring(s.indexOf("-") + 1, s.length());

            int i1 = Integer.parseInt(s1);
            int i2 = Integer.parseInt(s2);

            //logger.debug(s1+"\t"+s2);

            IBond b = m.getBond(m.getAtom(i1), m.getAtom(i2));
            b.setOrder(2);


        }

    }

    private void fiveMemberedRingPossibilities(IMolecule m, IRing r, ArrayList MasterList) {
        // 5 possibilities for placing 2 double bonds
        // 5 possibilities for placing 1 double bond

        int [] num = new int [5]; // stores atom numbers based on atom numbers in molecule instead of ring

        for (int j = 0; j <= 4; j++) {
            num[j] = m.getAtomNumber(r.getAtom(j));
            //logger.debug(num[j]);
        }

        java.util.ArrayList al1 = new java.util.ArrayList();
        java.util.ArrayList al2 = new java.util.ArrayList();
        java.util.ArrayList al3 = new java.util.ArrayList();
        java.util.ArrayList al4 = new java.util.ArrayList();
        java.util.ArrayList al5 = new java.util.ArrayList();

        java.util.ArrayList al6 = new java.util.ArrayList();
        java.util.ArrayList al7 = new java.util.ArrayList();
        java.util.ArrayList al8 = new java.util.ArrayList();
        java.util.ArrayList al9 = new java.util.ArrayList();
        java.util.ArrayList al10 = new java.util.ArrayList();

        al1.add(num[1] + "-" + num[2]);
        al1.add(num[3] + "-" + num[4]);

        al2.add(num[2] + "-" + num[3]);
        al2.add(num[0] + "-" + num[4]);

        al3.add(num[0] + "-" + num[1]);
        al3.add(num[3] + "-" + num[4]);

        al4.add(num[0] + "-" + num[4]);
        al4.add(num[1] + "-" + num[2]);

        al5.add(num[0] + "-" + num[1]);
        al5.add(num[2] + "-" + num[3]);

        al6.add(num[0] + "-" + num[1]);
        al7.add(num[1] + "-" + num[2]);
        al8.add(num[2] + "-" + num[3]);
        al9.add(num[3] + "-" + num[4]);
        al10.add(num[4] + "-" + num[0]);

        ArrayList mal = new ArrayList();

        mal.add(al1);
        mal.add(al2);
        mal.add(al3);
        mal.add(al4);
        mal.add(al5);

        mal.add(al6);
        mal.add(al7);
        mal.add(al8);
        mal.add(al9);
        mal.add(al10);

//		mal.add(al11);

        MasterList.add(mal);

    }

    private void sixMemberedRingPossibilities(IMolecule m, IRing r, ArrayList MasterList) {
        // 2 possibilities for placing 3 double bonds
        // 6 possibilities for placing 2 double bonds
        // 6 possibilities for placing 1 double bonds

        IAtom [] ringatoms = new Atom [6];

        ringatoms[0] = r.getAtom(0);

        int [] num = new int [6];

        for (int j = 0; j <= 5; j++) {
            num[j] = m.getAtomNumber(r.getAtom(j));
        }

        java.util.ArrayList al1 = new java.util.ArrayList();
        java.util.ArrayList al2 = new java.util.ArrayList();

        al1.add(num[0] + "-" + num[1]);
        al1.add(num[2] + "-" + num[3]);
        al1.add(num[4] + "-" + num[5]);

        al2.add(num[1] + "-" + num[2]);
        al2.add(num[3] + "-" + num[4]);
        al2.add(num[5] + "-" + num[0]);

        java.util.ArrayList al3 = new java.util.ArrayList();
        java.util.ArrayList al4 = new java.util.ArrayList();
        java.util.ArrayList al5 = new java.util.ArrayList();
        java.util.ArrayList al6 = new java.util.ArrayList();
        java.util.ArrayList al7 = new java.util.ArrayList();
        java.util.ArrayList al8 = new java.util.ArrayList();
        java.util.ArrayList al9 = new java.util.ArrayList();
        java.util.ArrayList al10 = new java.util.ArrayList();
        java.util.ArrayList al11 = new java.util.ArrayList();

        java.util.ArrayList al12 = new java.util.ArrayList();
        java.util.ArrayList al13 = new java.util.ArrayList();
        java.util.ArrayList al14 = new java.util.ArrayList();
        java.util.ArrayList al15 = new java.util.ArrayList();
        java.util.ArrayList al16 = new java.util.ArrayList();
        java.util.ArrayList al17 = new java.util.ArrayList();

        java.util.ArrayList al18 = new java.util.ArrayList();


        al3.add(num[0] + "-" + num[1]);
        al3.add(num[2] + "-" + num[3]);

        al4.add(num[0] + "-" + num[1]);
        al4.add(num[4] + "-" + num[5]);

        al5.add(num[1] + "-" + num[2]);
        al5.add(num[3] + "-" + num[4]);

        al6.add(num[1] + "-" + num[2]);
        al6.add(num[0] + "-" + num[5]);

        al7.add(num[2] + "-" + num[3]);
        al7.add(num[4] + "-" + num[5]);

        al8.add(num[0] + "-" + num[5]);
        al8.add(num[3] + "-" + num[4]);

        al9.add(num[0] + "-" + num[1]);
        al9.add(num[3] + "-" + num[4]);

        al10.add(num[1] + "-" + num[2]);
        al10.add(num[4] + "-" + num[5]);

        al11.add(num[2] + "-" + num[3]);
        al11.add(num[0] + "-" + num[5]);

        al12.add(num[0] + "-" + num[1]);
        al13.add(num[1] + "-" + num[2]);
        al14.add(num[2] + "-" + num[3]);
        al15.add(num[3] + "-" + num[4]);
        al16.add(num[4] + "-" + num[5]);
        al17.add(num[5] + "-" + num[0]);

        ArrayList mal = new ArrayList();

        mal.add(al1);
        mal.add(al2);

        mal.add(al3);
        mal.add(al4);
        mal.add(al5);
        mal.add(al6);
        mal.add(al7);
        mal.add(al8);
        mal.add(al9);
        mal.add(al10);
        mal.add(al11);

        mal.add(al12);
        mal.add(al13);
        mal.add(al14);
        mal.add(al15);
        mal.add(al16);
        mal.add(al17);
        mal.add(al18);

        MasterList.add(mal);


    }

    private void sevenMemberedRingPossibilities(IMolecule m, IRing r, ArrayList MasterList) {
        // for now only consider case where have 3 double bonds

        IAtom[] ringatoms = new Atom[7];

        ringatoms[0] = r.getAtom(0);

        int[] num = new int[7];

        for (int j = 0; j <= 6; j++) {
            num[j] = m.getAtomNumber(r.getAtom(j));
        }

        java.util.ArrayList al1 = new java.util.ArrayList();
        java.util.ArrayList al2 = new java.util.ArrayList();
        java.util.ArrayList al3 = new java.util.ArrayList();
        java.util.ArrayList al4 = new java.util.ArrayList();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
夜夜精品浪潮av一区二区三区| 亚洲bdsm女犯bdsm网站| 欧美mv日韩mv| 欧美日韩精品电影| 欧美国产精品中文字幕| 一区二区免费看| 亚洲福利一二三区| 日本欧美久久久久免费播放网| 欧美欧美欧美欧美首页| 三级不卡在线观看| 日韩欧美国产三级| 国产精品一区三区| 中文字幕一区二区视频| 欧美在线观看18| 日本不卡视频在线| 久久久无码精品亚洲日韩按摩| 成人激情黄色小说| 亚洲欧美日韩综合aⅴ视频| 欧洲一区二区三区在线| 男男视频亚洲欧美| 日本一二三不卡| 亚洲激情第一区| 日韩女优电影在线观看| 国产在线视频一区二区三区| 亚洲色图欧洲色图婷婷| 欧美性受xxxx黑人xyx性爽| 日本美女视频一区二区| 国产亚洲欧美日韩俺去了| 91婷婷韩国欧美一区二区| 五月综合激情网| 中文字幕av一区二区三区免费看| 欧美亚洲综合在线| 国产盗摄视频一区二区三区| 一区二区国产视频| www久久久久| 欧美日韩五月天| 国产成人av电影| 日韩在线a电影| 亚洲欧洲日韩女同| 日韩小视频在线观看专区| 99热国产精品| 久久成人综合网| 亚洲一区二区欧美激情| 国产拍欧美日韩视频二区| 91.com在线观看| 色综合欧美在线视频区| 国产呦萝稀缺另类资源| 亚洲成人综合网站| 成人欧美一区二区三区在线播放| 日韩色视频在线观看| 91精品1区2区| 成人h动漫精品一区二| 精一区二区三区| 石原莉奈在线亚洲三区| 亚洲欧洲精品成人久久奇米网| 26uuu精品一区二区在线观看| 欧美偷拍一区二区| 色综合天天做天天爱| 丁香激情综合国产| 国产一区二区在线电影| 日韩av不卡在线观看| 亚洲一二三专区| 一区二区三区日本| 亚洲人妖av一区二区| 欧美高清在线精品一区| 久久先锋资源网| 精品少妇一区二区三区在线播放 | 老司机精品视频线观看86| 亚洲乱码精品一二三四区日韩在线 | 国产精品三级电影| 精品欧美黑人一区二区三区| 日韩亚洲欧美高清| 欧美一区二区性放荡片| 69堂精品视频| 91麻豆精品国产91久久久使用方法 | 欧美日韩中文字幕一区| 91麻豆swag| 91高清视频在线| 欧美日韩在线综合| 欧美调教femdomvk| 欧美三日本三级三级在线播放| 欧美视频日韩视频| 欧美日韩午夜影院| 欧美一二三区在线观看| 欧美一区二区私人影院日本| 日韩精品中文字幕一区二区三区 | 欧美大胆一级视频| 精品国精品国产尤物美女| 日韩精品一区二区三区在线| 精品国产凹凸成av人网站| 欧美不卡在线视频| 久久久久久久综合色一本| 久久久av毛片精品| 中文字幕欧美激情| 综合久久给合久久狠狠狠97色| 亚洲三级免费电影| 亚洲在线一区二区三区| 丝袜美腿成人在线| 久久国产精品99久久久久久老狼| 国产一区二区三区av电影| 福利视频网站一区二区三区| 色综合久久久久综合| 精品视频1区2区| www欧美成人18+| 亚洲欧洲精品一区二区精品久久久| 亚洲一区精品在线| 丝袜亚洲另类欧美| 狠狠色丁香婷综合久久| 9色porny自拍视频一区二区| 欧美日韩免费在线视频| 欧美不卡一区二区三区四区| 国产精品久久久久国产精品日日| 亚洲一区在线看| 国产在线一区观看| 91麻豆文化传媒在线观看| 9191久久久久久久久久久| 国产日韩欧美高清| 亚洲一卡二卡三卡四卡五卡| 韩国一区二区三区| 在线视频一区二区三| 精品91自产拍在线观看一区| 亚洲摸摸操操av| 狠狠狠色丁香婷婷综合激情| 欧美日韩一区二区电影| 久久久久亚洲综合| 亚洲国产成人av网| 懂色一区二区三区免费观看| 91麻豆精品91久久久久同性| 国产精品久久久久久久第一福利| 美女性感视频久久| 色综合久久久久综合99| 国产亚洲综合在线| 日韩国产欧美在线播放| 99久久99久久精品免费观看| 欧美不卡一区二区三区| 亚洲国产sm捆绑调教视频| 丁香天五香天堂综合| 欧美一卡二卡三卡| 一区二区三区四区不卡视频| 不卡在线观看av| 久久影院午夜论| 日本欧美一区二区| 欧美三级在线看| 亚洲乱码一区二区三区在线观看| 国产精品亚洲一区二区三区在线 | 激情综合色综合久久| 欧美无砖砖区免费| 亚洲欧美电影一区二区| 国产a区久久久| xvideos.蜜桃一区二区| 蜜臀va亚洲va欧美va天堂| 国产精品毛片a∨一区二区三区| 久久电影网电视剧免费观看| 在线播放91灌醉迷j高跟美女| 亚洲综合色丁香婷婷六月图片| 99综合影院在线| 国产日本欧美一区二区| 国内精品视频666| 日韩三级免费观看| 日韩影视精彩在线| 欧美日韩一区二区三区四区五区| 亚洲午夜久久久久久久久电影网 | 一区二区三区欧美日| 99久久精品一区二区| 亚洲国产精品传媒在线观看| 国产精品一区二区男女羞羞无遮挡 | 欧美日韩大陆一区二区| 亚洲一区日韩精品中文字幕| 欧美色窝79yyyycom| 亚洲一区二区在线播放相泽| 欧美日韩一区不卡| 午夜精品福利一区二区蜜股av| 欧美影视一区在线| 亚洲午夜激情网页| 555夜色666亚洲国产免| 日韩国产成人精品| 91精品国产综合久久精品app| 无吗不卡中文字幕| 日韩视频中午一区| 激情五月婷婷综合网| 久久免费视频色| 成人精品免费看| 国产精品亚洲人在线观看| 久久久影视传媒| 99re免费视频精品全部| 亚洲精品午夜久久久| 欧美日本韩国一区二区三区视频 | 亚洲欧美日韩综合aⅴ视频| 在线观看国产日韩| 五月天一区二区三区| 欧美电影免费观看高清完整版在| 国内精品第一页| 亚洲欧洲韩国日本视频| 欧美日韩国产经典色站一区二区三区 | 96av麻豆蜜桃一区二区| 亚洲高清免费视频| 久久蜜桃av一区二区天堂| av亚洲精华国产精华精| 午夜精品久久久久久不卡8050| 精品处破学生在线二十三|