def JP10CalcDistDev(): """ A test of distance deviations, given a mapping """ a = MolecularCoordinates.readMOLFile('JP10A.mol') b = MolecularCoordinates.readMOLFile('JP10B.mol') #atomMap = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15, 16:16, 17:17, 18:18, 19:19, 20:20, 21:21, 22:22, 23:23, 24:24, 25:25, 26:26} #"correct" mapping #atomMap = {1: 2, 2: 1, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 24, 24: 25, 25: 26, 26: 23}#test mapping #15 atomMap = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 24, 24: 25, 25: 26, 26: 23} #test mapping #13 (distDevAbs,distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(a, b, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) print distDevAbsMax
def MM4ReadMOLWrite(): """ A test of MM4 reading and MOL, XYZ writing """ mg1 = MolecularCoordinates.readMM4File("JP10stochFixedStruct.out", 1) mg2 = MolecularCoordinates.readMM4File("JP10stochFixedStruct.out", 295) mg1a = MolecularCoordinates.readMM4File("JP10stochFixedStruct.out", 253) mg1.writeMOLFile("JP10_MM4_1.mol", "JP10_MM4_1") mg2.writeMOLFile("JP10_MM4_8.mol", "JP10_MM4_8") mg1a.writeMOLFile("JP10_MM4_7.mol", "JP10_MM4_7") mg1.perceiveConnectivity() mg1.writeMOLFile("JP10_MM4_1_conn.mol", "JP10_MM4_1", connectivity=True) mg1.writeXYZFile("JP10_MM4_1.xyz", "JP10_MM4_1") print MolecularCoordinates.checkConformationalEquivalence(mg1, mg1a, Atol=0.02) atomMap = { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, } # "correct" mapping (distDevAbs, distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(mg1, mg1a, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) print distDevAbsMax
def testCalcDistDev(self): """ A test of distance deviations, given a mapping Uses mirror image conformations of gauche n-butane (each independently optimized using PM3 in Gaussian03 using default convergence criteria) """ ac = [[-1.5846, -0.5216, 0.1338], [-1.1512, -1.5146, -0.0477 ], [-1.7781, -0.4440, 1.2120 ], [-2.5555, -0.4907, -0.3770 ], [-0.6751, 0.5855, -0.3509 ], [-1.1705, 1.5633, -0.1896 ], [-0.5293, 0.5028, -1.4463 ], [ 0.6751, 0.5854, 0.3509 ], [ 1.1705, 1.5633, 0.1895 ], [ 0.5294, 0.5028, 1.4463 ], [ 1.5846, -0.5216, -0.1338 ], [ 2.5554, -0.4908, 0.3772 ], [ 1.1510, -1.5146, 0.0475 ], [ 1.7783, -0.4438, -1.2120]] aa = [6, 1, 1, 1, 6, 1, 1, 6, 1, 1, 6, 1, 1, 1] bc = [[ -1.5845, -0.5216, -0.1338], [-1.7784, -0.4438, -1.2120 ], [-1.1509, -1.5146, 0.0474 ], [-2.5553, -0.4910, 0.3773 ], [-0.6751, 0.5855, 0.3508 ], [-0.5293, 0.5028, 1.4463 ], [-1.1705, 1.5634, 0.1895 ], [ 0.6751, 0.5855, -0.3508 ], [ 1.1705, 1.5633, -0.1893 ], [ 0.5294, 0.5030, -1.4463 ], [ 1.5845, -0.5216, 0.1338 ], [ 1.1510, -1.5146, -0.0478 ], [ 2.5555, -0.4908, -0.3770 ], [ 1.7780, -0.4441, 1.2121 ]] ba = [6, 1, 1, 1, 6, 1, 1, 6, 1, 1, 6, 1, 1, 1] a = MolecularCoordinates.MolecularGeometry(aa,ac) b = MolecularCoordinates.MolecularGeometry(ba,bc) #atomMap = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14} #a naive mapping atomMap = {1: 1, 2: 3, 3: 2, 4: 4, 5: 5, 6: 7, 7: 6, 8: 8, 9: 9, 10: 10, 11: 11, 12: 13, 13: 12, 14: 14} #a "correct" mapping (there is also one other "correct" mapping) (distDevAbs,distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(a, b, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) self.assertAlmostEqual(distDevAbsMax, 0.000528777418128, 5) self.assertAlmostEqual(distDevRelMax, 0.000145546853437, 5)
def MM4ReadMOLWrite(): """ A test of MM4 reading and MOL, XYZ writing """ mg1=MolecularCoordinates.readMM4File('JP10stochFixedStruct.out',1) mg2=MolecularCoordinates.readMM4File('JP10stochFixedStruct.out',295) mg1a=MolecularCoordinates.readMM4File('JP10stochFixedStruct.out',253) mg1.writeMOLFile('JP10_MM4_1.mol', 'JP10_MM4_1') mg2.writeMOLFile('JP10_MM4_8.mol', 'JP10_MM4_8') mg1a.writeMOLFile('JP10_MM4_7.mol', 'JP10_MM4_7') mg1.perceiveConnectivity() mg1.writeMOLFile('JP10_MM4_1_conn.mol', 'JP10_MM4_1', connectivity=True) mg1.writeXYZFile('JP10_MM4_1.xyz', 'JP10_MM4_1') print MolecularCoordinates.checkConformationalEquivalence(mg1, mg1a, Atol=0.02) atomMap = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15, 16:16, 17:17, 18:18, 19:19, 20:20, 21:21, 22:22, 23:23, 24:24, 25:25, 26:26} #"correct" mapping (distDevAbs,distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(mg1, mg1a, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) print distDevAbsMax
def JP10CalcDistDev(): """ A test of distance deviations, given a mapping """ a = MolecularCoordinates.readMOLFile("JP10A.mol") b = MolecularCoordinates.readMOLFile("JP10B.mol") # atomMap = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14, 15:15, 16:16, 17:17, 18:18, 19:19, 20:20, 21:21, 22:22, 23:23, 24:24, 25:25, 26:26} #"correct" mapping # atomMap = {1: 2, 2: 1, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 24, 24: 25, 25: 26, 26: 23}#test mapping #15 atomMap = { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 24, 24: 25, 25: 26, 26: 23, } # test mapping #13 (distDevAbs, distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(a, b, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) print distDevAbsMax
def testCalcDistDev(self): """ A test of distance deviations, given a mapping Uses mirror image conformations of gauche n-butane (each independently optimized using PM3 in Gaussian03 using default convergence criteria) """ ac = [ [-1.5846, -0.5216, 0.1338], [-1.1512, -1.5146, -0.0477], [-1.7781, -0.4440, 1.2120], [-2.5555, -0.4907, -0.3770], [-0.6751, 0.5855, -0.3509], [-1.1705, 1.5633, -0.1896], [-0.5293, 0.5028, -1.4463], [0.6751, 0.5854, 0.3509], [1.1705, 1.5633, 0.1895], [0.5294, 0.5028, 1.4463], [1.5846, -0.5216, -0.1338], [2.5554, -0.4908, 0.3772], [1.1510, -1.5146, 0.0475], [1.7783, -0.4438, -1.2120], ] aa = [6, 1, 1, 1, 6, 1, 1, 6, 1, 1, 6, 1, 1, 1] bc = [ [-1.5845, -0.5216, -0.1338], [-1.7784, -0.4438, -1.2120], [-1.1509, -1.5146, 0.0474], [-2.5553, -0.4910, 0.3773], [-0.6751, 0.5855, 0.3508], [-0.5293, 0.5028, 1.4463], [-1.1705, 1.5634, 0.1895], [0.6751, 0.5855, -0.3508], [1.1705, 1.5633, -0.1893], [0.5294, 0.5030, -1.4463], [1.5845, -0.5216, 0.1338], [1.1510, -1.5146, -0.0478], [2.5555, -0.4908, -0.3770], [1.7780, -0.4441, 1.2121], ] ba = [6, 1, 1, 1, 6, 1, 1, 6, 1, 1, 6, 1, 1, 1] a = MolecularCoordinates.MolecularGeometry(aa, ac) b = MolecularCoordinates.MolecularGeometry(ba, bc) # atomMap = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10, 11:11, 12:12, 13:13, 14:14} #a naive mapping atomMap = { 1: 1, 2: 3, 3: 2, 4: 4, 5: 5, 6: 7, 7: 6, 8: 8, 9: 9, 10: 10, 11: 11, 12: 13, 13: 12, 14: 14, } # a "correct" mapping (there is also one other "correct" mapping) (distDevAbs, distDevRel) = MolecularCoordinates.calcDistanceDeviationsGivenMapping(a, b, atomMap) distDevAbsMax = MolecularCoordinates.dictionaryMaxAbs(distDevAbs) distDevRelMax = MolecularCoordinates.dictionaryMaxAbs(distDevRel) self.assertAlmostEqual(distDevAbsMax, 0.000528777418128, 5) self.assertAlmostEqual(distDevRelMax, 0.000145546853437, 5)