Sampling Methods 1 - jacobsonlab.orgjacobsonlab.org/biophys206/biophys206_sampling1_2008.pdf•...

Post on 15-Jul-2020

0 views 0 download

Transcript of Sampling Methods 1 - jacobsonlab.orgjacobsonlab.org/biophys206/biophys206_sampling1_2008.pdf•...

Sampling Methods 1

Why do we need sampling methods?• Large number of degrees of freedom

– Many states that could be populated

• Limited separation of energy scales– Many different states with similar energy

• Biological processes occur at finite temperature, pressure, pH, etc.– Not always in the energy minimum

• Entropy often plays a role– Side chain disorder, normal modes, chain entropy– Solvent and counterion entropy

• Need a way to generate a distributionof conformations representative of the ensemble of interest– Can evaluate ensemble average properties, relative free

energies– Can be analyzed to suggest mechanistic hypotheses

Increasing length and time scales

Incr

easin

g ac

cura

cy

Importance sampling

One of the FBI’s Ten Most Wanted in 1950. When asked why he robbed banks, Sutton simply replied, "Because that's where the money is."(from www.fbi.gov)

• Want to sample from a complex, high-dimensional distribution function (f(r ,p))

• Domain may be very, very large

• May not be normalized

• Try to concentrate work in regions that contribute significantly to the integral

∫ ∫∫ ∫

=),(

),( ),(prH

prH

dredp

prAdredpA

β

β

∫ ∫∫ ∫=

),(

),(),(

prdrfdp

prAprdrfdpA

3 main classes of sampling methods

• Enumeration– Try to explicitly generate all low-energy states– Grid search, branch and bound, “mining minima”

• Monte Carlo– Generate new states by random moves & accept/reject

them based on criteria that produce the distribution of interest

• Physical Simulation/”Molecular Dynamics”– Generate new states by directly simulating the physical

motions of a model of the system from the positions, velocities, and forces

Ergodic hypothesis• An ensemble average (over many copies of

the system) can be replaced by a time average for a single copy of the system

( ){ }( )

∞→= ∫

t

dttrAtt

A0

1lim

=time →

Correlated data and uncertainty• Both MD and MC simulations produce a correlatedseries of N

conformations– Successive structures are similar

• How many independentsamples (Ns) do we have?– Needed for statistical uncertainty

• Correlation function analysis – Estimate a correlation time (tcorr) as the integral of a time correlation:

– Number of samples = tsim/tcorr

• Jack-knife– Repeatedly average pairs (then pairs of pairs, etc.) of data points &

calculate the new variance– Estimate the true variance as the “plateau” value

( )( ) ( )( )AttAAtAtC −∆+−=∆ )(

∑=

=N

iiA

NA

1

1s

AA N

Aσσδ == ( )∑

=

−−

=N

iiA AA

N 1

2

1

0

0.25

0.5

0.75

1

0 5 10 15 20

11 Steady-state fluid dyn.

10 Fluid dynamics

9 Reactive Fluid dyn.

8 Mesoscopic dynamics

7 Brownian dynamics

6 Simple Langevin

5 Generalized Langevin

4 Molecular dynamics

3 Atomic quantum dyn.

2 Quantum dynamics

1 Relativistic quantum dyn.

Adapted from “Simulating the Physical World”, H.J.C. Berendsen, Cambridge Univ. Press, 2007

“level”

velocity profile

turbulence

combustion

phase separation

macromol. diffusion

solvent friction+noise

subsystem/coarse-grain

protein motions

proton transfer

electron transfer

fast electrons

physical phenomenon

simplified fluid

Newtonian fluid

fluid mixture

densities/fields

macromolecules

continuum solvent

monomers

classical atoms

quantized atoms

atoms+electrons

atoms+electrons

simulation basis

11 Steady-state fluid dyn.

10 Fluid dynamics

9 Reactive Fluid dyn.

8 Mesoscopic dynamics

7 Brownian dynamics

6 Simple Langevin

5 Generalized Langevin

4 Molecular dynamics

3 Atomic quantum dyn.

2 Quantum dynamics

1 Relativistic quantum dyn.

“level”

Baumgart, et al Nature 2003

Mark Tuckerman, NYUhttp://homepages.nyu.edu/~mt33

lung airflow pressurefrom www.nbib.nih.gov

photosystem I electron xferFrom spin.niddk.nih.gov

polymer collapse dynamicsGavin Crooks, LBLhttp://threeplusone.com

Roles of simulation in biology

• Tool for interpreting experiment– Refinement of x-ray, NMR, other data to yield 3-D

structure– Providing models for motion/dynamical processes used

to interpret experiments

• Prediction– Binding affinity (protein-ligand, protein-protein)– Protein structure prediction

• Complement to experiment– Provide microscopic insights that lead to hypotheses– Allow “mutations” or “perturbations” that would be

difficult or impossible (or $$!) experimentally

Physical Simulation – lambda repressor example

• Temperature dependence of secondary structure

• Color code: red α-helix, blue β-sheet, white turn, green PPII/coil, purple 310-helix, yellow π-helix

• Clearly shows separate transitions for H1&4, H2&3, H5

• ⇒Does thermodynamics imply kinetics?

folded

H5

H2H3

H4

H1

• Kinetic trajectories showing temporal behavior

• Spontaneous formation of helical secondary structures

• Occurs near correct (native helix) locations

• Force fields/simulations are capturing sequence dependence of secondary structure

folded

folded

Molecular Dynamics

Definitions

• Molecular dynamics (MD): integration of Newton’s equations of motion for a molecular system

• Position r i, momentum pi (= mivi)dr i/dt = vi = pi/mi

dpi/dt = f i

ai = f i/mi dvi/dt = ai

• Starting from initial positions and velocities for a system of particles, follow their movement as a function of time

Motivation

• Why MD?– Time-dependent properties (kinetics)

– Ensemble averages (thermodynamics)

• No really, why MD?– Time-dependent properties

• Transport

• Conformational change

– Cases where the path between states is of interest

– Systems where efficient MC moves are not available

A simple example• Particle in a 1-d harmonic potential

• MD is fundamentally conservative

• H (= K + U) is a constant of the motion

time

E

r=rov=0K=0U=EH=EF>0

r=0v=(2E/m)1/2

K=EU=0H=EF=0

r=0v=-(2E/m)1/2

K=EU=0H=EF=0

r=rov=0K=0U=EH=EF>0

r=-rov=0K=0U=EH=EF<0

Integrators

Definitions – a reminder

r (t),{ r (t)} = positions at time t

v(t) = dr (t)/dt = velocities at time t

a(t) = dv(t)/dt = d2r (t)/dt2

= accelerations at time twe get a(t) from forces f(t) & classical mechanics (f = ma)

a(t) = f(t)/mr(t) v(t) a(t)

What makes a “good” integrator?• Formal

– Time-reversible: reversing the velocities at time t and integrating backwards should return us to the t=0 state

– Symplectic: integrator does not effectively distort or deform phase space

• Practical– Long-time drift: conserved quantity is stable over many

integration steps– Stability at large time steps

• Economical– CPU time per iteration– Memory per iteration

Verlet family

• Verlet (position Verlet), leapfrog, velocity Verlet

• All derived from adding and subtracting Taylor series expansions of r(t)

• Algebraically equivalent– Produce identical position trajectories– Not practically equivalent in some cases

(constraints, constant pressure)

position VerletExpressed in terms of positions and accelerations;

velocities do not appear explicitly

r(t+dt)= r(t) +dt*dr(t)/dt + ½ dt2*d2r(t)/dt2 + . . .r(t-dt) = r(t) –dt*dr(t)/dt + ½ dt2*d2r(t)/dt2 - . . .

r(t+dt)= r(t) +dt*v(t) + ½ dt2*a(t) + . . .r(t-dt) = r(t) –dt*v(t) + ½ dt2*a(t) - . . .

r(t+dt)+r(t-dt)= r(t) +dt*v(t) + ½ dt2*a(t) + (r(t) –dt*v(t) + ½ dt2*a(t))

r(t+dt)= 2*r(t) –r(t-dt) + dt2*a(t)

r(t) a(t)

r(t+dt)

r(t-dt)

leap-frogExpressed in terms of positions, half-step velocities, and accelerations

r(t+dt)= r(t) +dt*v(t) + ½ dt2*a(t) + . . .r(t-dt) = r(t) –dt*v(t) + ½ dt2*a(t) - . . .

v(t+dt/2)= v(t)+ ½ dt*a(t)

r(t+dt)= r(t) + dt*v(t+dt/2)r(t-dt)= r(t) – dt*v(t-dt/2)

r(t+dt) + r(t-dt) = r(t) +dt*v(t+dt/2)+ (r(t) –dt*v(t-dt/2))r(t+dt)= 2*r(t) –r(t-dt) + dt2*a(t)

In practice:v(t+dt/2)= v(t-dt/2)+ dt*a(t)r(t+dt) = r(t) + dt*v(t+dt/2)v(t) = ½ (v(t-dt/2) + v(t+dt/2))

r(t) a(t)

v(t+dt/2)

r(t+dt) a(t+dt)

v(t-dt/2)

velocity Verlet

Expressed in terms of positions, velocities and accelerations; velocities and positions concurrent

r(t+dt)= r(t) +dt*v(t) + ½ dt2*a(t) + . . .r(t) = r(t+dt) –dt*v(t+dt) + ½ dt2*a(t+dt) - . . .

dt*v(t+dt) + ½ dt2*a(t+dt) = dt*v(t) + ½ dt2*a(t)v(t+dt) = v(t) + ½ dt*a(t) + ½ dt*a(t+dt)

In practice:v(t+dt/2) = v(t) + ½ dt*a(t)r(t+dt) = r(t) + dt*v(t+dt/2)v(t+dt) = v(t+dt/2)+ ½ dt*a(t+dt)

r(t) v(t) a(t)

v(t+dt/2)

r(t+dt) a(t+dt)v(t+dt)

Other integrators

• predictor-corrector– Again, Taylor expansion to predict r,v,a(t+dt) from

r,v,a(t)

– Compare predicted and actual accelerations at t+dt –use the difference to “correct” r,v,a(t+dt)

– Better local accuracy than Verlet but worse long-term drift

• many more, typically used for different “classes” of differential equations – e.g. astrophysics– Choice driven by the nature of the material being

simulated and the corresponding forces

multiple timestep approaches• Ad hoc variants have been around for a while

• Formal basis established by Martyna, Berne, Trotter, et. al. (“RESPA”)

• Separate forces into slowly (fs(t)) and rapidly-varying (fr(t))

• Integration like velocity Verlet

• Fast forces updated, applied every inner timestep; slow forces updated every N*dt and scaled up by N

• Compute-efficient if fast forces are cheap & slow forces expensive

• Can have multiple “levels” – slow, medium, fast, etc.

• Not always straightforward to separate forces

timedt

N*dt

N*f s(0)

fr(dt)fr(0)

A word about timesteps. . .

• Timestep size is limited by the fastest motion you want to integrate

• Rule of thumb: timestep should be ≤ 1/10th the period of the fastest harmonic oscillator

– O-H stretch ~ 3300-3600 cm-1

Period is ~10 fs

– Carbonyl C=O ~ 1700 cm-1

Period is ~20 fs

• MD and MC will only agree in the limit of infinitely small timesteps

Force evaluation

Force/Potential evaluation

• For a given {r }, calculate:– Total energy of the system

– Forces on all particles

• Core of any MD/MC program– >90% of computer time spent on force evaluations

– Region that needs the most tuning, software engineering & parallelization

• Structured somewhat differently for MD vs. MC, but basic ideas are the same

The potential• Sum of N-body terms

– Bonds, angles, dihedrals, van der Waals, electrostatics

• Two major classes of terms:– Bonded: arise from covalent structure of molecules

• Local, static, extensive/order N

– Nonbonded: arise from intermolecular interactions• Nonlocal, dynamic, order N2

• Nonbonded forces dominate calculation time, even if they are finite-ranged– Water bonded forces: 2 bonds, 1 angle– 9 Angstrom cutoff: 1 water interacts with ~100 other

waters• 4/3π(9A)3 = 3052 A3 * 0.033 waters/A3 = 100.7 waters

Forces

F(r ) = -∇rU({ r })

Most terms in U({r }) are functions of |r ij| = |r j – r i|

Fij = force on j due to i = -Fji

Fij = -(dU/d|r ij|)(r ij/|r ij|)

Ulj = 4ε((σ12/r ij12) – (σ6/r ij

6))

Flj = 4ε(12(σ12/r ij13) - 6(σ6/r ij

7))(r ij/|r ij|)

-1

0

1

2

3

4

5

0 0.5 1 1.5 2 2.5

distance (σ)

ene

rgy

Torsional forces

Generally represented as a Fourier series:

Utors = Σ ck cosk(φ)

Fa = torsional force on particle a

Fa = -∇a(Σ ck cosk(φ))

Fa = -Σ (kck cosk-1(φ))(∇acos(φ))

cos(φ) = -((AB×BC)•(BC×CD))/(|AB×BC||BC×CD|)

BA

A

B

C

D

φ

Evaluation of nonbonded forces• Worst case = order N2

– Calculate the interaction of every particle with every other particle

• Some nonbonded terms are short-ranged– Lennard-Jones vdW energy is 0.4% of minimum at

|r ij|=2.5 σ– Force is even smaller. . .– LJ typically truncated between 2.5 and 4 σ

• Short-ranged nonbonded terms are ~order N– Still need to keep track of which molecules are within

the interaction distance

• Long-range nonbonded terms = electrostatic interactions– Decay as r-1 (charges) or r-3 (dipoles)

Verlet lists/Pairlists• For each molecule i, list of the molecules j (j>i)

near i that might interact with it• Verlet neighborhood is larger than the cutoff by a

buffer region (typically 1-2 A)• At every timestep, evaluate nonbonded interaction

between i and all molecules in its pairlist– Some interactions will be zero

• Update rules:– Periodic: update the list every N timesteps– Heuristic: update the list if any particle has moved half

the buffer distance since the last update

• Simple list build is still O(N2), can be mitigated by grid-based techniques and other geometric heuristics – benefits are system size dependent.

Verlet lists/Pairlists – a diagram

• Red: Particle i

• Green: Particles j > i

• Blue: range of LJ interaction (cutoff)

• Dashed line: range of pairlist

Force/Potential: MD vs MC

• MD: need forces on every atom at every timestep to generate new positions– Energy is not strictly necessary

• MC: need energy of trial conformation relative to current conformation to accept/reject new positions– Forces are not necessary– Don’t need to recalculate full U({r }) at every move –

only parts that have changed

Ensembles

Some MD Ensembles

• Microcanonical (N,V,E)• Canonical (N,V,T)• Isobaric-isoenthalpic (N,P,H)• Isobaric-isothermal (N,P,T)• Grand canonical (µ,V,T)• Isokinetic (N,V,KE)• More. . .• In all cases there is a conserved quantity – a

constant of the motion

MD Ensembles II• Normal “state of affairs” in MD is microcanonical

(NVE)• Sampling from other ensembles requires either:

– Generating a collection of NVE trajectories that are themselves properly distributed in the ensemble of interest (i.e. represent the distribution of E sampled at constant T)

– Or extending the equations of motion to include additional dynamics in the conjugate variables that reproduce the correct distribution

• Often described as thermostats (to impose T) or barostats (to impose P)

Instantaneous and average quantities

• Ensembles defined by intensive variables (µ,P,T) are different– Imply an averagevalue for the chemical

potential, pressure, or temperature of the system

• Contrast with extensive variables (N,V,E)– Imply a specificvalue for the variable in

question– Expressed in statistical mechanical partition

functions as delta functions

A word about temperature

• Constant temperature simulation = attempt to model a subsystem (the simulation) in contact with a heat bath– Heat normally exchanged across the

interface between subsystem & bath– We have disposed of that interface!

• Heat flows into & out of simulation by nonphysical manipulations of particle velocities– All thermostats modify kinetic properties to

a greater or lesser extent

bath

subsystem

old and newvelocities

A word about pressure

P = -<∂ A/∂V>N,T

A = U + K

P = -<∂ U/∂V>N,T-<∂ K/∂V>N,T

P = NkT/V + V-1 <vir({ r })> NT

Introduce an instantaneous pressure p

p = 2/3 V-1K + V-1 vir({ r })

Atomic, fragment & molecular virial

• Virial = -∂U(r (V),V)/ ∂V• Different ways to make r dependent

on V– different ways to scale the coordinates

as the volume changes– Each choice means different terms in U

contribute to the virial

Atomic: r = V1/3sFragment: r = (r -r com,f) + V1/3scom,f

Molecule: r = (r -r com,m) + V1/3scom,m

• Each method also implies a different KE is used to define the instantaneous pressure (KE of scaled sites)

atomic

scalin

g

fragment scaling

molecule scaling

Expressions for the virial

For simple atom-based scaling, virial term is <∂ U/∂V>N,T = (3V)-1<Σr i•f i><∂ U/∂V>N,T = (3V)-1<Σr ij•f ij>

i,j are indices of atoms

For molecule-based scaling, virial term is<∂ U/∂V>N,T = (3V)-1<Σrm•fm><∂ U/∂V>N,T = (3V)-1<Σrmn•fmn>

m,n are indices of molecules

Thermostats and barostats

• One fundamental choice: stochastic or dynamical• Stochastic: microcanonical MD interrupted by

stochastic moves that sample V or T (or N) from appropriate distribution– Andersen thermostat– Volume MC

• Dynamical: conjugate variables explicitly simulated with forces and velocities– Called “extended system” or “extended Lagrangian”

methods– Andersen barostat, etc. (Parrinello-Rahman, etc.)– Nose’ thermostat, etc. (Nose’-Hoover, N-H chains)

• Examples of stochastic and dynamical approaches to sampling from the ensemble where <A> = A

P(A)

A A

timesteps

Andersen thermostat• periodically reassign velocities from a Maxwell-

Boltzmann distribution• Two regimes:

– rate form: at every timestep, every atom/molecule has a fixed probability of being resampled

– “massive collisions”: every N timesteps, all particle velocities are resampled

• phases between collisions are microcanonical• energy can be “redistributed” • collision frequency can affect rate of movement

through phase space• still possible to construct a conserved quantity

Nose’-Hoover thermostat• Introduce an additional fictitious degree of

freedom – “s”

• “s” scales the momenta of all particles up or down p’ = p/s

• “s” has an associated mass and velocity

• Equations of motion for s are defined such that { r ,p’} sample a canonical distribution

• Single-particle heat bath

s

Thermostat comparison• Simple 1-D harmonic oscillator

• Microcanonical trajectory = closed curve in r,v

• Simple Nose’-Hoover thermostat cannot produce the canonical distribution for a simple harmonic oscillator

• Andersen works OK, so do Nose’-Hoover chains (Martyna, et al)

-3 -2 -1 0 1 2 3

position

-3

-2

-1

0

1

2

3

velo

city

Andersen

-3 -2 -1 0 1 2 3

position

-3

-2

-1

0

1

2

3

velo

city

Nose'-Hoover

-3 -2 -1 0 1 2 3

position

-3

-2

-1

0

1

2

3

velo

city

microcanonical

Volume MC barostat

• Stochastic, like Andersen thermostat• Occasionally consider MC trial moves that

increase or decrease the simulation volume by a random amount (Vo + ∆V = Vt)

• Evaluate energy at new volume• Accept/reject move with trial probability

– P(accept) = e-β(∆E + P∆V + N/β ln(Vt/Vo))

• ln(Vt/Vo) term comes from additional intrinsic entropy of the state with larger volume

Andersen barostat• Dynamical variables are positions (r), velocities

(v), volume (Q), volume velocity (dQ/dt)• Crude analogy: piston• force on the volume is proportional to the

difference between internal and external pressure• movement of the “volume” uniformly expands or

contracts the system• Conserved quantity is the enthalpy + KE:

– CQ = K(v) + U(r) + pextV + K(dQ/dT)

• Integration becomes more complex: force on volume is dependent on the particle velocities

Pext

Problematic thermostats (& barostats)

• Simple scaling

– pseudo-isokinetic

– If t > or < T0 +/- dT rescale velocities so t = T0

• Berendsen thermostat/barostat

– “weak coupling” – volume or velocities exponentially relax towards T0 (or <V>)

dt/dt ∝ [ T0 – t ] / τ– Mean is correct

– fluctuations are not

guaranteed to be correct • (and they depend on τ)

Boundary conditions

Boundary conditions – the problem

• Generally want to compare to experiments performed on bulk or bulk-like systems

• Simulating a mole of material is impractical– Largest simulation to date

was 109 particles

• We know that interfaces perturb structure, dynamics, thermodynamics

• How do we remove (or control) surface effects in simulation?

One approach – finite systems

• Simulate the biggest “droplet” of material you can afford

• Typically include a restraining potential to keep particles from escaping into vacuum– They have to – favored by entropy!– Often supplemented with a potential to keep particles

“bulk-like” at the surface

• Issue #1 – what is outside the droplet?• Issue #2 – what is the pressure in the droplet?

How should it deform/fluctuate?

Another – Periodic boundary conditions

• Abbreviated “PBC”• Simulated system is periodic in all dimensions

– Simplest case is a cubic periodic box – lattice dimension is the edge length, L

– Other space-filling geometries are possible• Cubic, rectangular prism, parallelipiped, truncated octahedron• Most common are cubic/rectangular (easiest) and truncated

octahedron (usually most efficient)

• Not always 3-D! Often 2-D periodic systems are interesting for modeling interfaces, surfaces, etc.

Periodic boundary conditions• Toroidal geometry: particles wrap around the box

• Simulating an infinitely replicated lattice of identical systems

Minimum image convention• Which particles interact under PBC?• Minimum image convention (MI) – each particle

in the central cell interacts with the nearest periodic copy of other particles

• Some parts of the potential can be explicitly periodic (Ewald electrostatics)

Minimum image nonbonded interactions

• MI indicates which particles/images might interact with the central particle

• Still need to use truncation or some sort of explicitly periodic potential

• People used to use “full” MI – particle interacts with MI of every other particle– <E>/N strongly dependent on box shape, size

– Nonphysical effects in ion simulations; ions of like charge tend towards the “corners” of the cell

Caveats of PBC• Effective range of interactions should be shorter than

L/2– Debye length should be shorter than L/2

• Always keep in mind that periodic boundary conditions will affect some properties– Stabilize phases commensurate with the box, destabilize

phases (e.g. crystal forms) that are incommensurate– Long-wavelength phenomena (e.g. capillary waves) are

limited to wavelengths shorter than the longest dimension of the box

• For simulations of an isolated solute (i.e. a biomolecule) the solute should never be able to interact with itself– Asymmetric solutes can rotate!– Interaction includes solvation shell

Electrostatics

Nonbonded interactions -- review� van der Waals

ƒ decay rapidly, can be treated as finite-ranged

ƒ London dispersion term (-C/r6) is attractive even at long range

ƒ analytic long-range corrections for dispersion are common; necessary for weakly associated liquids (hydrocarbons, CHCl3, etc.)

� electrostaticsƒ electrostatics decay as 1/r (dipoles 1/r3,

etc.)ƒ screening shortens the effective range in

electrolyte solutions (Debye length)

Why are electrostatics long ranged?

• Think about the number of particles that interact with a central particle at a particular distanceNinter(r,r+dr) = 4πρg(r)r2drUinter(r) ∝ r-n

• n > 3: U decays faster than n increases– Energy of successive shells decreases with r

• n = 3: energy of successive shells is constant• n < 3, n increases faster than U decays

– Energy of successive shells increases with r

Choices for electrostatic interactions

• Truncated coulomb• Reaction Field• Periodic (Ewald)• Screened

• The electrostatic interaction is part of the definition of the potential– A force field designed for one electrostatic regime may

perform poorly under another regime– This includes parameters (rcut, εRF, etc. . .)

Truncated Coulomb

Truncated Coulomb

ƒEvaluate Coulomb’s law between charges, stopping at some distance (rcut)

ƒatom-basedƒmolecule- or group-basedƒtruncation is OK for MC; MD requires

continuous potentials & forces– shifting: add a constant to make V(rcut)=0– switching: multiply by a function to make

V(rcut)=0, V'(rcut)=0, V''(rcut)=0

Atom, group, and molecule-based approaches

• Possible to truncate or switch off Coulomb interaction in different ways– Choice of center for truncation sphere

– Choice of truncation criteria

atom-based

group-based

molecule-based

( )∑∑−

= >

−=1

1

N

i

N

ij ij

jicutijcoul r

qqrrHU

( )∑∑∑∑= =

= >

−=α β

α αβαβ

N

i

N

j ij

jin n

cutcoul r

qqrrHU

1 1

1

1

Shifting and switching

• Shifting: subtract U(rc) from the potentialU’(r) = U(r) - U(rc)

• Switching: smoothly shift potential, force (and higher derivatives) to zero over some rangeU’(r) = U(r)S(r)– Numerous implementation options– Switching over the full range of the potential will alter

energy minima.

• For energy-conserving MD, forces need to be continuous. Not an issue for MC.

Reaction Field electrostatics

Reaction field electrostatics� each particle sits at the center of a

cavity (ε=1) surrounded by a homogenous dielectric (ε=εbulk)

� charge-charge interactions include a contribution from the exterior dielectric

� homogenous systems only

ε=80

ε=1

rc

ε=4

ε=1

rc

ε=80

+−−−

+−−=

ccc

ij

ijjiRF rrr

r

rqqU

1

21

11

21

113

2

εε

εε

Periodic (Ewald) electrostatics

Periodic electrostatics

� Ewald summation or equivalent� calculate the true electrostatic energy of the

periodic system� net neutral systems only

� Electrostatic energy of nonneutral system diverges� Treat nonneutral systems by assuming a uniform

background charge density ρ = -(Σqi)/V

� even the infinite system is surrounded by a continuum dielectric ("surface term")

Periodic electrostatics

� calculate electrostatic potential φ at each particle in the central cellƒUcoul = 1/2 Σ qi φ(r i)

� include contributions from all periodic copiesƒ related to the central cell by r i,n = r i + nLƒ φ(r i) = Σ qj/|r ij + nL |

� summation in n is conditionally convergent� Ewald: split conditionally convergent series into two rapidly

convergent series through use of a screening charge

Ewald summation

� place a screening Gaussian charge cloud of opposite sign atop each charge

� allows φ to be calculated as a sum of 4 terms

= +

= +reciprocalspace term

-

self correction

directspace term

surface term

+

( )∑∑

= >

=1

1

N

i

N

ij ij

ijjidirect r

rerfcqqU

α

∑=

−=N

iiself qU

1

2)(πα

2

1

1

)12(

2∑

=+=

N

iiipol rq

VU

r

επ

∑ ∑≠

=

⋅=0

42

12

2

4

2

1

k

kN

i

rkiirecip eeq

kVU i

r

r

rr

rαπ

polselfrecipdirectEwald UUUUU +++=

( )∑∑

= >

=1

1

N

i

N

ij ij

ijjidirect r

rerfcqqU

α

22

3

)( rjGauss eqr α

παρ −

−=

Direct space term: interactions of all point charges i with point charges j plus a screening Gaussian

Gaussian has width (2/α)1/2. α chosen such that direct space interaction is infinitesimal at rcut. Typically, α = 2.5/rcut

charge i charge j

screeningGaussian j

Direct space term

Reciprocal space term

• Interaction of point charges with a periodic system of smooth Gaussian charge distributions

• Solved by a Fourier transform, smooth distribution speeds convergence– Rough heuristic: nmax = 1.5αL

• Includes self-interaction of point charge i with Gaussian i

∑ ∑≠

=

⋅=0

42

12

2

4

2

1

k

kN

i

rkiirecip eeq

kVU i

r

r

rr

rαπ

),,(2

zyx nnnL

kπ=

r

Gaussian i

Gaussian jcharge i

Self interaction

• Corrects for the interaction of charge i with screening Gaussian i that is included in reciprocal space interaction

• Calculated once per simulation. . . Unless charges change (i.e. in free energy calculations, polarizable potentials)

∑=

−=N

iiself qU

1

2)(πα

Gaussian i

charge i

Polarization or Surface term

• Ewald summation is a sum over an infinite number of systems, but they are still surrounded by “something” at infinity

• Can be:– Vacuum (ε = 1)

– Dielectric (∞ > ε > 1)

– Conductor (ε = ∞) (sometimes called “tin-foil”)

ε=?

2

1

1

)12(

2∑

=+=

N

iiipol rq

VU

r

επ

Related methods

• Other ways to evaluate the reciprocal sum– Particle-Mesh Ewald

• Use fast Fourier Transform (FFT) rather than discrete FT for the reciprocal space term

• Arbitrary screening functions (i.e. non-Gaussian)– Particle-particle Particle-Mesh

• Other periodic electrostatics– Fast multipole method

• Distant particles are represented by multipole expansions rather than point charges

Screened electrostatics

Screened electrostatics

• Solvent, counterions act to screen electrostatic interactions in solution– Decreases the effective range of the interaction

• Similar in spirit to continuum models of electrostatics – dielectric and counterions are not treated explicitly

• Use a screened effective potential for charge-charge interactions– Common in coarse-grained models of colloids and

polymers

• Yukawa potential: rYukawa e

r

UU α−= 0

Electrostatics comparison� atom-based cutoff has large forces near the cutoff boundary, even

for neutral molecules� molecule-based cutoff/switch seems OK

ƒ reasonable RDF, etc.ƒ induces long-ranged dipole-dipole correlationsƒ distorts dielectric properties, slows diffusion

� Reaction fieldƒ cheapƒ correct long-range behaviorƒ big question -- what ε to use

– self-consistency– inhomogenous systems

� Ewaldƒ more expensive than RFƒ correct long-range behaviorƒ still a question of what ε to use, less critical than RFƒ EW and RF give consistent results for structure, thermodynamics, ion

charging

Case study: “trp-cage” folding

Folding of the “trp-cage” 20-mer

• Experiment: Neidigh, Fesinmeyer and Andersen NSB 2002

• Simulations: Pitera and Swope PNAS 2003• two 20 amino acid peptides derived from the

antidiabetic protein exendin-4– TC5b: NLYIQWLKDGGPSSGRPPPS– TC3b: NLFIEWLKNGGPSSGAPPPS

• different folding properties– TC5b is well folded, NMR structure available. Unfolds at 315 K in H2O – TC3b is poorly folded, no exp'tl structure possible. <40% folded at 298K

�Can we find the folded structure of TC5b?�Can we reproduce and understand the differences between

TC5b and TC3b?

TC5b experimental structure

Computational Details

• For each peptide (TC3b, TC5b)– AMBER parm 94

– GB/SA implicit solvent model, no cutoff

– 1fs time step, mixed Andersen/Berendsen NVT

– 2ns equilibration/2ns production per replica

– aggregate 92 ns

– 23 temperature replica exchange MD (REMD)

– 8 days with 23 SP2 processors - 375MHz nodes

• Total 0.184 µs, 368 CPU-days

initial conformationcompletely extendedRMSD: 14.8DME: 18.3

after 50ps equilibration at 298K

collapsed, no helixRMSD: 4.6DME: 3.1

RMSD: root mean square atomic positional deviation from NMR structure #1DME: distance matrix error relative to NMR structure #1All values are in Angstrom, Cα only, averaged over all protein residues

sample from 298K replica-exchange collapsed, helix formed, well-packedRMSD: 1.0DME: 0.7

“trp-cage” folding (PNAS 2003)

• Simulations started from a completely unfolded state for both peptides

• TC5b folds to within 1.0 Angstrom of the corresponding experimental structure

Convergence of trp-cage folding

A microscopic pictureclustering based on Cα distance matrixcenters of the 3 most populated clusters for each peptide

TC3bTC5b

#1-3 (98%)

#1 (87%)

#1 (37%)

#2 (21%)

#3 (19%)

TC5b has a unique folded structure (single global minimum)

TC3b has a degenerate ensemble of stable structures (multiple minima)

“trp-cage” folding – sequence and stability

• TC5b simulation folds to structures similar to the experimental structures– apparent TC5b melting temperature around 390K (vs. 315K exp't)

• TC3b simulation is rarely folded (<25%) to structures near the TC5b NMR ensemble

• Clustering revealed an explanation for the difference between the two sequences

250 300 350 400 450 500 550 600

temperature (K)

0

0.25

0.5

0.75

1

frac

tion

fold

ed

TC5bTC3b

Sequence A (TC3b):

multiple minima

Sequence B (TC5b):

single minimum

Initial Conditions

Where to start?

• Need initial positions, velocities of all particles in the simulation

• Ideally,{r ,p} initial is representative of the distribution of interest

• We don’t always know appropriate values of relevant parameters (e.g. ρ)

Initial positions

• Typically simulating dense phases (liquids, solids)

• For solids:– Take initial coordinates from a known crystal

structure

– Unit cell of the crystal structure may not be compatible with the simulated boundary conditions, necessary to replicate the system

Initial positions -- liquids• Difficult to generate initial conditions for

dense, disordered systems (liquids, melts)• Lattice method

– Place molecules on a simple lattice near the appropriate density

– Apply random rotations, small displacements

• Scaling method– Place molecules randomly in a large volume– Scale system down to Vsim

• Build larger systems from periodic replicas of smaller pre-equilibrated systems

Initial positions -- polymers

• Much the same as for liquids, but polymers have many internal degrees of freedom

• Lattice method– Start with an ordered system and disorder it (usually by

high temperature)

• Scaling method– Place polymers (with varied internal coordinates)

randomly in a large volume– Scale system down to Vsim

• Advanced forms of MC can improve equilibration of polymer melts

Initial positions -- biopolymers

• Explicit solvent biopolymer simulations typically consist of 3 components– Biopolymer– Counterions– Solvent(s)

• May also need to include cofactors, ligands, etc.

• Implicit solvent: just the biopolymer

Initial positions -- biopolymers• Structure available

– Protein & nucleic acid structures are stored at the Protein Data Bank (PDB: www.rcsb.org/pdb)

• No structure– Build polymer from idealized geometries of monomers– Regular structure (extended) or random coil

• Often include N-, C-terminal blocking groups– Acetyl & N-Methyl

• In both cases, protonation is an issue– Different side chains ionized depending on pH

• pH 7.0: NH3+, Lys+, Arg+, His, Asp-, Glu-, COO-

– Singly-protonated histidine (imidazole) can be protonated at Nδ, Nε1

• Look at hydrogen bond network to decide

– Constant pH simulations under development

Biopolymer solvation• Surround biopolymer with periodic replicas of a

pre-equilibrated solvent box• Remove all waters that overlap with biopolymer (r

< ~2.0 Angstrom)• Retain waters such that biopolymer is effectively

in dilute solution– Conservative: L > rprot + 2*rcut

– Typical: L > rprot + rcut

• Protein should not directly interact with its own periodic image regardless of rotation or conformational change

• Typically have 1 protein per 3k-30k water molecules – Implies 2-20 mM

Counterions• Biopolymers are polyelectrolytes & can have high

net charge• Typical ionic strength in biochemical experiments

is ~100 mM• Generally simulate neutral system

– Add minimal number of neutralizing counterions (K+/Na+, Cl-)

– Place at extrema of electrostatic potential– Ion may displace a water molecule

• Additional ions added randomly in cation/anion pairs

• Initial locations of counterions shouldn’t matter– True for proteins– Less so for nucleic acids (~100 ns to equilibrate)

Initial velocities

• typically assigned from a Maxwell-Boltzmann distribution at intended temperature TP(v) = (m/2πkBT)1/2 exp(-0.5mv2/kBT)

• Generate random vx, vy, vz for each particle• Generate random {v}, then adjust for effects of

constraints– Constrain total linear momentum = 0– Constrained degrees of freedom imply v•rcon = 0

• Note this is for dynamics in Cartesian coordinates; M-B distribution looks different in different variables (e.g. rcom + Euler angles)

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.5 1 1.5 2 2.5 3 3.5 4

Initial velocities, II

• For some systems, we can also assign v from a uniform distribution – collisions quickly produce a M-B distribution. All velocities can then be scaled up/down so the initial KE = <KE>T

v’ = (<KE>T/KE)1/2 * v

• Remember, T is a property of an ensemble – we measure kinetic energy in the simulation

<KE> = <0.5mv2> = 0.5kBT

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.5 1 1.5 2 2.5 3 3.5 4

Equilibration

Progress so far

• Now we have:– Initial conditions ({r ,p})

– A potential and a way to get forces from it

– An ensemble & corresponding integrator

• If we start our simulation what happens?

Equilibration – the usual story

• Initial conditions are never perfect– Intermolecular bumps/overlaps– Intramolecular strain– Idealized geometries

• All bonds, angles often start at their equilibrium values• These are harmonic oscillators that are “in phase” & need to

decorrelate

• See an initial, rapid decrease in potential energy & corresponding increase in kinetic energy (microcanonical)

What to look for• Track potential, kinetic energy during the initial

phase of the simulation• Can also monitor for very large forces,

anomalously high velocities– Can sometimes be avoided by minimizing the energy of

the initial positions first

• Also need to worry about structural relaxation– How long until “memory” of the initial structure is lost?

• In converged simulations, the exact equilibration protocol should not matter– Good “quality check” for evaluating other people’s

simulations

Observables

How do we analyze simulations?

• Simulation gives us a series of conformations of the system that are representative of a particular ensemble

• If sampling is complete, a simple average corresponds to an ensemble average

{ }( ) { }( )rENVT erP β−∝

{ }( ) { }( ) { }

{ }( )∑

=

=≈

=

N

iiNVT

NVTNVT

rAN

AA

rdrPrAA

1

1

φ ψ

Local properties of biomolecularstructure

• Hydrogen bonding– Donor-acceptor distance (< 3.5-4 Angstrom)– Distance + Donor-H-Acceptor angle (> 120 deg.)– Energetic criteria

• Secondary structure– α-helix, β-strand, turns, others– Characterized by (φ,ψ) torsion angles or H-bond pattern

• Inter-residue contacts– Polar: hydrogen bonds, salt bridges (ion pairs)– Nonpolar: van der Waals contact– Coarse-grained: Cα-Cα distance < threshold

(6 Angstrom)

Analysis of structure

• Average structure <{r }>– Averaged after some superposition or fit to a reference

structure– Average structure is often chemically unrealistic

(rotational averaging, etc.)

• Minimum energy structure – {r } where E({r }) = Emin

– Really want minimum free energy“structures”

• Families of structures (clusters)– Find “related” set of structures– Have to define a metric

−=∆ →

1

221 ln

c

cBcc N

NTkG

Metrics for comparing structures

• Root-mean-square positional deviation (RMSD)

– Typically report minimum RMSD after rigid superposition

• Distance matrix error

• Root-mean-square torsional deviation– Recall torsions range from 0 to 2π

( )∑=

−=N

iii rr

NRMSD

1

2,,

1βααβ

rr

( )∑∑−

= >

−=1

1

2

,,

1 N

i

N

ijijij rr

NDME βααβ

( )∑=

−=N

iiiN

RMSD1

2,,

1)( βααβ φφφ

CA-RMSD and Rg vs. time• Single long simulation (100 ns) of a peptide

in water

• Is it folded or unfolded at this temperature?

CA-RMSD and Rg vs. time• Single long simulation (100 ns) of a peptide

in water

• Is it folded or unfolded at this temperature?

CA-RMSD and Rg vs. time• Single long simulation (100 ns) of a peptide

in water

• Is it folded or unfolded at this temperature?

Clustering• Well-studied topic in statistics and data

analysis

• Two general forms of clustering:– Define cluster radius (in terms of the metric)

– Define # of desired clusters (e.g., k-means)

Simple iterative clusteringCalculate metric between

all pairs of structures

Count # of active structures withinr < rclust of each structure

Find structure with the most neighbors;Assign as center of new cluster

Remove center + cluster membersFrom list of active structures

Active structures remaining?

Output structures and exit

Yes

K-means clusteringSpecify the number of clusters

to be found

Randomly assign each structureto a cluster

Calculate the centroid (mean)of each cluster

Assign each structure to the cluster whose centroid it is closest to

Have structures movedbetween clusters?

Output structures and exit

Yes

Spectroscopic observables

• Generally use heuristics to produce putative spectra or signals from simulated structures

• Static observables– Chemical shifts, J-coupling, NOE’s– IR, CD spectra– Trp fluorescence spectra– Energy transfer between donor and acceptor

fluorophores (FRET)

• Dynamic (time-dependent) observables– Fluorescence anisotropy decay– NMR relaxation experiments

Monte Carlo

• Use of a random process (+ appropriate mathematical transformations) for estimating an integral, distribution, etc.

• 1953: Metropolis Monte Carlo (Metropolis, Rosenbluth, Teller, Teller, JCP 21, 1087)

• A little bit older than that. . .

Buffon’s needle• Introduced by Georges-Louis Leclerc,

Comte de Buffon in the mid-1700’s

• Calculate π by repeated trials of a physical random process– Trial: drop a needle of length l on a board ruled

with parallel lines separated by distances d

– Count fraction of trials where needle intersects one of the lines

d

ldlP

π2

),( =

Portrait of Buffon by Drouais,www.wikipedia.org

l

d

Metropolis Monte Carlo• Named after the famous casinos of

Monte Carlo, Monaco• Allows sampling of the

configurational canonical partition function of a physical system– States (configurations) are visited

with relative Boltzmannprobability

• Uniform trial moves are generated and accepted/rejected using the Metropolis acceptance rule:

• Produces a Markov chain of states that are canonically distributed{ x0, x0, x2, . . .}

( )[ ]on EEenoP −−=→ β,1min)(

xo

x1

∆E

∆E > 0: generate random number on [0,1] & compare to P(o→n)

x2

∆E <= 0: accept automatically

x2

acceptreject

Monte Carlo move set: polymer example

• Physical moves– monomer displacement

– reptation

• Nonphysical moves– flip

– rigid translation

– rigid pivot

Relaxation behavior & correlation length strongly depend on MC move set

Some caveats• Formal

– Markovity (history independence)– Detailed balance (flux balance)

– Irreducible (domain cannot be split into two independent subdomains)

– Aperiodic (must have stationary solution/distribution)

• Practical– Move set controls correlation length of Markov chain, efficiency of

sampling• Possible to be correct but impractical

– Quality of random numbers can affect results– Computers only generate pseudo-random numbers which can be

correlated• Radioactive decay, lava lamps, user typing speed, etc. . .

Image fromwww.amazon.com

A

BC

( ) ( ) ( ) ( )nPnonPoPonoP eqaccepteqaccept →=→

Advantages of Monte Carlo

• No integration error, no need for thermostat/barostat– Target distribution is enforced by acceptance rule

• For local moves, ∆E can be local; don’t need to recalculate total energy

• Can be “smart” in designing moves– Pivot move for self-avoiding walks– Cluster moves for spins, liquids– Correlated torsion (“loop closure”) moves for polymers– Flip moves for colored bead-spring polymers

• Can use “unphysical” moves– Molecules appear or disappear (expanded ensembles, Grand

Canonical MC)– Molecular topologies can change

Useful References

• Herman J. C. Berendsen, Simulating the Physical World, Cambridge University Press 2007

• Daan Frenkel and Berend Smit, Understanding Molecular Simulation, Academic Press 2002

• David P. Landau and Kurt Binder, A Guide to Monte Carlo Simulations in Statistical Physics, Cambridge University Press 2000

• Andrew Leach, Molecular Modelling: Principles and Applications, Prentice Hall 2001

• M.P. Allen and D.J. Tildesley, Computer Simulation of Liquids, Oxford University Press, 1989

Free energy in biomolecularsimulation

Relative free energies

• Most free energies relevant for biomolecules are relativefree energy differences (∆∆G)– Relative affinities of two ligands for the same receptor– Relative stabilities of wild type and mutant proteins– Relative affinities of wild type and mutant proteins for

the same ligand– Relative stabilization of the transition state in the

enzyme versus in solution– Relative stability of protonated and deprotonated states

of a side chain in the protein versus in solution

Thermodynamic cycles

• Calculate a relative free energy difference (∆∆G) by calculating free energy differences (∆G) along unphysical paths

A + B

A + C AC

AB∆GbindAB

∆GbindAC

∆Gso

lvB

C

∆Gcp

xBC

ACbindABbindbind GGG ,, ∆−∆=∆∆

BCcpxBCsolvACbindABbind

ACbindBCsolvBCcpxABbind

GGGG

GGGG

,,,,

,,,,

∆−∆=∆−∆

∆+∆=∆+∆

Ligand binding• Most common to calculate relative binding free energies

• Absolute binding free energies are accessible, but difficult

+∆Gbind,1

+∆Gbind,2

Potential of mean force• Potential of mean force (PMF)• Relative free energy as a function of a generalized

coordinate q (= q({r}))– Distance, angle, torsion angle– Complex combination of coordinates (e.g. radius of

gyration, center of mass distance between to molecules, RMSD from a reference structure)

• Intent is to generate the free energy along a particular path, not just the difference between end states

• No guarantee that the simulated path is relevant for the process of interest

Simple histograms• If a single simulation visits all states of interest, it

is possible to calculate the PMF directly

• Divide q into bins by increments of ∆q

• Histogram simulation data, select one bin as a reference & calculate relative free energies

NqqqNqp /),()( ∆+=

−=∆ → )(

)(ln

1

221 qp

qpTkG Bqq

),()( qqqqp ∆+= χ

Simple histogram example

• Fails for large free energy differences, low T

Umbrella sampling

• Use in cases where a single simulation does not sample all values of q

• Carry out multiple simulations each with an effective Hamiltonian that includes a restraint term in q

• Typical form of W(q) is harmonic in q

• Can recover unbiased p(q) for each simulation from

)()()( qWpKrUH ii

rrr ++=

( ) 2,0 )( ii qqkqW

rrr −=

( ) ( ) ( )

( )i

qWi

qWji

jiii

ii

e

eqqqp

β

βδ+

+−=

rr

r

Water with various electrostatic interactions

Explicit water models

• Include each molecule of the solvent in the simulation– Use one or more “sites”/atoms per molecule

• Model the solute-solvent and solvent-solvent interactions with nonbonds (elec&LJ)

• Solvation effects emerge from the model– Cavitation, dispersion, ∆Cp, Born term

• expensive– solute atoms are 1-10% of simulation– >90% of compute time spent on water– have to average over solvent degrees of freedom

Some common explicit water models

• Stockmayer liquid– LJ spheres with dipole moments

• ST2• MCY• TIPS• SPC -- 2nd peak in O-O RDF, improved

energy• TIP3P -- improved density, energy• SPC/E -- include polarization in DHvap• TIP4P -- O-O rdf, flap angle• TIP5P -- density maximum• Reparameterizations for Ewald/RF

– SPC,SPC/E,TIP[3,4,5]P

104.520

qO(e) -0.834qH(e) 0.417104.520

0.9572 A0

TIP3P

TIP4P

104.520

0.9572 A0

- qO(e) -1.040 qH(e) 0.520

TIP5P

104.520

0.9572 A0

109.4700.7 A0

--

qO(e) -0.241qH(e) 0.241

SPC

qO(e) -0.820qH(e) 0.410

109.470

1 A0

SPC/E

qO(e) -0.8476qH(e) 0.4238109.470

1 A0

Density, 298K

� all values in g/cm3

� all uncertainties ~0.001 g/cm3

� significant shifts in density w/ EW, RF� significant shifts in ρ(T)

cutoff MC

switch MD

corrected switch MD

Ewald RF

SPC 0.985 0.991 0.985 0.971 0.973SPC/E 1.002 1.015 1.009 0.993 0.995TIP3P 1.001 1.009 1.001 0.978 0.982TIP4P 0.997 1.004 0.996 0.988 0.991TIP5P 0.999 1.006 0.996 0.977 0.977

Diffusion coefficient, 298K

� Uncertainties of ca. +/- 0.35 x 10-9 m2/s� All models/simulations within a factor of 2.5 of experiment (2.3x10-9

m2/s); SPC/E and TIP5P are closest� Diffusion slowest for switch; fastest for Ewald or force-shift

SPC SPC/E TIP3P TIP4P TIP5P0

1

2

3

4

5

6

7

D (

10^-

9 m

^2/s

)

FiniteEwaldForce-ShiftRF

Dipole-dipole correlation

• Molecule switch is a short-ranged potential but it induces long-ranged correlations

0 5 10 15 20

Angstrom

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

<co

s th

eta> switch

EwaldRF

O-O radial distribution function

• TIP3P, 298K

0 2.5 5 7.5 10

Angstrom

0

0.5

1

1.5

2

2.5

3

g(r)

switchEwaldRF