def LongLinearChainHetConf(n): #n represents the number of atoms in the chain atomtypes = [i for i in range(0,n)] atomcoor = [[i,0,0] for i in range(0,n)] a = MolecularCoordinates.MolecularGeometry(atomtypes,atomcoor) b = MolecularCoordinates.MolecularGeometry(atomtypes,atomcoor) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.5)
def MirrorImageConf(): 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) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.001)
def LongLinearChainHomConf(n): #n represents the number of atoms in the chain #all the atom-to-atom distances should be unique by the "binary" construction of the coordinates atomtypes = [1 for i in range(0,n)] atomcoor = [[2**i,0,0] for i in range(0,n)] a = MolecularCoordinates.MolecularGeometry(atomtypes,atomcoor) b = MolecularCoordinates.MolecularGeometry(atomtypes,atomcoor) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.5)
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 LongLinearChainHetConf(n): # n represents the number of atoms in the chain atomtypes = [i for i in range(0, n)] atomcoor = [[i, 0, 0] for i in range(0, n)] a = MolecularCoordinates.MolecularGeometry(atomtypes, atomcoor) b = MolecularCoordinates.MolecularGeometry(atomtypes, atomcoor) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.5)
def LongLinearChainHomConf(n): # n represents the number of atoms in the chain # all the atom-to-atom distances should be unique by the "binary" construction of the coordinates atomtypes = [1 for i in range(0, n)] atomcoor = [[2 ** i, 0, 0] for i in range(0, n)] a = MolecularCoordinates.MolecularGeometry(atomtypes, atomcoor) b = MolecularCoordinates.MolecularGeometry(atomtypes, atomcoor) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.5)
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 SimpleHomConf(): a = MolecularCoordinates.MolecularGeometry( [1, 1, 1, 1, 1, 1, 1, 1], [[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 0], [1, 1, 1]], ) b = MolecularCoordinates.MolecularGeometry( [1, 1, 1, 1, 1, 1, 1, 1], [[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 0], [1, 1, 1]], ) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
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 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 MirrorImageConf(): 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) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.001)
def AtomTypeSwapConf(): a = MolecularCoordinates.MolecularGeometry([8, 1, 1], [[0, 0, 0], [1, 0, 0], [0, 1, 0]]) b = MolecularCoordinates.MolecularGeometry([1, 8, 1], [[0, 0, 0], [1, 0, 0], [0, 1, 0]]) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
def DistinctJP10Conf(): a = MolecularCoordinates.readMOLFile("JP10A.mol") b = MolecularCoordinates.readMOLFile("JP10B.mol") return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.10)
def Buckminsterfullerene(): a = MolecularCoordinates.readMOLFile("c60_c.mol") b = MolecularCoordinates.readMOLFile("c60_c.mol") return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
#uses MoleCoor #argv[1] = input file path #argv[2] = output file name #argv[3] = molecule name #argv[4] = $RMG/source/MoleCoor path import sys sys.path.append(sys.argv[4])#add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readMOLFileWithConnectivity(sys.argv[1]) mg.writeMM4File(sys.argv[2],sys.argv[3])
#uses MoleCoor #argv[1] = input file path #argv[2] = output file name #argv[3] = molecule name #argv[4] = $RMG/source/MoleCoor path import sys sys.path.append(sys.argv[4])#add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readMM4File(sys.argv[1],1) mg.writeXYZFile(sys.argv[2],sys.argv[3])
#uses MoleCoor #argv[1] = input (XYZ) file path #argv[2] = output (MOL) file name #argv[3] = molecule name #argv[4] = tolerance for connectivity perception #argv[5] = $RMG/source/MoleCoor path import sys sys.path.insert( 1, sys.argv[5] ) #add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readXYZFile(sys.argv[1]) mg.perceiveConnectivity(tol=float(sys.argv[4])) mg.writeMOLFile(sys.argv[2], sys.argv[3], connectivity=True)
def SimpleHomConf(): a = MolecularCoordinates.MolecularGeometry([1,1,1,1,1,1,1,1],[[0,0,0],[1,0,0],[0,1,0],[0,0,1],[0,1,1],[1,0,1],[1,1,0],[1,1,1]]) b = MolecularCoordinates.MolecularGeometry([1,1,1,1,1,1,1,1],[[0,0,0],[1,0,0],[0,1,0],[0,0,1],[0,1,1],[1,0,1],[1,1,0],[1,1,1]]) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
def Buckminsterfullerene(): a = MolecularCoordinates.readMOLFile('c60_c.mol') b = MolecularCoordinates.readMOLFile('c60_c.mol') return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
def DistinctJP10Conf(): a = MolecularCoordinates.readMOLFile('JP10A.mol') b = MolecularCoordinates.readMOLFile('JP10B.mol') return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.10)
def LongLinearChainHetConfDist(n): #n represents the number of atoms in the chain atomtypes = [i for i in range(0,n)] atomcoor = [[i,0,0] for i in range(0,n)] a = MolecularCoordinates.MolecularGeometry(atomtypes,atomcoor) return a.getDistanceMappings()
def AtomTypeSwapConf(): a = MolecularCoordinates.MolecularGeometry([8,1,1],[[0,0,0],[1,0,0],[0,1,0]]) b = MolecularCoordinates.MolecularGeometry([1,8,1],[[0,0,0],[1,0,0],[0,1,0]]) return MolecularCoordinates.checkConformationalEquivalence(b, a, Atol=0.01)
#uses MoleCoor #argv[1] = input file path #argv[2] = output file name #argv[3] = molecule name #argv[4] = $RMG/source/MoleCoor path import sys sys.path.insert(1, sys.argv[4])#add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readMOLFileWithConnectivity(sys.argv[1]) mg.writeMM4File(sys.argv[2],sys.argv[3])
#uses MoleCoor #argv[1] = input (XYZ) file path #argv[2] = output (MOL) file name #argv[3] = molecule name #argv[4] = tolerance for connectivity perception #argv[5] = $RMG/source/MoleCoor path import sys sys.path.append(sys.argv[5])#add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readXYZFile(sys.argv[1]) mg.perceiveConnectivity(tol=float(sys.argv[4])) mg.writeMOLFile(sys.argv[2],sys.argv[3], connectivity=True)
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)
#uses MoleCoor #argv[1] = input file path #argv[2] = output file name #argv[3] = molecule name #argv[4] = $RMG/source/MoleCoor path import sys sys.path.insert(1, sys.argv[4])#add $RMG/source/MoleCoor to the PYTHONPATH so that import statements below work properly import MolecularCoordinates mg = MolecularCoordinates.readMM4File(sys.argv[1],1) mg.writeXYZFile(sys.argv[2],sys.argv[3])