You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
hopefully this is the right place to ask about this,
I'm trying to understand how to use the openmm-tools library to do TI and solvate a glycine in water, but as soon as lambda is slightly low (0.8) the glycine coordinate explode all over the place. I seems like all intra-molecular forces are getting turned off rather than just electrostatics and LJ with the rest of the system ?
I've tried gradually turning down lambda during equilibration to see if that help but it doesn't, here's my code bellow
Thanks for the help
#always include at the top of simulationimportopenmm.appasappimportopenmmasmmimportopenmm.unitasunitimportosos.environ['JAX_ENABLE_X64'] ='1'#set JAX to 64bits by defaultimportopenmmtoolsastoolsfromopenmmtoolsimportintegratorsfromopenmmtoolsimportforces#still under construction, check for updates occasionallyfromopenmmtoolsimportalchemyfromsysimportstdoutfromtimeimportperf_counteraspfimportMDAnalysisasmdaimportnumpyasnpstart=pf()
pdb=app.PDBFile('ZGY_1p5nmPadWaterCube.pdb')
forcefield=app.ForceField('./amber99sb-ZGY-hack.xml','/home/leo/.conda/envs/openmmEnv/lib/python3.10/site-packages/openmm/app/data/tip3p.xml')
#forcefield = app.ForceField('/home/hall2401/ForceFields/amber99sb-ZGY-hack.xml','/home/hall2401/ForceFields/tip3p.xml')# System ConfigurationnonbondedMethod=app.PMEnonbondedCutoff=1.2*unit.nanometersewaldErrorTolerance=0.0005constraints=Nonelambda_value=0.8# Integration Optionsdt=0.0005*unit.picoseconds# 0.5 femtosecondstemperature=298*unit.kelvinfriction=1.0/unit.picosecondpressure=1.0*unit.atmospheresbarostatInterval=25# Simulation Optionssteps=20000#00 #1ns with the 0.5fs timestepequilibrationSteps=10000#000 #0.5ns equilibrationCPUplatform=mm.Platform.getPlatformByName('CPU')
GPUplatform=mm.Platform.getPlatformByName('CUDA')
GPUplatformProperties= {'Precision': 'single'}
pdbReporter=app.PDBReporter('trajectory-solvation_CONCGly_CONCNaCl_TEMP_LAMBDA_RUN0p1.pdb', 1000)
dataReporter=app.StateDataReporter('trajectory-solvation_CONCGly_CONCNaCl_TEMP_LAMBDA_RUN0p1.csv', 1000, totalSteps=steps,
step=True, speed=True, progress=True, potentialEnergy=True, temperature=True, separator=',')
checkpointReporter=app.CheckpointReporter('checkpoint-solvation_CONCGly_CONCNaCl_TEMP_LAMBDA_RUN0p1.chk', 10000)
# Create the systemprint('Building system...')
topology=pdb.topologypositions=pdb.positionssystem=forcefield.createSystem(topology=topology, nonbondedMethod=nonbondedMethod, nonbondedCutoff=nonbondedCutoff,
constraints=constraints, ewaldErrorTolerance=ewaldErrorTolerance)
#Get residue of interesttarget_residue_index=0# Index of the target glycine residuetarget_atoms= [atom.indexforatominpdb.topology.atoms() ifatom.residue.index==target_residue_index]
#create system where target atoms are alchemically modifiablealchemical_region=alchemy.AlchemicalRegion(alchemical_atoms=target_atoms)
factory=alchemy.AbsoluteAlchemicalFactory()
alchemical_system=factory.create_alchemical_system(system,alchemical_region)
integrator=integrators.LangevinIntegrator(temperature, friction, dt)
#integrator = mm.LangevinMiddleIntegrator(temperature, friction, dt)simulation=app.Simulation(topology, alchemical_system, integrator, GPUplatform, GPUplatformProperties)
simulation.context.setPositions(positions)
print("performing energy minimisation...")
simulation.minimizeEnergy()
simulation.context.setVelocitiesToTemperature(temperature)
print("equilibrating system...")
simulation.reporters.append(dataReporter)
simulation.step(equilibrationSteps)
print("applying alchemical transformation")
#apply the Lambda parametre to the systemalchemical_state=alchemy.AlchemicalState.from_system(alchemical_system)
alchemical_state.lambda_electrostatics=0.9alchemical_state.lambda_sterics=0.9#alchemical_state.set_alchemical_parameters(lambda_value)alchemical_state.apply_to_context(simulation.context)
print("equilibrating system again...")
#simulation.reporters.append(dataReporter)simulation.currentStep=0simulation.step(equilibrationSteps)
print("applying alchemical transformation")
#apply the Lambda parametre to the systemalchemical_state=alchemy.AlchemicalState.from_system(alchemical_system)
alchemical_state.lambda_electrostatics=lambda_valuealchemical_state.lambda_sterics=lambda_value#alchemical_state.set_alchemical_parameters(lambda_value)alchemical_state.apply_to_context(simulation.context)
# Simulateprint('Simulating...')
simulation.reporters.append(pdbReporter)
#simulation.reporters.append(dataReporter) #already added during equilibrationsimulation.reporters.append(checkpointReporter)
simulation.currentStep=0simulation.step(steps)
end=pf()
print('runtime (mn) = ',(end-start)/60)
The text was updated successfully, but these errors were encountered:
Hi all,
hopefully this is the right place to ask about this,
I'm trying to understand how to use the openmm-tools library to do TI and solvate a glycine in water, but as soon as lambda is slightly low (0.8) the glycine coordinate explode all over the place. I seems like all intra-molecular forces are getting turned off rather than just electrostatics and LJ with the rest of the system ?
I've tried gradually turning down lambda during equilibration to see if that help but it doesn't, here's my code bellow
Thanks for the help
The text was updated successfully, but these errors were encountered: