예제 #1
0
def main():

    data_folder = FOLDER
    index_file = INDEX

    msg.info("Fetching molecules", 2)
    molecules = QChemResultsReader.fetch_from_folder(data_folder, BASIS)
    #molecules = XYZFileReader.read_folder(data_folder, basis=BASIS)[:300] # todo calculate full list!!

    msg.info("Starting SCF Calculation", 2)

    if len(molecules) > FRACTION:
        msg.info("Too many samples. Doing SCF calculations batchwise ...", 2)

        number_of_batches = int(np.ceil(len(molecules) / FRACTION))

        # if dataset is too large do calculation in subsets
        for i in range(number_of_batches):

            msg.info(
                "Starting Subset {0}/{1}".format(i + 1, number_of_batches), 2)

            folder = data_folder + "/SubSet_" + str(i + 1) + "/"

            try:
                subset = molecules[i * FRACTION:(i + 1) * FRACTION]

                if not os.path.exists(folder):
                    os.mkdir(folder)

                S, P, F = do_scf_runs(subset)

                msg.info("Exporting Results", 1)

                msg.info("S & P ...", 1)
                np.save(folder + "S" + PREFIX + ".npy", S)
                np.save(folder + "P" + PREFIX + ".npy", P)
                np.save(folder + "F" + PREFIX + ".npy", F)

                msg.info("Molecules ...", 1)
                np.save(folder + "molecules" + PREFIX + ".npy", subset)

            except Exception as ex:
                msg.error("Something went wrong: " + str(ex))

    else:

        S, P, F = do_scf_runs(molecules)

        msg.info("Exporting Results", 2)

        msg.info("S & P ...", 1)
        np.save(data_folder + "S" + PREFIX + ".npy", S)
        np.save(data_folder + "P" + PREFIX + ".npy", P)
        np.save(data_folder + "F" + PREFIX + ".npy", F)

        msg.info("Molecules ...", 1)
        np.save(data_folder + "molecules" + PREFIX + ".npy", molecules)

    msg.info("All Done. ", 2)
예제 #2
0
def main():   

    S, P = np.load("butadien/data/dataset.npy")

    dataset = Dataset(S, P, split_test=0.25)

    msg.info("Starting grid search ", 2)
    with open(log_file, "w") as f:
        info  = "===============================\n"
        info += str(datetime.now()) + "\n\n"
        f.write(info)

    structures = sample_structures()
    for structure in uniquifiy(structures):
        try:
            investigate_structure(dataset, structure)
        except Exception as ex:
            msg.error("Something went wrong during investigation: " + str(ex))