12
Tips for Designing a Tips for Designing a Good Simulation Good Simulation Project Project

Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Embed Size (px)

DESCRIPTION

Use the best settings / Avoid shortcuts for performance –Only simulate in a vacuum if you really want to reproduce results for your system in a vacuum! Explicit solvent –Always use PME! –Never make cut < 8.0A –Avoid use of NRESPA (multiple time stepping) –Initial Heat in NVT, Relaxation in NPT, Production in the ensemble you want to measure – suggest[NPT] –Use binary (netcdf) trajectories [ioutfm=1] –Use MonteCarlo Barostat [barostat=2] Implicit solvent –Do NOT use cut offs –Use a Langevin Thermostat for heating. –Production in NVE(NVT) Be sure to check conserved quantities –Total Energy (NVE) / Angular Momentum Designing Good Simulation Projects

Citation preview

Page 1: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Tips for Designing a Good Tips for Designing a Good Simulation ProjectSimulation Project

Page 2: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Designing Good Simulation ProjectsDesigning Good Simulation ProjectsWork incrementallyWork incrementally

– Do your literature homework.Do your literature homework.– Start with small model problems.Start with small model problems.– Reproduce literature results.Reproduce literature results.– Visualize early and often.Visualize early and often.– Expect to throw the first one away.Expect to throw the first one away.

Learn how to troubleshoot problemsLearn how to troubleshoot problems– DonDon’’t be afraid to experiment.t be afraid to experiment.– Demand internal consistency.Demand internal consistency.– Become familiar with the source code.Become familiar with the source code.

Devise your own analysisDevise your own analysis– Learn a plotting program like Xmgrace/Sigma plot well.Learn a plotting program like Xmgrace/Sigma plot well.– Learn a scripting language like Awk or Python.Learn a scripting language like Awk or Python.– Learn how to use Grep and Sed.Learn how to use Grep and Sed.– Learn statistics: time-correlation analysis, error propagation, Learn statistics: time-correlation analysis, error propagation,

linear and non-linear parameter estimation, noise filtering.linear and non-linear parameter estimation, noise filtering.

Page 3: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Use the best settings / Avoid shortcuts for performanceUse the best settings / Avoid shortcuts for performance– Only simulate in a vacuum if you really want to reproduce Only simulate in a vacuum if you really want to reproduce

results for your system in a vacuum!results for your system in a vacuum!Explicit solventExplicit solvent– Always use PME!Always use PME!– Never make cut < 8.0ANever make cut < 8.0A– Avoid use of NRESPAAvoid use of NRESPA

(multiple time stepping)(multiple time stepping)– Initial Heat in NVT, Relaxation in NPT, Production in the Initial Heat in NVT, Relaxation in NPT, Production in the

ensemble you want to measure – suggest[NPT]ensemble you want to measure – suggest[NPT]– Use binary (netcdf) trajectories [ioutfm=1]Use binary (netcdf) trajectories [ioutfm=1]– Use MonteCarlo Barostat [barostat=2]Use MonteCarlo Barostat [barostat=2]

Implicit solventImplicit solvent– Do NOT use cut offsDo NOT use cut offs– Use a Langevin Thermostat for heating.Use a Langevin Thermostat for heating.– Production in NVE(NVT)Production in NVE(NVT)

Be sure to check conserved quantitiesBe sure to check conserved quantities– Total Energy (NVE) / Angular MomentumTotal Energy (NVE) / Angular Momentum

Designing Good Simulation ProjectsDesigning Good Simulation Projects

Page 4: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

"Grass is green" syndrome"Grass is green" syndrome– Demand a good structural starting model.Demand a good structural starting model.– Try to incorporate just the essential features.Try to incorporate just the essential features.– Cultivate Cultivate ““hypothesis-drivenhypothesis-driven”” research. research.

"Power-house" theoretician syndrome"Power-house" theoretician syndrome– Avoid just reproducing what has already been measured.Avoid just reproducing what has already been measured.– Search for real collaborations.Search for real collaborations.– Avoid novelty for noveltyAvoid novelty for novelty’’s sake; size for sizes sake; size for size’’s sake.s sake.

Anecdotal resultsAnecdotal results– Plan to do more sampling than you think you will need to.Plan to do more sampling than you think you will need to.– Search for ways to use more than one starting structure.Search for ways to use more than one starting structure.– Check the validity of your parameters - NEVER trust Check the validity of your parameters - NEVER trust

Antechamber!Antechamber!

Avoiding Bad Simulation ProjectsAvoiding Bad Simulation Projects

Page 5: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Some Example Input FilesSome Example Input Files

Page 6: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Minimization 1Minimization 1MinimizationMinimization&cntrl&cntrl imin=1,imin=1, ! Minimization ! Minimization ntx=1, ntx=1, ! Read just coordinates ! Read just coordinates maxcyc=2000, ncyc=1000, ! 1000 steps SD, 1000 CGmaxcyc=2000, ncyc=1000, ! 1000 steps SD, 1000 CG ntc=1, ntf=1, ! No shake during minimizationntc=1, ntf=1, ! No shake during minimization ntb=1, ntp=0,ntb=1, ntp=0, ! Constant volume ! Constant volume ntpr=50,ntpr=50, ! Print to mdout every 50 steps ! Print to mdout every 50 steps cut=8.0,cut=8.0, ! 8 angstrom cutoff. ! 8 angstrom cutoff.//

Sometimes one can do a multi-stage minimization with restraints on some atoms – e.g. minimize just H, then everything.

mpirun –np 8 $AMBERHOME/bin/pmemd.MPI –O –i 01_min.in –o 01_min.out \ –p prmtop –c inpcrd -r 01_min.rst -inf 01_min.mdinfo

Page 7: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Relaxation 1 (50ps NVT)Relaxation 1 (50ps NVT)Relaxation 1Relaxation 1&cntrl&cntrl imin=0, ntx=1,imin=0, ntx=1, ! Run MD [imin=0]! Run MD [imin=0] ntb=1,cut=8.0,ntb=1,cut=8.0, ! NVT, 8 A cutoff! NVT, 8 A cutoff ntp=0,ntp=0, ! No barostat! No barostat ntc=2, ntf=2ntc=2, ntf=2 ! Shake on! Shake on ntt=3, gamma_ln=1.0,ntt=3, gamma_ln=1.0, ! Langevin Thermostat, 1.0ps! Langevin Thermostat, 1.0ps-1-1

tempi=0.0,tempi=0.0, ! Initial Temperature of 0K! Initial Temperature of 0K nstlim=25000, dt=0.002,! 25K steps x 2fs = 50psnstlim=25000, dt=0.002,! 25K steps x 2fs = 50ps iwrap=1,iwrap=1, ! Wrap coordinates to central box! Wrap coordinates to central box ioutfm=1,ioutfm=1, ! Write binary mdcrd! Write binary mdcrd ntpr=5000, ntwx=5000,ntpr=5000, ntwx=5000, ! Write to mdout and mdcrd every 5,000 steps! Write to mdout and mdcrd every 5,000 steps ntwr=50000, ntwr=50000, ! Write restart file every 50,000 steps! Write restart file every 50,000 steps ntr=1, restraint_wt=4.0,ntr=1, restraint_wt=4.0, ! Restrain backbone atoms with 4.0 KCal/Mol/A! Restrain backbone atoms with 4.0 KCal/Mol/A restraintmask='@CA,C,N',restraintmask='@CA,C,N', ig=-1,ig=-1, ! Use 'random' random number seed.! Use 'random' random number seed. nmropt=1,nmropt=1, ! Used to ramp temperature slowly! Used to ramp temperature slowly//&wt type='TEMP0', istep1=0, istep2=25000,value1=0.0, value2=50.0 /&wt type='TEMP0', istep1=0, istep2=25000,value1=0.0, value2=50.0 /

We start at 0K so calculation of pressure would be very inaccurate – so run a short NVT first

$AMBERHOME/bin/pmemd.CUDA –O –i 02_heat.in –o 02_heat.out –p prmtop –c 01_min.rst \-r 02_heat.rst –x 02_heat.nc -inf 02_heat.mdinfo –ref 01_min.rst

Page 8: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Relaxation 2 (NPT 1000ps)Relaxation 2 (NPT 1000ps)Relaxation 2Relaxation 2&cntrl&cntrl imin=0, imin=0, ntx=5, irest=1,ntx=5, irest=1, ! Read box and velocity info from inpcrd! Read box and velocity info from inpcrd ntb=2,ntb=2,cut=8.0, cut=8.0, ! NPT! NPT ntp=2, pres0=1.0,ntp=2, pres0=1.0, ! Anisotropic pressure scaling at 1 atm! Anisotropic pressure scaling at 1 atm barostat=2,barostat=2, ! Use MonteCarlo barostat! Use MonteCarlo barostat ntc=2,ntc=2, ntf=2, ntf=2, ntt=3, temp0=310.0, gamma_ln=1.0,ntt=3, temp0=310.0, gamma_ln=1.0, nstlim=500000nstlim=500000, dt=0.002,, dt=0.002, iwrap=1, ioutfm=1,iwrap=1, ioutfm=1, ntpr=5000, ntwr=50000, ntwx=5000, ntpr=5000, ntwr=50000, ntwx=5000, ntr=1, ntr=1, restraint_wt=1.0restraint_wt=1.0, restraintmask='@CA,C,N', ! Keep weak restraints on , restraintmask='@CA,C,N', ! Keep weak restraints on

backbonebackbone ig=-1,ig=-1, nmropt=1,nmropt=1,//&wt type='TEMP0', istep1=0, istep2=125000,value1=50.0, value2=310.0 /&wt type='TEMP0', istep1=0, istep2=125000,value1=50.0, value2=310.0 /&wt type='TEMP0', istep1=125001, istep2=500000,value1=310.0, value2=310.0 /&wt type='TEMP0', istep1=125001, istep2=500000,value1=310.0, value2=310.0 /

$AMBERHOME/bin/pmemd.CUDA –O –i 03_heat.in –o 03_heat.out –p prmtop –c 02_heat.rst \-r 03_heat.rst –x 03_heat.nc -inf 03_heat.mdinfo –ref 02_heat.rst

We heat from 50 to 310K over 250ps then hold at 310K for remaining 750ps

Page 9: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Relaxation 3 (NPT 1000ps)Relaxation 3 (NPT 1000ps)Relaxation 3Relaxation 3&cntrl&cntrl imin=0, imin=0, ntx=5, irest=1,ntx=5, irest=1, ntb=2ntb=2,,cut=8.0,cut=8.0, ntp=2, pres0=1.0ntp=2, pres0=1.0,, barostat=2,barostat=2, ntc=2,ntc=2, ntf=2, ntf=2, ntt=3, ntt=3, temp0=310.0temp0=310.0, gamma_ln=1.0,, gamma_ln=1.0, ! Thermostat temp = 310K! Thermostat temp = 310K nstlim=500000, dt=0.002,nstlim=500000, dt=0.002, iwrap=1, ioutfm=1,iwrap=1, ioutfm=1, ntpr=5000, ntwr=50000, ntwx=5000, ntpr=5000, ntwr=50000, ntwx=5000, ntr=0,ntr=0, ! Turn off restraints! Turn off restraints ig=-1,ig=-1,//

$AMBERHOME/bin/pmemd.CUDA –O –i 04_equil.in –o 04_heat.out –p prmtop –c 03_heat.rst \-r 04_equil.rst –x 04_heat.nc -inf 04_heat.mdinfo

Page 10: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Production (NPT 20ns chunks)Production (NPT 20ns chunks)ProductionProduction&cntrl&cntrl imin=0, imin=0, ntx=5, irest=1,ntx=5, irest=1, ntb=2ntb=2,,cut=8.0,cut=8.0, ntp=2, pres0=1.0ntp=2, pres0=1.0,, barostat=2,barostat=2, ntc=2,ntc=2, ntf=2, ntf=2, ntt=3, temp0=310.0, gamma_ln=1.0,ntt=3, temp0=310.0, gamma_ln=1.0, nstlim=10000000, dt=0.002,nstlim=10000000, dt=0.002, iwrap=1, ioutfm=1,iwrap=1, ioutfm=1, ntpr=5000, ntwr=50000, ntwx=5000, ntpr=5000, ntwr=50000, ntwx=5000, ntr=0, ig=-1,ntr=0, ig=-1,//

prevstep=$stepstep=$(( $step + 1))

while [ $step -le $max_step ]do $AMBERHOME/pmemd.cuda -O –i 20ns.in –p prmtop -c md_prod_$prevstep.rst \ -o md_prod_$step.out -r md_prod_$step.rst -x md_prod_$step.mdcrd -inf md_prod_$step.info prevstep=$(( $prevstep + 1)) step=$(( $step + 1))done

Page 11: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…

Verify Key PropertiesVerify Key Properties– VisualizeVisualize– RMSD, RMSF, TEMP, DENSITYRMSD, RMSF, TEMP, DENSITY

Check for ConvergenceCheck for Convergence– Throw half your data away, how does your prediction Throw half your data away, how does your prediction

change?change?– Consider plotting 'result' vs simulation time. E.g. calculate Consider plotting 'result' vs simulation time. E.g. calculate

binding energy using first 1000 points, 2000 points, 3000 binding energy using first 1000 points, 2000 points, 3000 points. Plot cumulative result.points. Plot cumulative result.

RepeatRepeat– Repeat the calculation from different starting structuresRepeat the calculation from different starting structures

Run 100ns run, take 10ns snapshots and use these for 10 additional Run 100ns run, take 10ns snapshots and use these for 10 additional runs.runs.

– Remember correlation /= causationRemember correlation /= causation

Check Your ResultsCheck Your Results

Page 12: Tips for Designing a Good Simulation Project. Designing Good Simulation Projects Work incrementally…