def DO(experiment, mn): """Make a particular Mutant""" # Determine if the mutant should be made do = initial_check(experiment, mn) # If it should be, do so if do: # Mutate the Design Groups mutate_DesignGroups(experiment, mn) # Check to see if everything is finished finished = check_finish(experiment) # If everything is done, start the refinement calculations for the # mutant if finished: Finish(experiment, mn) else: # Otherwise, go back to the Experiment's folder, end sharing, and # wait for the initial folder to be deleted os.chdir(experiment["Folder"]) SHARING.End(experiment) SHARING.Wait("initial_mutant" + str(mn))
def DO(experiment, mn=None): """Do a Refinement""" # Only do a refinement when there is a refinement folder to do the # refinement IN if experiment["Type"] == "Mutator": if mn in [None, 0]: name = "wildtype" else: name = "mutant" + str(mn) else: name = "refinement" # If the folder doesn't exist, don't do anything if name in os.listdir("./"): # Initialize the experiment for the refinement modify = initialize(experiment, mn) # do the first set of refinement calculations - which exist to try and # keep the processors working on separate jobs as much as possible first_group_refinement(experiment) # And the second, which exists to get everything finished ASAP second_group_refinement(experiment) # Determine if the calculations are finished yet finished = finish_check(experiment, mn) # If the refinement is not finished, move out of the refinement's folder # and wait for it to be deleted if not finished: os.chdir(experiment["Folder"]) SHARING.End(experiment) # There's no need to wait during mutator experiments, except for the # Wildtype values to finish if experiment["Type"] != "Mutator" or mn in [None, 0]: SHARING.Wait(name) # If the refinement is finished, store the information else: Finish(experiment, mn) # The refinement folder is gone, the structures and energies are stored, # so we can be done with the refinement after a few more things delete_extra_group(experiment) if modify: experiment["Refinement Iterations"] = int( experiment["Refinement Iterations"] / 2) experiment["Activity"] = "Standard"
def make_extra_group(experiment): """Create an extra Design Group with no Target Molecules""" # Only do this if Binding energy calculations are being done if experiment["Energy Calculation"] == "Binding": # Get all of the Design Molecules from Design Group 1 molecules = [] for molecule in experiment[1]: if molecule.design: molecules.append(molecule) # Make and store a new Design Group (which duplicates these Molecules # for run independence reasons) N = len(experiment) + 1 group = MOLECULES.DesignGroup(N, molecules, experiment["Force Field"], \ experiment["File Format"]) experiment._groupOrder.append(N) experiment._groups[N] = group n = len(experiment) # Update the Current dictionary, too experiment["Current"][n] = {} for molecule in experiment[n]: new = molecule.duplicate() experiment["Current"][n][new.name] = new # Those structures are essentially place holders at this point. However, # we do need to run an energy minimization and calculate an initial # energy for that group name = "Group" + str(n) + "_Energies.txt" SHARING.Start(experiment) # If another processor already did the calculation, we're fine if name not in os.listdir("./Current/"): # Try to make a temp directory to do the calculations in if "temp" not in os.listdir("./"): # Make the directory and move into it os.mkdir("temp") os.chdir("temp") # Stop sharing SHARING.End(experiment) # Copy in the relevant files SHARING.copy_standard_files(experiment, False) # Relax the Design Group refinement = IPRO_FUNCTIONS.Relaxation(experiment, n, True) # And calculate the energies energies, refinement = \ IPRO_FUNCTIONS.Calculate_Energy(experiment, n) # Move back up a folder os.chdir("../") # Start sharing SHARING.Start(experiment) # Store the energy text = SHARING.format_energies(energies[n]) f = open("./Current/" + name, "w") f.write(text) f.close() SHARING.output_Current(experiment, "./Current/", n) # Delete the temp folder os.system("rm -rf temp") # Otherwise, just wait else: SHARING.End(experiment) SHARING.Wait("temp", "./") SHARING.Start(experiment) # Store that complex energy f = open("./Current/" + name, "r") experiment["Energies"][n] = {"Complex": float(f.readline().split()[2])} f.close() SHARING.End(experiment)