📄 mmff94atomtypematchertest.java
字号:
haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"C","N","HC","HC","HC","HN","HN"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); } /** * A unit test for JUnit with ethoxyethane */ public void testFindMatchingAtomType_IAtomContainer_IAtom_Ethoxyethane() throws ClassNotFoundException, CDKException, java.lang.Exception { //System.out.println("**** START ATOMTYPE Ethoxyethane TEST ******"); IMolecule mol = builder.newMolecule(); IAtom carbon = builder.newAtom(Elements.CARBON); IAtom oxygen = builder.newAtom(Elements.OXYGEN); IAtom carbon2 = builder.newAtom(Elements.CARBON); // making sure the order matches the test results mol.addAtom(carbon); mol.addAtom(oxygen); mol.addAtom(carbon2); mol.addBond(builder.newBond(carbon, oxygen, CDKConstants.BONDORDER_SINGLE)); mol.addBond(builder.newBond(carbon2, oxygen, CDKConstants.BONDORDER_SINGLE)); haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"C","O","C","HC","HC","HC","HC","HC","HC"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); } /** * A unit test for JUnit with Methanethiol */ public void testFindMatchingAtomType_IAtomContainer_IAtom_Methanethiol() throws ClassNotFoundException, CDKException, java.lang.Exception { //System.out.println("**** START ATOMTYPE Methanethiol TEST ******"); IMolecule mol = builder.newMolecule(); IAtom carbon = builder.newAtom(Elements.CARBON); IAtom sulfur = builder.newAtom(Elements.SULFUR); // making sure the order matches the test results mol.addAtom(carbon); mol.addAtom(sulfur); mol.addBond(builder.newBond(carbon, sulfur, CDKConstants.BONDORDER_SINGLE)); haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"C","S","HC","HC","HC","HP"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); } /** * A unit test for JUnit with Chloromethane */ public void testFindMatchingAtomType_IAtomContainer_IAtom_Chloromethane() throws ClassNotFoundException, CDKException, java.lang.Exception { //System.out.println("**** START ATOMTYPE Chlormethane TEST ******"); IMolecule mol = builder.newMolecule(); IAtom carbon = builder.newAtom(Elements.CARBON); IAtom chlorine = builder.newAtom(Elements.CHLORINE); // making sure the order matches the test results mol.addAtom(carbon); mol.addAtom(chlorine); mol.addBond(builder.newBond(carbon, chlorine, CDKConstants.BONDORDER_SINGLE)); haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"C","CL","HC","HC","HC"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); } /** * A unit test for JUnit with Benzene */ public void testFindMatchingAtomType_IAtomContainer_IAtom_Benzene() throws ClassNotFoundException, CDKException, java.lang.Exception { //System.out.println("**** START ATOMTYPE Benzene TEST ******"); IMolecule mol = builder.newMolecule(); for (int i=0; i<6; i++) { IAtom carbon = builder.newAtom(Elements.CARBON); carbon.setFlag(CDKConstants.ISAROMATIC, true); // making sure the order matches the test results mol.addAtom(carbon); } IBond ringBond = builder.newBond(mol.getAtom(0), mol.getAtom(1), CDKConstants.BONDORDER_DOUBLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); ringBond = builder.newBond(mol.getAtom(1), mol.getAtom(2), CDKConstants.BONDORDER_SINGLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); ringBond = builder.newBond(mol.getAtom(2), mol.getAtom(3), CDKConstants.BONDORDER_DOUBLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); ringBond = builder.newBond(mol.getAtom(3), mol.getAtom(4), CDKConstants.BONDORDER_SINGLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); ringBond = builder.newBond(mol.getAtom(4), mol.getAtom(5), CDKConstants.BONDORDER_DOUBLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); ringBond = builder.newBond(mol.getAtom(5), mol.getAtom(0), CDKConstants.BONDORDER_SINGLE); ringBond.setFlag(CDKConstants.ISAROMATIC, true); mol.addBond(ringBond); haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"Car","Car","Car","Car","Car","Car","HC","HC","HC","HC","HC","HC"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); //System.out.println("MatchedTypeID:"+matched.getID()+" "+matched.getSymbol()+" "+matched.getAtomTypeName()); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); //System.out.println(mol.toString()); } /** * A unit test for JUnit with Water */ public void testFindMatchingAtomType_IAtomContainer_IAtom_Water() throws ClassNotFoundException, CDKException, java.lang.Exception { //System.out.println("**** START ATOMTYPE Water TEST ******"); IMolecule mol = builder.newMolecule(); IAtom oxygen = builder.newAtom(Elements.OXYGEN); // making sure the order matches the test results mol.addAtom(oxygen); haad.addExplicitHydrogensToSatisfyValency(mol); String [] testResult={"OH2","HO","HO"}; AtomTypeTools att=new AtomTypeTools(); MMFF94AtomTypeMatcher atm= new MMFF94AtomTypeMatcher(); att.assignAtomTypePropertiesToAtom(mol,false); for (int i=0;i<mol.getAtomCount();i++){ logger.debug("atomNr:" + mol.getAtom(i).toString()); IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(i)); assertNotNull(matched); AtomTypeManipulator.configure(mol.getAtom(i), matched); } for (int i=0; i<testResult.length;i++){ assertEquals(testResult[i],mol.getAtom(i).getAtomTypeName()); } //System.out.println("MMFF94 Atom 0:"+mol.getAtom(0).getAtomTypeName()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -