Example #1
0
def writeSeries(oldInput, key, replacements, GPU=False):
    mainDir = basename(oldInput).split(".")[0] + "series"
    mkdir(mainDir)

    for repl in replacements:
        newDir = "step" + str(repl)
        newDir = join(mainDir, newDir)
        mkdir(newDir)

        inputName = join(newDir, "step" + str(repl) + ".com")
        rewriteInput(oldInput, inputName, key, repl)
        writeSlurmScript(join(newDir, "run.slurm"), basename(inputName), GPU)
Example #2
0
def writeScans( oldInput, coords, atomStart, atom2Move, atomDir, nSteps, minDist, GPU = False ):
    atomStartIndex = atomStart
    atomStart = np.array(coords[atom2Move])
    atomStop = np.array(coords[atomDir])
    
    moveVector = atomStop - atomStart
    length = np.linalg.norm(moveVector)
    
    moveVector = moveVector*(length-minDist)/length
    step = moveVector/nSteps
    mainDir = basename(oldInput).split(".")[0]+"scan"
    mkdir(mainDir)
    
    for i in range(nSteps):
        newDir = "step"+str(i)
        newDir = join(mainDir, newDir)
        mkdir(newDir)
        atomStart += step
        coords[atom2Move] = atomStart.tolist() 
        inputName = join(newDir, "step"+str(i)+".com")
        writeNewInput(oldInput, coords, inputName, "" )
        writeSlurmScript(join(newDir, "run.slurm"), basename(inputName), GPU)
Example #3
0
        inpFile = join(dirname, dirname + ".inp")

        inputFile = open(inpFile, 'w')
        xyzName = basename(xyzFile)

        inputFile.write("basis 6-31g**\n")
        inputFile.write("charge 0\n")
        inputFile.write("run ts\n")
        inputFile.write("method ub3lyp\n")
        inputFile.write("new_minimizer yes\n")
        inputFile.write("coordinates " + xyzName + "\nend\n\n")

        frozen = []
        for f in indexes:
            frozen.append(str(f + 1))

        if frozen:
            inputFile.write("$constraint_freeze\n")
            if frozen:
                inputFile.write("xyz " + ",".join(frozen) + "\n")

            inputFile.write("$end\n")

        inputFile.close()

        writeSlurmScript(join(dirname, dirname + ".slurm"), basename(inpFile),
                         True, "terachem")
    else:
        print("katalog " + dirname + " juz istnieje")
        line = oldFile.readline()

    destiny.close()
    oldFile.close()


if len(sys.argv) < 4:
    print(
        "Potrzebuje: g16Log, oldInput, newInputName, geometry index [optional, negative indexes possible]"
    )
else:

    g16Log = sys.argv[1]
    oldInput = sys.argv[2]
    newInputName = sys.argv[3]
    index = -1
    if len(sys.argv) > 4:
        index = int(sys.argv[4])

    newDir = newInputName.split(".")[0]

    if isdir(newDir):
        print("Wybrana sciezka juz istnieje!")
    else:
        mkdir(newDir)
        last = getCoordsFromLog(g16Log, index)
        newInputName = join(newDir, newInputName)
        writeNewInput(oldInput, last, newInputName)
        writeSlurmScript(join(newDir, "run.slurm"), basename(newInputName),
                         False)
Example #5
0
        destiny.write(line)
        line = oldFile.readline()

    destiny.close()
    oldFile.close()


if len(sys.argv) < 3:
    print("Potrzebuje: input start, input final, steps, gpu(optional)")
else:
    inputStart = sys.argv[1]
    inputFinal = sys.argv[2]
    steps = int(sys.argv[3])
    gpu = False
    if len(sys.argv) > 4:
        gpu = True

    indexesStart, coordsStart, el = getFrozenIndexes(inputStart)
    indexesFinal, coordsFinal, el = getFrozenIndexes(inputFinal)

    coordsFinalFixed = fixCoordinates(indexesStart, coordsStart, coordsFinal)
    frames = generateFrames(coordsStart, coordsFinalFixed, steps)

    for n, frame in enumerate(frames):
        dirname = "linerScan_" + str(n)
        mkdir(dirname)
        inputName = join(dirname, "linearScan.com")
        slurmFile = join(dirname, "linearScan.slurm")
        writeNewInput(inputStart, frame, inputName)
        writeSlurmScript(slurmFile, basename(inputName), gpu)