예제 #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_SolvationSystem():
    system, positions, topology, solute = readSystem(
        'hydroxyethylaminoanthraquinone-in-water')
    solvation_system = atomsmm.SolvationSystem(system, solute)
    state = dict(lambda_vdw=0.5, lambda_coul=0.5)
    components = atomsmm.splitPotentialEnergy(solvation_system, topology,
                                              positions, **state)
    potential = dict()
    potential['HarmonicBondForce'] = 1815.1848188179738
    potential['HarmonicAngleForce'] = 1111.5544374007236
    potential['PeriodicTorsionForce'] = 1.5998609986459567
    potential['Real-Space'] = 58273.35327317236
    potential['Reciprocal-Space'] = -76436.3982762784
    potential['CustomNonbondedForce'] = -64.67189605331785
    potential['Total'] = -15299.377781942014
    for term, value in components.items():
        assert value / value.unit == pytest.approx(potential[term])
예제 #3
0
def test_SolvationSystem_with_lj_parameter_scaling():
    system, positions, topology, solute = readSystem(
        'hydroxyethylaminoanthraquinone-in-water')
    solvation_system = atomsmm.SolvationSystem(system,
                                               solute,
                                               use_softcore=False)
    state = dict(lambda_vdw=0.5, lambda_coul=0.5)
    components = atomsmm.splitPotentialEnergy(solvation_system, topology,
                                              positions, **state)
    potential = dict()
    potential['HarmonicBondForce'] = 1815.1848188179738
    potential['HarmonicAngleForce'] = 1111.5544374007236
    potential['PeriodicTorsionForce'] = 1.5998609986459567
    potential['Real-Space'] = 58235.03496195241
    potential['Reciprocal-Space'] = -76436.3982762784
    potential['Total'] = -15273.024197108643
    for term, value in components.items():
        assert value / value.unit == pytest.approx(potential[term])
예제 #4
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])
예제 #5
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])
solute_atoms = set(i for (i, name) in enumerate(residues) if name == 'aaa')

forcefield = app.ForceField(f'{base}.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(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]
예제 #7
0
forcefield = app.ForceField(f'{base}.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(True)

solvation_system = atomsmm.SolvationSystem(openmm_system,
                                           solute_atoms,
                                           use_softcore=True,
                                           softcore_group=1,
                                           split_exceptions=True)

if args.timestep <= 3:
    respa_system = solvation_system
    for force in solvation_system.getForces():
        if isinstance(force, openmm.NonbondedForce):
            force.setReciprocalSpaceForceGroup(1)
            force.setForceGroup(1)
    loops = [2 * args.timestep, 1]
else:
    respa_system = atomsmm.RESPASystem(solvation_system,
                                       rcutIn,
                                       rswitchIn,
                                       fastExceptions=True)
예제 #8
0
solute_atoms = set(i for (i, name) in enumerate(residues) if name == 'aaa')

forcefield = app.ForceField(f'{base}.xml')

openmm_system = forcefield.createSystem(pdb.topology,
                                        nonbondedMethod=openmm.app.PME,
                                        nonbondedCutoff=rcut,
                                        rigidWater=True,
                                        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)

if barostatInterval > 0:
    barostat = openmm.MonteCarloBarostat(1*unit.atmospheres, temp, barostatInterval)
    solvation_system.addForce(barostat)

integrator = openmm.LangevinIntegrator(temp, 1.0/unit.picoseconds, dt)

simulation = openmm.app.Simulation(pdb.topology, solvation_system, integrator, platform, properties)
simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(temp)

states_data = pd.read_csv(f'{base}.states', sep='\s+', comment='#')
parameterStates = states_data[['lambda_vdw', 'lambda_coul']]
simulate = states_data['simulate']
for state in reversed(states_data.index):