[ANN] Arianna.jl: A Modular Markov Chain Monte Carlo Framework

Hi everyone! Together with @leonardogalliano, we’re excited to release Arianna.jl, a Markov Chain Monte Carlo (MCMC) framework designed for flexibility and customization.

Unlike black-box simulators, Arianna.jl lets users define their own systems and Monte Carlo moves, offering a modular approach to MCMC simulations. This means you can easily simulate your system without needing to implement Monte Carlo algorithms from scratch.

Example: A Particle in a Potential Well

In particle_1D.jl, we showcase a simple system:

  • A particle in a potential energy well at a given temperature
  • With Gaussian-distributed displacements as proposed moves
  • Following Maxwell-Botzmann statistics: p(e_{particle}=e) \propto exp(-e/(k_bT))

To run the simulation, just use:

using Arianna
include("example/particle_1D/particle_1d.jl")

x₀ = 0.0   # Initial position  
β = 2.0    # Inverse temperature  
M = 10     # Number of Markov chains  

# Create Markov chains
chains = [System(x₀, β) for _ in 1:M]

# Define the pool of moves
pool = (Move(Displacement(0.0), StandardGaussian(), ComponentArray(σ=0.1), 1.0),)

steps = 10^5
burn = 1000
sampletimes = build_schedule(steps, burn, 10)
path = "data/MC/particle_1d/Harmonic/beta$β/M$M/seed$seed"

# Define simulation algorithms
algorithm_list = (
    (algorithm=Metropolis, pool=pool, seed=seed, parallel=false),
    (algorithm=StoreCallbacks, callbacks=(callback_energy, callback_acceptance), scheduler=sampletimes),
    (algorithm=StoreTrajectories, scheduler=sampletimes),
) 

# Run simulation
simulation = Simulation(chains, algorithm_list, steps; path=path, verbose=true)
run!(simulation)

This script simulates multiple independent Markov chains using the Metropolis algorithm, stores energy and acceptance statistics and stores the particles trajectory for analysis.

As a bonus feature, Arianna integrates adaptive sampling using policy gradient methods to optimise move parameters dynamically. We are currently implementing replica exchange MCMC sampling for the next release.

Feedbacks and contributions are of course welcome. If you have a particular system you want to implement please share it with us, and we’ll be happy to help.

As we are both interested in atomic and molecular Monte Carlo simulations, we are developing ParticlesMC, which we hope to release soon!

Cheers,

12 Likes