예제 #1
0
def run(args):
    """Runs the matdb setup and cleanup to produce database files.
    """

    print("matdb  Copyright (C) 2019  HALL LABS")
    print("This program comes with ABSOLUTELY NO WARRANTY.")
    print("This is free software, and you are welcome to redistribute it under "
          "certain conditions.")

    if args is None:
        return
    #No matter what other options the user has chosen, we will have to create a
    #database controller for the specification they have given us.
    from matdb.database import Controller
    """The Controller class is to help the rest of the software parse and store configuration settings from the YAML file. 
    """
    cdb = Controller(args["dbspec"])
    if args["s"]:
        cdb.setup(args["rerun"], args["dfilter"])
    if args["x"]:
        cdb.execute(args["recover"], args["dfilter"], dryrun=args["dryrun"])
    if args["e"]:
        cdb.extract(args["dfilter"], cleanup=args["clean"], asis=args["asis"])

    if args["recover"] and not args["x"]:
        cdb.recover(args["rerun"], args["dfilter"])
        
    if args["status"]:
        cdb.status(args["busy"], args["dfilter"])
예제 #2
0
def Pd_db(tmpdir):
    from matdb.utility import relpath, reporoot
    from matdb.database import Controller
    from os import mkdir

    target = relpath("./tests/Pd/matdb")
    dbdir = str(tmpdir.join("pd_db"))
    mkdir(dbdir)

    #We need to copy the POSCAR over from the testing directory to the temporary
    #one.
    from shutil import copy
    POSCAR = relpath("./tests/Pd/POSCAR")
    copy(POSCAR, dbdir)

    Pd = Controller(target, dbdir)
    Pd.setup()

    #First, we need to copy the FORCE_SETS and total_dos.dat files so that we
    #don't have to recompile those (they are tested elsewhere).
    from matdb.utility import symlink
    troot = path.join(reporoot, "tests", "data", "Pd", "dynmatrix")
    files = ["FORCE_SETS", "total_dos.dat", "mesh.yaml"]
    for seq in Pd.find("Pd.phonon-*.dynmatrix"):
        for filename in files:
            target = path.join(seq.root, "phonopy", filename)
            source = path.join(troot,
                               "{0}__{1}".format(filename, seq.parent.name))
            symlink(target, source)

    Pd.cleanup()
    Pd.setup()

    files = ["OUTCAR", "output.xyz"]
    seq = Pd["Pd.modulate.modulations"]
    troot = path.join(reporoot, "tests", "data", "Pd", "modulations")
    for i in range(1, 6):
        key = "M.{0:d}".format(i)
        for filename in files:
            target = path.join(seq.root, key, filename)
            source = path.join(troot, "{0}__{1}".format(filename, key))
            symlink(target, source)

    return Pd