コード例 #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 16:41:28 2019

@author: michal
"""
import sys
from graphManager import GraphManager

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print("Usage: graphRemove graphKeys")
    elif len(sys.argv) > 1:
        sm = GraphManager()
        graphKeys = sys.argv[1:]
        for g in graphKeys:
            sm.deleteGraph(g)
        sm.saveGraphs()
    else:
        print( "cooooo?")
コード例 #2
0
Created on Fri Dec 13 11:15:22 2019

@author: michal
"""

from graphManager import GraphManager
from sremove import SremoveManager
import sys
from os import system

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: graphCancelGraph graphKey")
    else:
        graphKey = sys.argv[1]
        sm = GraphManager()
        
        if not graphKey in sm.graphs:
            print("Invalid graph key!")
            quit()
            
        graph = sm.graphs[graphKey]
        
        id2remove = []
        
        for node in graph.nodes:
            
            status = graph.nodes[node]["data"].status
            
            if status != "running":
                continue
コード例 #3
0
        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


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: expandDynamoPMF compileScanScript.sh")
    else:
        compFile = sys.argv[1]
        currentDir = getcwd()

        sm = GraphManager()
        graph = sm.isGraphHere(currentDir)
        if graph:
            newGraph = extendDynamoPMF(compFile, graph, currentDir)

            sm.buildGraphDirectories(newGraph)
            sm.saveGraphs()
            print("Created new graph")
        else:
            print("No graph found in this directory directory")
コード例 #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 16:41:28 2019

@author: michal
"""
import sys
from graphManager import GraphManager

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print("Usage: graphDelNode nodeId")
    elif len(sys.argv) > 1:
        sm = GraphManager()
        nodeId = sys.argv[1]
        graph = sm.isGraphHere(nodeId)

        if not graph:
            print("Wrong node id")
            quit()

        successors = list(graph.successors(nodeId))

        graph.remove_node(nodeId)

        while successors:
            node2test = successors.pop()

            predecessors = list(graph.predecessors(node2test))
コード例 #5
0
        newNode.processors = 6
        newNode.time = "72:00:00"
        graph.add_node(newDir, data=newNode)
        graph.add_edge(node, newDir)


if __name__ == "__main__":
    if len(sys.argv) == 1:
        print("Usage: graphDFT-SP slurmFile/nodeKey")
    elif len(sys.argv) == 2:
        slurmFile = sys.argv[1]
        currentDir = getcwd()
        gaussianFile = getGaussianInpFromSlurmFile(slurmFile)
        gaussianLog = gaussianFile.replace("inp", "log")

        sm = GraphManager()
        graph = sm.isGraphHere(currentDir)
        if not graph:
            jobGraph = nx.DiGraph()
            newNode = GaussianNode(gaussianFile, currentDir)
            newNode.slurmFile = slurmFile
            newNode.status = "finished"
            jobGraph.add_node(currentDir, data=newNode)

            addManySPcorrections(jobGraph, currentDir)

            result = sm.addGraph(jobGraph, currentDir)
            if result:
                sm.buildGraphDirectories(jobGraph)
                sm.saveGraphs()
            print("Created new graph")
コード例 #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 17:29:27 2019

@author: michal
"""

import sys
from graphManager import GraphManager

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: graphSave graphKey pickleFile")
    else:
        sm = GraphManager()
        graphKey = sys.argv[1]
        pickleFile = sys.argv[2]
        sm.saveGraph(graphKey, pickleFile)
コード例 #7
0
        if len(sys.argv) == 7:
            additionalName = sys.argv[6]

        if isfile(whamLog):
            tsReactionCoord = getTScoords(whamLog)
        else:
            tsReactionCoord = float(whamLog)
        print("Found reaction coordinate: ", tsReactionCoord)
        data = parseFDynamoCompileScript(compileScript)
        definedAtoms = data["definedAtoms"]
        atoms = atomsFromAtomSelection(definedAtoms)

        currentDir = abspath(dirname(compileScript))

        graphDir = join(getcwd(), "multiTSsearch-" + method + additionalName)

        sm = GraphManager()
        graph = sm.isGraphHere(graphDir)
        if not graph:
            newGraph = jobGraph = buildGraph(tsReactionCoord, atoms, graphDir,
                                             data, currentDir, TSno, method,
                                             basis)

            result = sm.addGraph(newGraph, graphDir)
            if result:
                sm.buildGraphDirectories(newGraph)
                sm.saveGraphs()
            print("Created new graph")
        else:
            print("Cannot create more than one graph in the same directory")
コード例 #8
0
ファイル: graphAdd.py プロジェクト: chemiczny/jobManagerPro
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 16:41:28 2019

@author: michal
"""
import sys
from graphManager import GraphManager
import pickle

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: graphAdd graphKey pickleFile")
    elif len(sys.argv) > 1:
        sm = GraphManager()
        graphKey = sys.argv[1]
        pickleFile = sys.argv[2]

        infile = open(pickleFile, 'rb')
        graph = pickle.load(infile)
        infile.close()

        if graphKey in sm.graphs:
            print("Graph with this key already exists!")
            quit()

        sm.graphs[graphKey] = graph
        sm.saveGraphs()
コード例 #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 10:27:35 2020

@author: michal
"""

from graphManager import GraphManager
import sys

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: graphRunNode nodePath")
    else:
        nodePath = sys.argv[1]
        gm = GraphManager()
        
        graph = gm.isGraphHere(nodePath)
        
        if not graph:
            print("Invalid path!")
            quit()
            
        graph.nodes[nodePath]["data"].run()
        gm.saveGraphs()
        
コード例 #10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 16:57:10 2019

@author: michal
"""

from graphManager import GraphManager
import sys

if __name__ == "__main__":
    if len(sys.argv) == 1:
        sm = GraphManager()
        sm.printStatus()
    elif len(sys.argv) == 2:
        sm = GraphManager()
        sm.printStatus(True)
    elif len(sys.argv) == 3:
        graphKey = sys.argv[2]
        sm = GraphManager()
        sm.printStatus(True, graphKey)
    
コード例 #11
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 21 14:22:30 2019

@author: michal
"""

from graphManager import GraphManager
import sys

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print("Usage: graphPrintNodeAttry nodePath")
    elif len(sys.argv) == 2:
        node = sys.argv[1]
        sm = GraphManager()
        sm.printNodeAttributes(node)
    else:
        print("Cooo?")
コード例 #12
0
if __name__ == "__main__":
    if len(sys.argv) == 1:
        print(
            "Usage: graphReplace node slurmFile status [default: waitingForParent]"
        )
        print("Possible status: waitingForParent, running, finished, examined")
    elif len(sys.argv) == 3:
        slurmFile = sys.argv[2]
        inputFile = getGaussianInpFromSlurmFile(slurmFile)
        newNode = dirname(abspath(slurmFile))

        slurmFile = basename(slurmFile)
        oldNode = sys.argv[1]

        sm = GraphManager()
        sm.insertPath2node(oldNode, newNode, slurmFile, inputFile)
        sm.saveGraphs()
    elif len(sys.argv) == 4:
        slurmFile = sys.argv[2]
        inputFile = getGaussianInpFromSlurmFile(slurmFile)
        newNode = dirname(abspath(slurmFile))

        slurmFile = basename(slurmFile)
        oldNode = sys.argv[1]
        status = sys.argv[3]

        sm = GraphManager()
        sm.insertPath2node(oldNode, newNode, slurmFile, inputFile, status)
        sm.saveGraphs()
コード例 #13
0
def addTSsearch (jobGraph, rootDir, currentDir, baseData, initialGeom, index):
    newNode = FDynamoNode("tsSearch.f90", currentDir)
    newNode.verification = ["Opt" , "Freq"]
    newNode.noOfExcpectedImaginaryFrequetions = 1
    newNode.templateKey = "QMMM_opt_mopac"
    newNode.additionalKeywords = { "ts_search" : "true" }
    newNode.coordsIn = "coordsIn.crd"
    
    makedirs(currentDir)
    saveCrdFromDCD( join(currentDir, "coordsIn.crd"), initialGeom )
    
    newNode.coordsOut = "coordsDone.crd"
    newNode.getCoordsFromParent = False
    
    newNode.fDynamoPath = baseData["fDynamoPath"]
    newNode.charge = baseData["charge"]
    newNode.method = baseData["method"]
    newNode.forceField = data["forceField"]
    copyfile( join(baseData["filesDir"], baseData["forceField"]), join(currentDir, newNode.forceField) )
    newNode.flexiblePart = data["flexiblePart"]
    copyfile( join(baseData["filesDir"], baseData["flexiblePart"]), join(currentDir, newNode.flexiblePart) )
    newNode.sequence = data["sequence"]
    copyfile( join(baseData["filesDir"], baseData["sequence"]), join(currentDir, newNode.sequence) )
    newNode.qmSele = data["qmSele"]
    
    jobGraph.add_node(currentDir, data = newNode)
    jobGraph.add_edge(rootDir, currentDir)
    
    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"
    

    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" , "definedAtoms" : baseData["definedAtoms"]}
    newNode.coordsIn = "coordsStart.crd"
    newNode.coordsOut = "coordsDone"+str(index)+".crd"
    newNode.measureRCinOutput = True
    

    jobGraph.add_node(optDir, data = newNode)
    jobGraph.add_edge( newDir, optDir)
    
    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"
    
    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" , "definedAtoms" : baseData["definedAtoms"]}
    newNode.coordsIn = "coordsStart.crd"
    newNode.coordsOut = "coordsDone"+str(index)+".crd"
    newNode.measureRCinOutput = True
    
    jobGraph.add_node(optDir, data = newNode)
    jobGraph.add_edge( newDir, optDir)
    

    if len(sys.argv) < 4:
        print("Usage: graphTSsearchWHAM wham.log/RC compileScanScript.sh numberOfTS2find addName")
    else:
        whamLog = sys.argv[1]
        compileScript = sys.argv[2]
        TSno = int(sys.argv[3])
        
        addName = ""
        if len(sys.argv) > 4:
            addName = sys.argv[4]

        if isfile(whamLog):
            tsReactionCoord = getTScoords(whamLog)
        else:
            tsReactionCoord = float(whamLog)
        print("Found reaction coordinate: ", tsReactionCoord)
        data = parseFDynamoCompileScript(compileScript)
        definedAtoms = data["definedAtoms"]
        atoms = atomsFromAtomSelection( definedAtoms)

        currentDir = abspath(dirname(compileScript))

        graphDir = join( getcwd(), "multiTSsearch"+addName )

        sm = GraphManager()
        graph = sm.isGraphHere(graphDir)
        if not graph:
            newGraph = jobGraph = buildGraph(tsReactionCoord, atoms, graphDir, data, currentDir, TSno)
    
            
            result = sm.addGraph(newGraph, graphDir)
            if result:
                sm.buildGraphDirectories(newGraph)
                sm.saveGraphs()
            print("Created new graph")
        else:
            print("Cannot create more than one graph in the same directory")
コード例 #14
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 23:27:46 2019

@author: michal
"""

from graphManager import GraphManager
import sys

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: graphRestart node")
    else:
        sm = GraphManager()
        path = sys.argv[-1]
        sm.restartNode(path)
        sm.saveGraphs()
コード例 #15
0
if __name__ == "__main__":
    if len(sys.argv) == 1:
        print(
            "Usage: graphAdd parentNode slurmFile status [default: waitingForParent]"
        )
        print("Possible status: waitingForParent, running, finished, examined")
    elif len(sys.argv) == 3:
        slurmFile = sys.argv[2]
        inputFile = getGaussianInpFromSlurmFile(slurmFile)
        newNode = dirname(abspath(slurmFile))

        slurmFile = basename(slurmFile)
        oldNode = sys.argv[1]

        sm = GraphManager()
        sm.addNewNode(oldNode, newNode, slurmFile, inputFile)
        sm.saveGraphs()
    elif len(sys.argv) == 4:
        slurmFile = sys.argv[2]
        inputFile = getGaussianInpFromSlurmFile(slurmFile)
        newNode = dirname(abspath(slurmFile))

        slurmFile = basename(slurmFile)
        oldNode = sys.argv[1]
        status = sys.argv[3]

        sm = GraphManager()
        sm.addNewNode(oldNode, newNode, slurmFile, inputFile, status)
        sm.saveGraphs()
コード例 #16
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 23:24:04 2019

@author: michal
"""

from graphManager import GraphManager
import sys

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: graphResults graphKey force[optional]")
    elif len(sys.argv) == 2:
        graphKey = sys.argv[1]
        sm = GraphManager()
        sm.printResults(graphKey)
        sm.saveGraphs()
    else:
        graphKey = sys.argv[1]
        sm = GraphManager()
        sm.printResults(graphKey, True)
        sm.saveGraphs()