Пример #1
0
def test_RESPASystem_with_exception_offsets():
    system, positions, topology, solute = readSystem(
        'hydroxyethylaminoanthraquinone-in-water')
    respa_info = dict(rcutIn=7 * unit.angstroms, rswitchIn=5 * unit.angstroms)
    solvation_system = atomsmm.SolvationSystem(system, solute)
    nbforce = solvation_system.getForce(
        atomsmm.findNonbondedForce(solvation_system))
    for index in range(nbforce.getNumExceptions()):
        i, j, chargeprod, sigma, epsilon = nbforce.getExceptionParameters(
            index)
        nbforce.setExceptionParameters(index, i, j, 0.0, sigma, epsilon)
        nbforce.addExceptionParameterOffset('lambda_coul', index, chargeprod,
                                            0.0, 0.0)
    respa_system = atomsmm.RESPASystem(solvation_system, *respa_info.values())
    state = dict(lambda_vdw=0.5, lambda_coul=0.5)
    components = atomsmm.splitPotentialEnergy(respa_system, topology,
                                              positions, **state)
    potential = dict()
    potential['HarmonicBondForce'] = 1815.1848188179738
    potential['HarmonicAngleForce'] = 1111.5544374007236
    potential['PeriodicTorsionForce'] = 1.5998609986459567
    potential['Real-Space'] = 58201.09912379701
    potential['Reciprocal-Space'] = -76436.3982762784
    potential['CustomNonbondedForce'] = -64.67189605331785
    potential['CustomNonbondedForce(1)'] = -17294.836032921234
    potential['CustomNonbondedForce(2)'] = 17294.836032921194
    potential['CustomBondForce'] = 72.25414937535754
    potential['Total'] = -15299.377781942048
    for term, value in components.items():
        assert value / value.unit == pytest.approx(potential[term])
Пример #2
0
def test_RESPASystem_with_special_bonds():
    system, positions, topology, solute = readSystem('q-SPC-FW')
    respa_info = dict(rcutIn=7 * unit.angstroms, rswitchIn=5 * unit.angstroms)
    respa_system = atomsmm.RESPASystem(system, *respa_info.values())
    respa_system.redefine_bond(topology, 'HOH', 'H[1-2]', 'O',
                               1.05 * unit.angstroms)
    respa_system.redefine_angle(topology, 'HOH', 'H[1-2]', 'O', 'H[1-2]',
                                113 * unit.degrees)
    components = atomsmm.splitPotentialEnergy(respa_system, topology,
                                              positions)
    potential = dict()
    potential['HarmonicBondForce'] = 3665.684696323676
    potential['HarmonicAngleForce'] = 1811.197218501007
    potential['PeriodicTorsionForce'] = 0.0
    potential['Real-Space'] = 84694.39953220935
    potential['Reciprocal-Space'] = -111582.71281220087
    potential['CustomNonbondedForce'] = -25531.129587235544
    potential['CustomNonbondedForce(1)'] = 25531.129587235544
    potential['CustomBondForce'] = 0.0
    potential['CustomBondForce(1)'] = -1175.253817235862
    potential['CustomAngleForce'] = -305.0221912655623
    potential['Total'] = -22891.707373668243
    for term, value in components.items():
        print(term, value)
        assert value / value.unit == pytest.approx(potential[term])
Пример #3
0
def test_RESPASystem():
    system, positions, topology, solute = readSystem(
        'hydroxyethylaminoanthraquinone-in-water')
    respa_info = dict(rcutIn=7 * unit.angstroms, rswitchIn=5 * unit.angstroms)
    solvation_system = atomsmm.SolvationSystem(system, solute)
    respa_system = atomsmm.RESPASystem(solvation_system, *respa_info.values())
    state = dict(lambda_vdw=0.5, lambda_coul=0.5)
    components = atomsmm.splitPotentialEnergy(respa_system, topology,
                                              positions, **state)
    potential = dict()
    potential['HarmonicBondForce'] = 1815.1848188179738
    potential['HarmonicAngleForce'] = 1111.5544374007236
    potential['PeriodicTorsionForce'] = 1.5998609986459567
    potential['Real-Space'] = 58161.10011792888
    potential['Reciprocal-Space'] = -76436.3982762784
    potential['CustomNonbondedForce'] = -64.67189605331785
    potential['CustomNonbondedForce(1)'] = -17294.836032921234
    potential['CustomNonbondedForce(2)'] = 17294.836032921194
    potential['CustomBondForce'] = 112.25315524350334
    potential['Total'] = -15299.377781942032
    for term, value in components.items():
        assert value / value.unit == pytest.approx(potential[term])
Пример #4
0
def test_RESPASystem_with_lj_parameter_scaling():
    system, positions, topology, solute = readSystem(
        'hydroxyethylaminoanthraquinone-in-water')
    respa_info = dict(rcutIn=7 * unit.angstroms, rswitchIn=5 * unit.angstroms)
    solvation_system = atomsmm.SolvationSystem(system,
                                               solute,
                                               use_softcore=False)
    respa_system = atomsmm.RESPASystem(solvation_system, *respa_info.values())
    state = dict(lambda_vdw=0.5, lambda_coul=0.5)
    components = atomsmm.splitPotentialEnergy(respa_system, topology,
                                              positions, **state)
    potential = dict()
    potential['HarmonicBondForce'] = 1815.1848188179738
    potential['HarmonicAngleForce'] = 1111.5544374007236
    potential['PeriodicTorsionForce'] = 1.5998609986459567
    potential['Real-Space'] = 58122.78180670893
    potential['Reciprocal-Space'] = -76436.3982762784
    potential['CustomNonbondedForce'] = -17317.054135213173
    potential['CustomNonbondedForce(1)'] = 17317.054135213126
    potential['CustomBondForce'] = 112.25315524350334
    potential['Total'] = -15273.024197108669
    for term, value in components.items():
        assert value / value.unit == pytest.approx(potential[term])
                                        rigidWater=False,
                                        removeCMMotion=False)

nbforce = openmm_system.getForce(atomsmm.findNonbondedForce(openmm_system))
nbforce.setUseSwitchingFunction(True)
nbforce.setSwitchingDistance(rswitch)
nbforce.setUseDispersionCorrection(True)

solvation_system = atomsmm.SolvationSystem(openmm_system,
                                           solute_atoms,
                                           use_softcore=False,
                                           split_exceptions=False)

if args.timestep > 3:
    respa_system = atomsmm.RESPASystem(solvation_system,
                                       rcutIn,
                                       rswitchIn,
                                       fastExceptions=True)
    loops = [6, args.timestep // 3, 1]
else:
    respa_system = solvation_system
    for force in respa_system.getForces():
        if isinstance(force, openmm.NonbondedForce):
            force.setReciprocalSpaceForceGroup(1)
            force.setForceGroup(1)
    loops = [2 * args.timestep, 1]

if method == 'Langevin':
    integrator = atomsmm.integrators.Langevin_R_Integrator(dt,
                                                           loops,
                                                           temp,
                                                           gamma,
Пример #6
0
pdb = app.PDBFile('water.pdb')
forcefield = app.ForceField('water.xml')
openmm_system = forcefield.createSystem(pdb.topology,
                                        nonbondedMethod=openmm.app.PME,
                                        nonbondedCutoff=rcut,
                                        rigidWater=False,
                                        removeCMMotion=False)

nbforce = openmm_system.getForce(atomsmm.findNonbondedForce(openmm_system))
nbforce.setUseSwitchingFunction(True)
nbforce.setSwitchingDistance(rswitch)
nbforce.setUseDispersionCorrection(False)

if args.timestep > 3:
    respa_system = atomsmm.RESPASystem(openmm_system,
                                       rcutIn,
                                       rswitchIn,
                                       fastExceptions=False)
    loops = [6, args.timestep // 3, 1]
else:
    respa_system = openmm_system
    for force in respa_system.getForces():
        if isinstance(force, openmm.NonbondedForce):
            force.setReciprocalSpaceForceGroup(1)
            force.setForceGroup(1)
    loops = [2 * args.timestep, 1]

integrator = atomsmm.integrators.Langevin_R_Integrator(dt,
                                                       loops,
                                                       temp,
                                                       gamma,
                                                       has_memory=True)