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

📄 forcefieldconfigurator.java

📁 化学图形处理软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		if (ffName.equals("mm2")){			return configureMM2BasedAtom(atom, hoseCode,_boolean);		}else if (ffName.equals("mmff94")){			return configureMMFF94BasedAtom(atom, hoseCode,_boolean);		}		return atom;	}		/**	 *  Configures an atom to a mm2 based atom type	 *	 * @param  atom              atom to be configured	 * @param  hoseCode          the 4 sphere hose code of the atom	 * @return                   atom	 * @exception  CDKException  Description of the Exception	 */	public org.openscience.cdk.interfaces.IAtom configureMM2BasedAtom(org.openscience.cdk.interfaces.IAtom atom, String hoseCode,boolean hetRing) throws Exception {		//logger.debug("CONFIGURE MM2 ATOM");		Vector atomTypePattern = null;		MM2BasedAtomTypePattern atp = new MM2BasedAtomTypePattern();		atomTypePattern = atp.getAtomTypePatterns();		Double d_tmp = null;		Pattern p = null;		String ID = "";		boolean atomTypeFlag = false;				if (atom instanceof IPseudoAtom) {			return atom;		}				hoseCode=removeAromaticityFlagsFromHoseCode(hoseCode);				String [] ids={"C","Csp2","C=","Csp","HC","O","O=","N","Nsp2","Nsp",				"F","CL","BR","I","S","S+",">SN","SO2","SI","LP","HO",				"CR3R","HN","HOCO","P","B","BTET","HN2","C.","C+","GE",				"SN","PB","SE","TE","D","NPYD","CE3R","N+","NPYL","Oar",				"Sthi","N2OX","HS","=N=","NO3","OM","HN+","OR","Car","HE",				"NE","AR","KR","XE","","","","MG","PTET","FE","FE","NI","NI","CO","CO",				"","","OX","OK","C++","N=C","NPD+","N+=","N2OX"		};				for (int j = 0; j < atomTypePattern.size(); j++) {			p = (Pattern) atomTypePattern.elementAt(j);			Matcher mat = p.matcher(hoseCode);			if (mat.matches()) {				ID = ids[j];				//CHECK Rings 1,2,8,9? Thiole 44? AZO 9? Radical - ? Amid 23/enol 21?				if (j == 0) {					//csp3					if (atom.getFlag(CDKConstants.ISINRING)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(3))) {							ID=ids[21];						}else if (atom.getProperty("RING_SIZE").equals(new Integer(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) {							ID=ids[1];						}else if (atom.getFlag(CDKConstants.ISAROMATIC)){							ID=ids[1];						}					}				} else if (j == 1) {					//csp2					if (atom.getFlag(CDKConstants.ISINRING)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(6)) & atom.getFlag(CDKConstants.ISAROMATIC)) {						}else if (atom.getProperty("RING_SIZE").equals(new Integer(3))) {							ID=ids[37];						}else{							ID=ids[1];							}					}					p = (Pattern) atomTypePattern.elementAt(2);					//COOH					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID=ids[2];					}										} else if (j == 5) {					//OH/Ether					if (atom.getFlag(CDKConstants.ISINRING)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(3))) {							ID=ids[48];							//EPOXY						}else if (atom.getProperty("RING_SIZE").equals(new Integer(5)) & atom.getFlag(CDKConstants.ISAROMATIC)){							ID=ids[40];						}else{							ID=ids[5];						}					}				} else if (j == 7) {					//n sp3					if (atom.getFlag(CDKConstants.ISINRING) & atom.getFlag(CDKConstants.ISAROMATIC)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(5))) {							ID=ids[39];						}					}					//Amid					p = (Pattern) atomTypePattern.elementAt(77);					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID=ids[8];					}				} else if (j == 8) {					//nsp2					if (atom.getFlag(CDKConstants.ISINRING)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(6))) {							ID=ids[36];						}					}					p = (Pattern) atomTypePattern.elementAt(36);					//AZO					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID=ids[36];					}										} else if (j == 43) {					//h thiol					d_tmp = (Double) atom.getProperty("MAX_BOND_ORDER");					if (d_tmp.doubleValue() > 1) {						ID=ids[4];					}				} else if (j == 20) {					//h alcohol,ether					p = (Pattern) atomTypePattern.elementAt(76);					//Enol					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID=ids[27];					}					p = (Pattern) atomTypePattern.elementAt(23);					//COOH					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID=ids[23];					}				} else if (j == 22) {					p = (Pattern) atomTypePattern.elementAt(75);					//Amid					mat = p.matcher(hoseCode);					if (mat.matches()) {						ID=ids[27];					}				} 				atomTypeFlag = true;				//logger.debug("Atom Symbol:" + atom.getSymbol() + " MATCH AtomType> " + ID + " HoseCode>" + hoseCode + " ");				break;			}//IF		}//for end		if (atomTypeFlag) {			atomTypeFlag = false;			return setAtom(atom, ID);		} else {			throw new NoSuchAtomTypeException("Atom is unkown: Symbol:" + atom.getSymbol() + " does not MATCH AtomType. HoseCode:" + hoseCode);		}	}		public String removeAromaticityFlagsFromHoseCode(String hoseCode){		String hosecode="";		for (int i=0;i<hoseCode.length();i++){			if (hoseCode.charAt(i)!= '*'){				hosecode=hosecode+hoseCode.charAt(i);			}		}		return hosecode;	}		/**	 *  Configures an atom to a mmff94 based atom type	 *	 * @param  atom              atom to be configured	 * @param  hoseCode          the 4 sphere hose code of the atom	 * @return                   atom	 * @exception  CDKException  Description of the Exception	 */	public org.openscience.cdk.interfaces.IAtom configureMMFF94BasedAtom(org.openscience.cdk.interfaces.IAtom atom, String hoseCode, boolean isInHetRing) throws Exception {		//logger.debug("****** Configure MMFF94 AtomType ******");		Vector atomTypePattern = null;		MMFF94BasedAtomTypePattern atp = new MMFF94BasedAtomTypePattern();		atomTypePattern = atp.getAtomTypePatterns();		Pattern p = null;		Pattern p2 = null;		String ID = "";		boolean atomTypeFlag = false;		Matcher mat=null;		Matcher mat2=null;		hoseCode=removeAromaticityFlagsFromHoseCode(hoseCode);				String [] ids={"C","Csp2","C=","Csp","CO2M","CNN+","C%","CIM+","CR4R",				"CR3R","CE4R","Car","C5A","C5B","C5","HC","HO","HN","HOCO",				"HN=C","HN2","HOCC","HOH","HOS","HN+","HO+","HO=+","HP","O","O=",				"OX","OM","O+","O=+","OH2","Oar","N","N=C","NC=C","NSP","=N=","NAZT",				"N+","N2OX","N3OX","NC#N","NO3","N=O","NC=O","NSO","N+=","NCN+","NGD+","NR%",				"NM","N5M","NPYD","NPYL","NPD+","N5A","N5B","NPOX","N5OX","N5+","N5","S",				"S=C",">SN","SO2","SX","SO2M","=SO","Sthi","PTET","P","-P=C","F","CL","BR",				"I","SI","CL04","FE+2","FE+3","F-","CL-","BR-","LI+","NA+","K+","ZN+2","CA+2","CU+1",				"CU+2","MG+2","Du"		};				if (atom instanceof IPseudoAtom) {			return atom;		}				for (int j = 0; j < atomTypePattern.size(); j++) {			p = (Pattern) atomTypePattern.elementAt(j);			mat = p.matcher(hoseCode);			if (mat.matches()) {				ID = ids[j];				if (j == 0) {//csp3					if (atom.getFlag(CDKConstants.ISINRING)) {						p = (Pattern) atomTypePattern.elementAt(13);//c beta heteroaromatic ring						mat = p.matcher(hoseCode);						p2 = (Pattern) atomTypePattern.elementAt(12);//c alpha heteroaromatic ring						mat2 = p2.matcher(hoseCode);						if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[13];						}else if (mat2.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[12];						}else if (atom.getProperty("RING_SIZE").equals(new Integer(3))& !atom.getFlag(CDKConstants.ISAROMATIC)) {							ID = ids[9];//sp3 3mem rings						}else if (atom.getProperty("RING_SIZE").equals(new Integer(4)) & !atom.getFlag(CDKConstants.ISAROMATIC)) {							ID = ids[8];//sp3 4mem rings						}else if (atom.getFlag(CDKConstants.ISAROMATIC) && isInHetRing && atom.getProperty("RING_SIZE").equals(new Integer(5))) {							ID = ids[14];//C in het 5 ring						}else if (atom.getFlag(CDKConstants.ISAROMATIC)) {							ID = ids[11];//C in benzene, pyroll						}					}else{						p = (Pattern) atomTypePattern.elementAt(66);//S=C						mat = p.matcher(hoseCode);						if (mat.matches()){							ID = ids[66];						}					}				} else if (j == 1) {//csp2					if (atom.getFlag(CDKConstants.ISINRING)) {						if (atom.getProperty("RING_SIZE").equals(new Integer(4)) & !atom.getFlag(CDKConstants.ISAROMATIC) && !isInHetRing) {							ID = ids[29];//C= in 4 ring						}					}									} else if (j == 2) {//csp2 C=Hetatom					if (atom.getFlag(CDKConstants.ISINRING) && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC)) {						ID = ids[12];					}								} else if (j == 36) {//n sp3					//Amid					p = (Pattern) atomTypePattern.elementAt(48);					mat = p.matcher(hoseCode);					if (mat.matches() & !atom.getFlag(CDKConstants.ISINRING)) {						ID = ids[48];					}										p = (Pattern) atomTypePattern.elementAt(44);//sp3 n-oxide					mat = p.matcher(hoseCode);					if (mat.matches()){						ID = ids[44];					}										p = (Pattern) atomTypePattern.elementAt(56);//npyd					mat = p.matcher(hoseCode);										if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc...						if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){						if(atom.getProperty("RING_SIZE").equals(new Integer(6)) && mat.matches()){							ID = ids[56];						}else if(atom.getProperty("RING_SIZE").equals(new Integer(5)) && mat.matches()){							ID = ids[57];						}else{							ID=ids[64];						}					}										p = (Pattern) atomTypePattern.elementAt(61);//npyd					mat = p.matcher(hoseCode);					if (atom.getFlag(CDKConstants.ISAROMATIC)){//id in pyridin, pyrol etc...						if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){						if(atom.getProperty("RING_SIZE").equals(new Integer(6)) && mat.matches()){							ID = ids[61];						}else if(atom.getProperty("RING_SIZE").equals(new Integer(5)) && mat.matches()){							ID = ids[62];						}else{							ID=ids[43];						}					}										p = (Pattern) atomTypePattern.elementAt(45);//NC#N					mat = p.matcher(hoseCode);					if (mat.matches()){						ID = ids[45];					}								}else if (j == 37) {//N=C n in imine					p = (Pattern) atomTypePattern.elementAt(59);//n beta heteroaromatic ring					mat = p.matcher(hoseCode);					if (atom.getFlag(CDKConstants.ISINRING)) {						if (mat.matches() && isInHetRing && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[59];						}else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(6))){							ID = ids[56];						}else if( atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[57];						}					}										p = (Pattern) atomTypePattern.elementAt(43);//N2OX					mat = p.matcher(hoseCode);					if (mat.matches()){						if (atom.getFlag(CDKConstants.ISAROMATIC)&& atom.getProperty("RING_SIZE").equals(new Integer(6))){							ID = ids[61];//npox						}else if (mat.matches() && atom.getFlag(CDKConstants.ISAROMATIC) && atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[62];//n5ox						}else{							ID = ids[43];						}					}								}else if (j==43){//sp2 n oxide					if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(5))){						ID = ids[62];					}else if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(6))){						ID = ids[61];					}				}else if (j==40 || j==41){//n in c=n=n or terminal n in azido					if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(5))){						ID = ids[59];//aromatic N 5R alpha					}				}else if (j==50){//n+= 					if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(5))){						ID = ids[63];//n5+					}else if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(6))){						ID = ids[58];//npd+					}				}else if (j==28){//O ->furan					if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)						&& atom.getProperty("RING_SIZE").equals(new Integer(5))){							ID = ids[35];					}				}else if (j==16){//H-Object-> enol					p = (Pattern) atomTypePattern.elementAt(21);//enol					mat = p.matcher(hoseCode);					if (mat.matches()){						ID = ids[21];					}					p = (Pattern) atomTypePattern.elementAt(18);//enol					mat = p.matcher(hoseCode);					if (mat.matches()){						ID = ids[18];					}									}else if (j==74){//P					p = (Pattern) atomTypePattern.elementAt(75);//-P=C					mat = p.matcher(hoseCode);					if (mat.matches()){						ID = ids[75];					}				}								atomTypeFlag = true;				//logger.debug("Atom Symbol:" + atom.getSymbol() + " MATCH AtomType> " + ID + " HoseCode>" + hoseCode + " ");				break;			}//IF		}//for end		if (atomTypeFlag) {			atomTypeFlag = false;			return setAtom(atom, ID);		} else {			throw new NoSuchAtomTypeException("Atom is unkown: Symbol:" + atom.getSymbol() + " does not MATCH AtomType. HoseCode:" + hoseCode);		}	}}

⌨️ 快捷键说明

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