def main(): options = options_desc.parse_args(sys.argv)[0] pool = Pool() choice = "state in ('converged', 'refined')" if(options.ignore_convergence): choice = "state in ('converged', 'not-converged', 'refined')" needy_nodes = NodeList([n for n in pool.where(choice) if not n == pool.root]) # we won't touch the root if not(len(needy_nodes)): sys.exit("Nothing to do.") if not(userinput("Once the solvent has been removed, further refinement of the pool is not possible. This includes the generation of unrestrained transition nodes! Continue?", "bool")): sys.exit("Quit by user.") assert(len(needy_nodes) == len(needy_nodes.multilock())) # make sure we lock ALL nodes try: for n in needy_nodes: discard_solvent(n, "pdb") discard_solvent(n, "trr") for n in needy_nodes: n.unlock() except: traceback.print_exc()
def main(): options = options_desc.parse_args(sys.argv)[0] pool = Pool() choice = "state in ('converged', 'refined')" if (options.ignore_convergence): choice = "state in ('converged', 'not-converged', 'refined')" needy_nodes = NodeList([ n for n in pool.where(choice) if not n == pool.root ]) # we won't touch the root if not (len(needy_nodes)): sys.exit("Nothing to do.") if not (userinput( "Once the solvent has been removed, further refinement of the pool is not possible. This includes the generation of unrestrained transition nodes! Continue?", "bool")): sys.exit("Quit by user.") assert (len(needy_nodes) == len(needy_nodes.multilock()) ) # make sure we lock ALL nodes try: for n in needy_nodes: discard_solvent(n, "pdb") discard_solvent(n, "trr") for n in needy_nodes: n.unlock() except: traceback.print_exc()
def main(): options = options_desc.parse_args(sys.argv)[0] #TODO put somehow into Options, e.g. min_value=1 or required=True if(not options.doomed_nodes): sys.exit("Option --doomed_nodes is required.") pool = Pool() old_pool_size = len(pool) old_alpha = pool.alpha doomed_nodes = NodeList() #TODO: maybe this code should go into ZIBMolPy.ui for name in options.doomed_nodes.split(","): found = [n for n in pool if n.name == name] if(len(found) != 1): sys.exit("Coult not find node '%s'"%(name)) doomed_nodes.append(found[0]) for n in doomed_nodes: if(n == pool.root): sys.exit("Node %s is the root. Removal not allowed."%(n.name)) #if(len(n.children) > 0): # sys.exit("Node %s has children. Removal not allowed."%(n.name)) #TODO why should we forbid this? if not(userinput("The selected node(s) will be removed permanently. Continue?", "bool")): sys.exit("Quit by user.") assert(len(doomed_nodes) == len(doomed_nodes.multilock())) for n in doomed_nodes: print("Removing directory: "+n.dir) shutil.rmtree(n.dir) pool.reload_nodes() #TODO: this code-block also exists in zgf_create_node if(len(pool.where("isa_partition")) < 2): pool.alpha = None elif(options.methodalphas == "theta"): pool.alpha = zgf_create_nodes.calc_alpha_theta(pool) elif(options.methodalphas == "user"): pool.alpha = userinput("Please enter a value for alpha", "float") else: raise(Exception("Method unkown: "+options.methodalphas)) pool.history.append({'removed_nodes': [(n.name, n.state) for n in doomed_nodes], 'size':old_pool_size, 'alpha':old_alpha, 'timestamp':datetime.now()}) pool.save() #TODO: deal with analysis dir and dependencies zgf_cleanup.main()