`BasicMD.BasicMD`

— Module**BasicMD.jl**

A collection of basic routines for Molecular Dynamics simulations written in Julia. These include:

- Euler–Maruyama (EM)
- Random Walk Metropolis (RWM)
- Metropolis Adjusted Langevin (MALA)
- Brünger, Brooks and Karplus (BBK)
- ABOBA, BAOAB
- Verlet
- Hamiltonian/Hybrid Monte Carlo (HMC)

**REPL help**

`?`

followed by an sampler name (`?RWM`

)to obtain infromation about individual samplers. Use `?`

on `sample_trajectory!`

and `sample_trajectory`

to obtain information about running the samplers. Finally, `?`

on `MDOptions`

will provide information about how to set additional options, such as the number of information.

**Performing Sampling**

Having constructed a `sampler`

structure, samplers are executed with the the commands

`sample_trajectory!(X, sampler, options=opts);`

for an in place transformation of `X`

or

`Xvals = sample_trajectory(X₀, sampler);`

to obtain a full trajectory. Metropolis methods will also return the running acceptance rate.

`BasicMD.ABOBA`

— Method`ABOBA(∇V!, β, γ, M, Δt)`

Set up the ABOBA integrator for inertial Langevin.

**Fields**

- ∇V! - In place gradient of the potential
- β - Inverse temperature
- γ - Damping Coefficient
- M - Mass (either scalar or vector)
- Δt - Time step

`BasicMD.BAOAB`

— Method`BAOAB(∇V!, β, γ, M, Δt)`

Set up the BAOAB integrator for inertial Langevin.

**Fields**

- ∇V! - In place gradient of the potential
- β - Inverse temperature
- γ - Damping Coefficient
- M - Mass (either scalar or vector)
- Δt - Time step

`BasicMD.BBK`

— Method`BBK(∇V!, β, γ, M, Δt)`

Set up the BBK integrator for inertial Langevin.

**Fields**

- ∇V! - In place gradient of the potential
- β - Inverse temperature
- γ - Damping Coefficient
- M - Mass (either scalar or vector)
- Δt - Time step

`BasicMD.EM`

— Method`EM(∇V!, β, γ, M, Δt)`

Set up the EM integrator for overdamped Langevin.

**Fields**

- ∇V! - In place gradient of the potential
- β - Inverse temperature
- Δt - Time step

`BasicMD.GJF`

— Method`GJF(∇V!, β, γ, M, Δt)`

Set up the G-JF integrator for inertial Langevin.

**Fields**

- ∇V! - In place gradient of the potential
- β - Inverse temperature
- γ - Damping Coefficient
- M - Mass (either scalar or vector)
- Δt - Time step

`BasicMD.HMC`

— Method`HMC(V, ∇V!, β, M, Δt, nΔt)`

Set up the HMC sampler for Boltzmann.

**Fields**

- V - Potential
- ∇V! - In place gradient of the potential
- β - Inverse temperature
- Δt - Time step
- nΔt - Number of time steps to use in each Verlet run

`BasicMD.MALA`

— Method`MALA(V, ∇V!, β, Δt)`

Set up the MALA sampler for overdamped Langevin.

**Fields**

- V - Potential
- ∇V! - In place gradient of the potential
- β - Inverse temperature
- Δt - Time step

`BasicMD.MDOptions`

— Method`MDOptions(;n_iters = 10^4, n_save_iters=1)`

Set options for samplers.

**Fields**

- n_iters - Set the number of iterations of the sampler
- n
*save*iters - Set the frequency at which iterations are saved. If n*save*iters=1, every iteration is saved. If n*save*iters=n_iters, only the final iteration is saved.

`BasicMD.RWM`

— Method`RWM(V, β, Δt)`

Set up the RWM sampler for Boltzmann.

**Fields**

- V - Potential
- β - Inverse temperature
- Δt - Time step

`BasicMD.Verlet`

— Type`Verlet(∇V!, M, Δt)`

Set up the Verlet integrator.

**Fields**

- ∇V! - In place gradient of the potential
- M - Mass (either scalar or vector)
- Δt - Time step

`BasicMD.Boltzmann_likelihood`

— Method`Boltzmann_likelihood(x, V, β)`

Compute the unnormalized Boltzmann density, exp(-β V(x)) for potential `V`

at inverse temperature `β`

**Fields**

- x - Value at which to evalute the density
- V - Potential
- β - Inverse temperature

`BasicMD.MALA_likelihood`

— Method`MALA_likelihood(X₀, X₁, gradV0, β, Δt)`

Compute the likelihood of the MALA proposal X₀→X₁ for potential with gradient gradV0 at inverse temperature β and time step Δt

`BasicMD.sample_observables`

— Method`sample_observables(x₀, sampler, observables; options=MDOptions())`

Run the `sampler`

starting at `x₀`

, evaluating the trajectory on a tuple of `observables`

scalar functions. Number of iterations and interval between saves are set using the `options`

argument. Only the computed observables are returned.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler`constraints`

- Constraints on the trajectory`observables`

- Observables on which to evaluate the trajectory

**Optional Fields**

`TO`

- Observable data type, if needed, should be entered as the first argument`options`

- Sampling options, including number of iteration

`BasicMD.sample_observables`

— Method`sample_observables(x₀, sampler, observables; options=MDOptions())`

Run the `sampler`

starting at `x₀`

, evaluating the trajectory on a tuple of `observables`

scalar functions. Number of iterations and interval between saves are set using the `options`

argument. Only the computed observables are returned.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler`observables`

- Observables on which to evaluate the trajectory

**Optional Fields**

`TO`

- Observable data type, if needed, should be entered as the first argument`options`

- Sampling options, including number of iteration

`BasicMD.sample_trajectory!`

— Method`sample_trajectory!(x, sampler; options=MDOptions())`

In place applciation of the `sampler`

to `x`

. Number of iterations are set using the `options`

argument.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler`constraints`

- Constraints on the trajectory

**Optional Fields**

`options`

- Sampling options, including number of iteration

`BasicMD.sample_trajectory!`

— Method`sample_trajectory!(x, sampler; options=MDOptions())`

In place applciation of the `sampler`

to `x`

. Number of iterations are set using the `options`

argument.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler

**Optional Fields**

`options`

- Sampling options, including number of iteration

`BasicMD.sample_trajectory`

— Method`sample_trajectory(x₀, sampler; options=MDOptions())`

Run the `sampler`

starting at `x₀`

. Number of iterations and interval between saves are set using the `options`

argument. For Metropolis samplers, the running acceptance rates are also resturned.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler`constraints`

- Constraints on the trajectory

**Optional Fields**

`options`

- Sampling options, including number of iteration

`BasicMD.sample_trajectory`

— Method`sample_trajectory(x₀, sampler; options=MDOptions())`

Run the `sampler`

starting at `x₀`

. Number of iterations and interval between saves are set using the `options`

argument. For Metropolis samplers, the running acceptance rates are also resturned.

**Fields**

`x`

- Starting position for sampler, modified in place`sampler`

- Desired sampler

**Optional Fields**

`options`

- Sampling options, including number of iteration`constraints`

- Constraints on the trajectory

`BasicMD.trivial_constraint!`

— Method`trivial_constraint!`

- Trivial constraint function

**Fields**

`state`

- Current state of the sampler`i`

- Index of current iterate

`BasicMD.trivial_constraint!`

— Method`trivial_constraint!`

Trival constraint function