def extendDynamoPMF(compFile, jobGraph, currentDir): startDir = currentDir data = parseFDynamoCompileScript(compFile) definedAtoms = data["definedAtoms"] constraints = data["constraints"] ####################### SCAN FROM TS ######################### scanSteps = 40 reverseScan = join(startDir, "TS1reverseScan") forwardScan = join(startDir, "TS1forwardScan") pmfDir = join(startDir, "PMF") if not reverseScan in jobGraph.nodes: print("Cannot find directory:") print(reverseScan) return jobGraph if not forwardScan in jobGraph.nodes: print("Cannot find directory:") print(forwardScan) return jobGraph for crd in glob(join(reverseScan, "seed.-*")): if "pdb" in crd: continue i = int(basename(crd).replace("seed.-", "")) stepDir = join(pmfDir, "pmfRev" + str(i)) if stepDir in jobGraph.nodes: continue else: print("New PMF step: ", stepDir) newNode = FDynamoNode("pmfStep.f90", stepDir) newNode.verification = ["SP"] newNode.partition = "plgrid" newNode.time = "72:00:00" newNode.templateKey = "QMMM_pmf" newNode.readInitialScanCoord = True newNode.additionalKeywords = { "coordScanStart": "", "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "seed.-" + str(i) newNode.anotherCoordsSource = "seed.-" + str(i) jobGraph.add_node(stepDir, data=newNode) jobGraph.add_edge(reverseScan, stepDir) for crd in glob(join(forwardScan, "seed.+*")): if "pdb" in crd: continue i = int(basename(crd).replace("seed.+", "")) if i == 0: continue stepDir = join(pmfDir, "pmfForw" + str(i)) if stepDir in jobGraph.nodes: continue else: print("New PMF step: ", stepDir) newNode = FDynamoNode("pmfStep.f90", stepDir) newNode.verification = ["SP"] newNode.partition = "plgrid" newNode.time = "72:00:00" newNode.templateKey = "QMMM_pmf" newNode.readInitialScanCoord = True newNode.anotherCoordsSource = "seed.+" + str(i) newNode.additionalKeywords = { "coordScanStart": "", "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "seed.+" + str(i) jobGraph.add_node(stepDir, data=newNode) jobGraph.add_edge(forwardScan, stepDir) return jobGraph
def generateTSsearchDynamoPMF(compFile, onlyPrepare, onlyRun, runDFT): jobGraph = nx.DiGraph() currentDir = getcwd() rootDir = currentDir data = parseFDynamoCompileScript(compFile) ########## INITIAL SCAN ########################### definedAtoms = data["definedAtoms"] constraints = data["constraints"] newNode = FDynamoNode(data["inputFile"], currentDir) newNode.coordsIn = data["coordsIn"] newNode.verification = ["scan1D"] newNode.slurmFile = None newNode.autorestart = False newNode.readInitialScanCoord = True # newNode.noOfExcpectedImaginaryFrequetions = 1 newNode.forceField = data["forceField"] newNode.flexiblePart = data["flexiblePart"] newNode.sequence = data["sequence"] newNode.qmSele = data["qmSele"] newNode.templateKey = "QMMM_scan1D_mopac" newNode.fDynamoPath = data["fDynamoPath"] newNode.charge = data["charge"] newNode.method = data["method"] newNode.additionalKeywords = { "scanDir": "+", "coordScanStart": "", "iterNo": "80", "definedAtoms": definedAtoms, "constraints": constraints } if not onlyRun: jobGraph.add_node(currentDir, data=newNode) newNode.generateInput() # newNode.compileInput() ################## TS SEARCH ##################################### startDir, currentDir = currentDir, join(currentDir, "ts_search") newNode = FDynamoNode("tsSearch.f90", currentDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 1 newNode.templateKey = "QMMM_opt_mopac" newNode.additionalKeywords = {"ts_search": "true"} newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" if not onlyRun: jobGraph.add_node(currentDir, data=newNode) jobGraph.add_edge(startDir, currentDir) tsFoundDir = currentDir if runDFT: gaussianFlexibleSele = rewriteFlexibleSeleFile( join(rootDir, data["flexiblePart"])) tsGaussianDir = join(tsFoundDir, "b3lyp") if not isdir(tsGaussianDir): makedirs(tsGaussianDir) newNode = FDynamoNode("tsSearch", tsGaussianDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 1 newNode.templateKey = "QMMM_opt_gaussian" newNode.fDynamoPath = "/net/people/plgglanow/fortranPackages/AMBER-g09/AMBER-dynamo/makefile" newNode.additionalKeywords = { "ts_search": "true", "method": "B3LYP", "basis": "6-31G(d,p)", "multiplicity": 1, "otherOptions": "" } newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" newNode.flexiblePart = basename(gaussianFlexibleSele) newNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" copyfile(gaussianFlexibleSele, join(tsGaussianDir, newNode.flexiblePart)) newNode.processors = 24 newNode.time = "30:00:00" newNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(tsGaussianDir, data=newNode) jobGraph.add_edge(tsFoundDir, tsGaussianDir) spDir = join(tsGaussianDir, "SP") dftNode = FDynamoNode("DFT-SP-", spDir) dftNode.verification = ["SP"] dftNode.templateKey = "QMMM_sp_gaussian" dftNode.additionalKeywords = { "method": "B3LYP", "basis": "6-311++G(2d,2p)", "multiplicity": 1, "otherOptions": "" } dftNode.coordsIn = "coordsStart.crd" dftNode.coordsOut = "coordsDone.crd" dftNode.flexiblePart = basename(gaussianFlexibleSele) dftNode.processors = 24 dftNode.time = "30:00:00" dftNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" dftNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(spDir, data=dftNode) jobGraph.add_edge(tsGaussianDir, spDir) newDir = join(currentDir, "irc_reverse") newNode = FDynamoNode("irc_reverse.f90", newDir) newNode.verification = ["SP"] newNode.templateKey = "QMMM_irc_mopac" newNode.additionalKeywords = {"IRC_dir": "-1"} newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" if not onlyRun: jobGraph.add_node(newDir, data=newNode) jobGraph.add_edge(currentDir, newDir) optDir = join(newDir, "opt") newNode = FDynamoNode("opt.f90", optDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 0 newNode.templateKey = "QMMM_opt_mopac" newNode.additionalKeywords = {"ts_search": "false"} newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" if not onlyRun: jobGraph.add_node(optDir, data=newNode) jobGraph.add_edge(newDir, optDir) if runDFT: tsGaussianDir = join(optDir, "b3lyp") if not isdir(tsGaussianDir): makedirs(tsGaussianDir) newNode = FDynamoNode("opt", tsGaussianDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 0 newNode.templateKey = "QMMM_opt_gaussian" newNode.fDynamoPath = "/net/people/plgglanow/fortranPackages/AMBER-g09/AMBER-dynamo/makefile" newNode.additionalKeywords = { "ts_search": "false", "method": "B3LYP", "basis": "6-31G(d,p)", "multiplicity": 1, "otherOptions": "" } newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" newNode.flexiblePart = basename(gaussianFlexibleSele) copyfile(gaussianFlexibleSele, join(tsGaussianDir, newNode.flexiblePart)) newNode.processors = 24 newNode.time = "30:00:00" newNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" newNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(tsGaussianDir, data=newNode) jobGraph.add_edge(optDir, tsGaussianDir) spDir = join(tsGaussianDir, "SP") dftNode = FDynamoNode("DFT-SP-", spDir) dftNode.verification = ["SP"] dftNode.templateKey = "QMMM_sp_gaussian" dftNode.additionalKeywords = { "method": "B3LYP", "basis": "6-311++G(2d,2p)", "multiplicity": 1, "otherOptions": "" } dftNode.coordsIn = "coordsStart.crd" dftNode.coordsOut = "coordsDone.crd" dftNode.flexiblePart = basename(gaussianFlexibleSele) dftNode.processors = 24 dftNode.time = "30:00:00" dftNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" dftNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(spDir, data=dftNode) jobGraph.add_edge(tsGaussianDir, spDir) newDir = join(currentDir, "irc_forward") newNode = FDynamoNode("irc_forward.f90", newDir) newNode.verification = ["SP"] newNode.templateKey = "QMMM_irc_mopac" newNode.additionalKeywords = {"IRC_dir": "1"} newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" if not onlyRun: jobGraph.add_node(newDir, data=newNode) jobGraph.add_edge(currentDir, newDir) optDir = join(newDir, "opt") newNode = FDynamoNode("opt.f90", optDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 0 newNode.templateKey = "QMMM_opt_mopac" newNode.additionalKeywords = {"ts_search": "false"} newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" if not onlyRun: jobGraph.add_node(optDir, data=newNode) jobGraph.add_edge(newDir, optDir) if runDFT: tsGaussianDir = join(optDir, "b3lyp") if not isdir(tsGaussianDir): makedirs(tsGaussianDir) newNode = FDynamoNode("opt", tsGaussianDir) newNode.verification = ["Opt", "Freq"] newNode.noOfExcpectedImaginaryFrequetions = 0 newNode.templateKey = "QMMM_opt_gaussian" newNode.fDynamoPath = "/net/people/plgglanow/fortranPackages/AMBER-g09/AMBER-dynamo/makefile" newNode.additionalKeywords = { "ts_search": "false", "method": "B3LYP", "basis": "6-31G(d,p)", "multiplicity": 1, "otherOptions": "" } newNode.coordsIn = "coordsStart.crd" newNode.coordsOut = "coordsDone.crd" newNode.flexiblePart = basename(gaussianFlexibleSele) copyfile(gaussianFlexibleSele, join(tsGaussianDir, newNode.flexiblePart)) newNode.processors = 24 newNode.time = "30:00:00" newNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" newNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(tsGaussianDir, data=newNode) jobGraph.add_edge(optDir, tsGaussianDir) spDir = join(tsGaussianDir, "SP") dftNode = FDynamoNode("DFT-SP-", spDir) dftNode.verification = ["SP"] dftNode.templateKey = "QMMM_sp_gaussian" dftNode.additionalKeywords = { "method": "B3LYP", "basis": "6-311++G(2d,2p)", "multiplicity": 1, "otherOptions": "" } dftNode.coordsIn = "coordsStart.crd" dftNode.coordsOut = "coordsDone.crd" dftNode.flexiblePart = basename(gaussianFlexibleSele) dftNode.processors = 24 dftNode.time = "30:00:00" dftNode.partition = "plgrid-gpu\n#SBATCH --gres=gpu:1\n#SBATCH -A plgksdhphdgpu" dftNode.moduleAddLines = "module add plgrid/apps/gaussian/g16.B.01" jobGraph.add_node(spDir, data=dftNode) jobGraph.add_edge(tsGaussianDir, spDir) ####################### SCAN FROM TS ######################### scanSteps = 40 reverseScan = join(startDir, "TS1reverseScan") newNode = FDynamoNode("scan.f90", reverseScan) newNode.verification = ["SP"] newNode.templateKey = "QMMM_scan1D_mopac" newNode.readInitialScanCoord = True newNode.additionalKeywords = { "scanDir": "-", "coordScanStart": "", "iterNo": str(scanSteps), "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "coordsStart.crd" jobGraph.add_node(reverseScan, data=newNode) if onlyRun: newNode.forceField = data["forceField"] newNode.flexiblePart = data["flexiblePart"] newNode.sequence = data["sequence"] newNode.qmSele = data["qmSele"] newNode.templateKey = "QMMM_scan1D_mopac" newNode.fDynamoPath = data["fDynamoPath"] newNode.charge = data["charge"] newNode.method = data["method"] newNode.status = "examined" else: jobGraph.add_edge(tsFoundDir, reverseScan) if not onlyPrepare: pmfDir = join(startDir, "PMF") for i in range(scanSteps + 1): stepDir = join(pmfDir, "pmfRev" + str(i)) newNode = FDynamoNode("pmfStep.f90", stepDir) newNode.verification = ["SP"] newNode.partition = "plgrid" newNode.time = "72:00:00" newNode.templateKey = "QMMM_pmf" newNode.readInitialScanCoord = True newNode.additionalKeywords = { "coordScanStart": "", "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "seed.-" + str(i) newNode.anotherCoordsSource = "seed.-" + str(i) jobGraph.add_node(stepDir, data=newNode) jobGraph.add_edge(reverseScan, stepDir) forwardScan = join(startDir, "TS1forwardScan") newNode = FDynamoNode("scan.f90", forwardScan) newNode.verification = ["SP"] newNode.templateKey = "QMMM_scan1D_mopac" newNode.readInitialScanCoord = True newNode.additionalKeywords = { "scanDir": "+", "coordScanStart": "", "iterNo": str(scanSteps), "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "coordsStart.crd" jobGraph.add_node(forwardScan, data=newNode) if onlyRun: newNode.forceField = data["forceField"] newNode.flexiblePart = data["flexiblePart"] newNode.sequence = data["sequence"] newNode.qmSele = data["qmSele"] newNode.templateKey = "QMMM_scan1D_mopac" newNode.fDynamoPath = data["fDynamoPath"] newNode.charge = data["charge"] newNode.method = data["method"] newNode.status = "examined" else: jobGraph.add_edge(tsFoundDir, forwardScan) if not onlyPrepare: for i in range(1, scanSteps + 1): stepDir = join(pmfDir, "pmfForw" + str(i)) newNode = FDynamoNode("pmfStep.f90", stepDir) newNode.verification = ["SP"] newNode.partition = "plgrid" newNode.time = "72:00:00" newNode.templateKey = "QMMM_pmf" newNode.readInitialScanCoord = True newNode.anotherCoordsSource = "seed.+" + str(i) newNode.additionalKeywords = { "coordScanStart": "", "definedAtoms": definedAtoms, "constraints": constraints } newNode.coordsIn = "seed.+" + str(i) jobGraph.add_node(stepDir, data=newNode) jobGraph.add_edge(forwardScan, stepDir) return jobGraph