MonteCarloX.jl
MonteCarloX is a compact Julia framework for Monte Carlo sampling. It is built around composable primitives, so algorithms stay reusable across very different models.
What this package gives you
- Equilibrium samplers (
Metropolis,Glauber,HeatBath,Multicanonical,WangLandau) - Continuous-time samplers (
Gillespie) - Measurement/scheduling framework (
Measurements) - Ensemble and weight tools (
BoltzmannEnsemble,BinnedObject) - Event handler backends for event-driven dynamics
Core idea
A simulation needs 3 pieces:
- System: state and model-specific operations
- Weight/rates: target distribution or transition intensities
- Algorithm: transition sampler
Measurements are optional convenience tools for organized observable collection.
This separation keeps algorithm code model-agnostic.
Reading path
If you are new, read in this order:
- Monte Carlo Fundamentals
- Importance Sampling Algorithms
- Continuous-Time Sampling Algorithms
- Build Your Own System
- Systems
- Weights
- Measurements
Quick orientation
- Use importance sampling for discrete-step update protocols (equilibrium or driven/non-equilibrium).
- Use continuous-time sampling when physical/simulation time matters.
- Use companion model packages (for example
SpinSystems) for concrete systems.
Scope
MonteCarloX is the algorithmic core. Concrete model families are intentionally external. This keeps the framework concise and easier to extend.
Related Julia packages
The Julia ecosystem already has several Monte Carlo packages with different goals and interfaces. If your use case is better served by a domain-specific implementation, these are useful alternatives or complements:
- GeneralizedMonteCarlo.jl: generalized-ensemble methods (for example multicanonical and related workflows).
- MonteCarlo.jl: quantum many-body focused Monte Carlo framework.
- Carlo.jl: lattice-model Monte Carlo toolkit with a strong focus on physics applications.
Other related packages (grouped by common use cases):
- Bayesian inference and MCMC:
- [Turing.jl](https://github.com/TuringLang/Turing.jl)
- [AbstractMCMC.jl](https://github.com/TuringLang/AbstractMCMC.jl)
- [AdvancedMH.jl](https://github.com/TuringLang/AdvancedMH.jl)
- [AdvancedHMC.jl](https://github.com/TuringLang/AdvancedHMC.jl)
- [DynamicHMC.jl](https://github.com/tpapp/DynamicHMC.jl)
- [BAT.jl](https://github.com/bat/BAT.jl)
- [Gen.jl](https://github.com/probcomp/Gen.jl)- Monte Carlo integration and low-discrepancy sampling:
- [Cuba.jl](https://github.com/giordano/Cuba.jl)
- [QuasiMonteCarlo.jl](https://github.com/SciML/QuasiMonteCarlo.jl)
- [SpinMC](https://github.com/fbuessen/SpinMC.jl)- Uncertainty propagation with particle arithmetic:
- [MonteCarloMeasurements.jl](https://github.com/baggepinnen/MonteCarloMeasurements.jl)MonteCarloX stays focused on compact, model-agnostic algorithmic building blocks, while these packages offer specialized ecosystems for their target domains.
Random number generators
MonteCarloX works with any Julia AbstractRNG.
- Prefer
Xoshiroas a modern default for new projects. - Use
MersenneTwisterwhen compatibility with existing workflows is needed.
Because RNG is passed directly to algorithms, changing RNG is a one-line change.