def main( args ): print print_args( args ) wts = Weights( args.density_score_wt, args.overlap_score_wt, args.closab_score_wt, args.clash_score_wt ) scorefxn = ScoreFunction( args.density_scorefile, args.overlap_scorefile, args.nonoverlap_scorefile, wts, args.null_frag_score ) pose = Pose() # empty pose pose.initialization( scorefxn._density_score_dict ) # default initialize by random temp = args.temperature mc = MonteCarlo( scorefxn, temp ) for each_round in range( 1, args.round+1 ): mc.apply( pose, args.steps ) pose.show_state( temp ) temp -= round( temp*0.1, 2 ) if temp <= 0: break mc.set_temperature( temp ) pose.dump_pickle()
parser.add_argument("--nstruct", default=1, type=int, help="default=1") # simulated annealing options parser.add_argument("--starting_temperature", default=1000, type=float, help="default=1.0") parser.add_argument("--cooling_rate", default=0.1, type=float, help="default=0.1") parser.add_argument("--steps_per_temp", default=1000, type=int, help="default=1000") parser.add_argument("--quench", action="store_true", default=False, help="default=False") parser.add_argument("--initialization", default="random", choices=["random", "lowdens", "lowrmsd" ], type=str, help="") # multi thread parser.add_argument("--multiprocessor", action="store_true", default=False, help="") parser.add_argument("--nprocs", type=int, help="numbers of CPUs you are going to use, default=20") args = parser.parse_args() print print_args( args ) wts = Weights( args.density_score_wt, args.overlap_score_wt, args.closab_score_wt, args.clash_score_wt ) scoretable = ScoreTable( args.selected_frags_path ) scoretable.score_files_reader( args.density_scorefile, args.overlap_scorefile, args.nonoverlap_scorefile ) scorefxn = ScoreFunction( scoretable, wts, args.null_frag_score ) if args.multiprocessor: if not args.nprocs: n_procs = processors_availabilty( total_processors() ) else: n_procs = args.nprocs to_pass = [ ( scorefxn, args, runid ) for runid in range( args.nstruct ) ] myPool = Pool( processes = n_procs ) myResults = myPool.map_async( run_annealer, to_pass )