def test_amber_minimization(clean_files): simulation = Simulation() simulation.path = os.path.join("tmp") shutil.copy(os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl.prmtop"), "tmp") shutil.copy(os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl.rst7"), "tmp") simulation.executable = "sander" simulation.restraint_file = None simulation.prefix = "minimize" simulation.topology = "k-cl.prmtop" simulation.inpcrd = "k-cl.rst7" simulation.config_gb_min() # Turn off GB for now. simulation.cntrl["igb"] = 0 simulation.cntrl["ntb"] = 0 simulation.run() mdout = parse_mdout(os.path.join("tmp", "minimize.out")) assert pytest.approx(mdout["Bond"][-1]) == 0 assert pytest.approx(mdout["Angle"][-1]) == 0 assert pytest.approx(mdout["Dihedral"][-1]) == 0 assert pytest.approx(mdout["V14"][-1]) == 0 assert pytest.approx(mdout["E14"][-1]) == 0 assert pytest.approx(mdout["VDW"][0], 0.1) == 6.5734 assert pytest.approx(mdout["Ele"][0], 0.1) == -211.7616
logging.basicConfig(filename='tscc.log', format='%(asctime)s %(message)s', datefmt='%Y-%m-%d %I:%M:%S %p', level=logging.DEBUG) logging.info('Started logging...') logging.info(paprika.__version__) ntwprt = 206 nstlim = 500000 sim = Simulation() # Minimization sim.executable = 'pmemd.cuda' sim.topology = 'solvate.prmtop' sim.prefix = 'minimize' sim.inpcrd = 'solvate.rst7' sim.path = './' sim.ref = 'solvate.rst7' sim.config_pbc_min() sim.cntrl['maxcyc'] = 500 sim.cntrl['ncyc'] = 400 sim.cntrl['ntr'] = 1 sim.cntrl['restraint_wt'] = 50.0 sim.cntrl['restraintmask'] = "'@DUM'" sim.cntrl['cut'] = 9.0 sim.restraint_file = 'disang.rest' sim.run(fail_ok=False) # Equilibration sim.config_pbc_md()
guest_anchors = [':2@C1', ':2@C3'] ntwprt = 204 nstlim = 500000 sim = Simulation() # Production for iteration in range(0, 20): sim.executable = 'pmemd.cuda' sim.path = './' sim.topology = 'solvate.prmtop' sim.restraint_file = 'disang.rest' sim.config_pbc_md() sim.prefix = 'prod.{:03d}'.format(iteration) if iteration == 0: sim.inpcrd = 'equil.rst7' else: sim.inpcrd = 'prod.{:03d}.rst7'.format(iteration - 1) sim.ref = 'solvate.rst7' sim.cntrl['ntx'] = 5 sim.cntrl['irest'] = 1 sim.cntrl['nstlim'] = nstlim sim.cntrl['ntwr'] = nstlim sim.cntrl['ntwx'] = 250 sim.cntrl['ntwprt'] = ntwprt sim.cntrl['ntxo'] = 2 sim.restraint_file = 'disang.rest' sim.run(fail_ok=False)
) logging.info("Started logging...") logging.info(paprika.__version__) hostname = sp.check_output(["hostname"]) nvidia_smi = sp.check_output(["nvidia-smi"]) logging.info(hostname.decode("utf-8")) logging.info(nvidia_smi.decode("utf-8")) nstlim = 500000 sim = Simulation() # Minimization sim.executable = "pmemd.cuda" sim.topology = "smirnoff.prmtop" sim.prefix = "minimize" sim.inpcrd = "smirnoff.inpcrd" sim.path = "./" sim.ref = "smirnoff.inpcrd" sim.config_pbc_min() sim.cntrl["maxcyc"] = 500 sim.cntrl["ncyc"] = 400 sim.cntrl["ntr"] = 1 sim.cntrl["restraint_wt"] = 50.0 sim.cntrl["restraintmask"] = "'@Pb'" sim.cntrl["cut"] = 9.0 sim.restraint_file = "disang.rest" sim.run(fail_ok=False) # Equilibration sim.config_pbc_md()
def test_amber_single_window_gbmin(clean_files): # Distance restraint restraint = restraints.DAT_restraint() restraint.continuous_apr = True restraint.amber_index = True restraint.topology = os.path.join( os.path.dirname(__file__), "../data/k-cl/k-cl.pdb" ) restraint.mask1 = ":K+" restraint.mask2 = ":Cl-" restraint.attach["target"] = 4.5 restraint.attach["fraction_list"] = [0.00, 0.04, 0.181, 0.496, 1.000] restraint.attach["fc_final"] = 5.0 restraint.pull["fc"] = restraint.attach["fc_final"] restraint.pull["target_initial"] = restraint.attach["target"] restraint.pull["target_final"] = 18.5 restraint.pull["num_windows"] = 5 restraint.initialize() windows_directory = os.path.join("tmp", "k-cl", "windows") window_list = create_window_list([restraint]) for window in window_list: os.makedirs(os.path.join(windows_directory, window)) with open( os.path.join(windows_directory, window, "restraints.in"), "a" ) as file: string = amber.amber_restraint_line(restraint, window) file.write(string) for window in window_list: if window[0] == "a": structure = pmd.load_file( os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl-sol.prmtop"), os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl-sol.rst7"), structure=True, ) for atom in structure.atoms: if atom.name == "Cl-": atom.xz = 2.65 structure.save( os.path.join(windows_directory, window, "k-cl.prmtop"), overwrite=True ) structure.save( os.path.join(windows_directory, window, "k-cl.rst7"), overwrite=True ) structure.save( os.path.join(windows_directory, window, "k-cl.pdb"), overwrite=True ) elif window[0] == "p": structure = pmd.load_file( os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl-sol.prmtop"), os.path.join(os.path.dirname(__file__), "../data/k-cl/k-cl-sol.rst7"), structure=True, ) target_difference = ( restraint.phase["pull"]["targets"][int(window[1:])] - restraint.phase["pull"]["targets"][0] ) for atom in structure.atoms: if atom.name == "Cl-": atom.xz += target_difference structure.save( os.path.join(windows_directory, window, "k-cl.prmtop"), overwrite=True ) structure.save( os.path.join(windows_directory, window, "k-cl.rst7"), overwrite=True ) structure.save( os.path.join(windows_directory, window, "k-cl.pdb"), overwrite=True ) gbsim = Simulation() gbsim.path = os.path.join("tmp", "k-cl", "windows", "a003") gbsim.executable = "sander" gbsim.topology = "k-cl.prmtop" gbsim.prefix = "minimize" gbsim.inpcrd = "k-cl.rst7" gbsim.config_gb_min() gbsim.cntrl["maxcyc"] = 1 gbsim.cntrl["ncyc"] = 1 gbsim.run() gbsim.config_gb_md() gbsim.prefix = "md" gbsim.inpcrd = "minimize.rst7" gbsim.cntrl["nstlim"] = 1 gbsim.cntrl["ntwe"] = 1 gbsim.cntrl["ntpr"] = 1 gbsim.cntrl["ig"] = 777 gbsim.run() mden = parse_mden(os.path.join("tmp", "k-cl", "windows", "a003", "md.mden")) assert pytest.approx(mden["Bond"][0]) == 0 assert pytest.approx(mden["Angle"][0]) == 0 assert pytest.approx(mden["Dihedral"][0]) == 0 assert pytest.approx(mden["V14"][0]) == 0 assert pytest.approx(mden["E14"][0]) == 0 assert pytest.approx(mden["VDW"][0], 0.1) == 25956.13225 assert pytest.approx(mden["Ele"][0], 0.1) == -18828.99631 assert pytest.approx(mden["Total"][0], 0.1) == 7127.13594