def test_gromacs(): g = Gromacs() if g.command is None: raise unittest.SkipTest(getattr(g, "missing_gmx", "missing gromacs")) GRO_INIT_FILE = 'hise_box.gro' # write structure file with open(GRO_INIT_FILE, 'w') as outfile: outfile.write(data) CALC_MM_RELAX = Gromacs(force_field='charmm27', define='-DFLEXIBLE', integrator='cg', nsteps='10000', nstfout='10', nstlog='10', nstenergy='10', nstlist='10', ns_type='grid', pbc='xyz', rlist='0.7', coulombtype='PME-Switch', rcoulomb='0.6', vdwtype='shift', rvdw='0.6', rvdw_switch='0.55', DispCorr='Ener') CALC_MM_RELAX.set_own_params_runs('init_structure', GRO_INIT_FILE) CALC_MM_RELAX.generate_topology_and_g96file() CALC_MM_RELAX.write_input() CALC_MM_RELAX.generate_gromacs_run_file() CALC_MM_RELAX.run() atoms = CALC_MM_RELAX.get_atoms() final_energy = CALC_MM_RELAX.get_potential_energy(atoms) # e.g., -4.17570101 eV = -402.893902 kJ / mol by Gromacs 2019.1 double precision final_energy_ref = -4.175 tolerance = 0.010 assert abs(final_energy - final_energy_ref) < tolerance
CALC_MM_RELAX = Gromacs(force_field='charmm27', define='-DFLEXIBLE', integrator='cg', nsteps='10000', nstfout='10', nstlog='10', nstenergy='10', nstlist='10', ns_type='grid', pbc='xyz', rlist='0.7', coulombtype='PME-Switch', rcoulomb='0.6', vdwtype='shift', rvdw='0.6', rvdw_switch='0.55', DispCorr='Ener') CALC_MM_RELAX.set_own_params_runs('init_structure', GRO_INIT_FILE) CALC_MM_RELAX.generate_topology_and_g96file() CALC_MM_RELAX.write_input() CALC_MM_RELAX.generate_gromacs_run_file() CALC_MM_RELAX.run() atoms = CALC_MM_RELAX.get_atoms() final_energy = CALC_MM_RELAX.get_potential_energy(atoms) # e.g., -4.17570101 eV = -402.893902 kJ / mol by Gromacs 2019.1 double precision final_energy_ref = -4.175 tolerance = 0.010 assert abs(final_energy - final_energy_ref) < tolerance
outfile.close() CALC_MM_RELAX = Gromacs(force_field='charmm27', define = '-DFLEXIBLE', integrator = 'cg', nsteps = '10000', nstfout = '10', nstlog = '10', nstenergy = '10', nstlist = '10', ns_type = 'grid', pbc = 'xyz', rlist = '0.7', coulombtype = 'PME-Switch', rcoulomb = '0.6', vdwtype = 'shift', rvdw = '0.6', rvdw_switch = '0.55', DispCorr = 'Ener') CALC_MM_RELAX.set_own_params_runs( 'init_structure', 'hise_box.gro') CALC_MM_RELAX.generate_topology_and_g96file() CALC_MM_RELAX.write_input() CALC_MM_RELAX.generate_gromacs_run_file() CALC_MM_RELAX.run() atoms = CALC_MM_RELAX.get_atoms() final_energy = CALC_MM_RELAX.get_potential_energy(atoms) assert abs(final_energy + 4.06503308131) < 5e-3