Hybrid Monte Carlo (HMC) sampler on submanifolds
- HomotopyContinuation, DynamicPolynomials, used to solve multiple solutions of polynomial contraint equations when the submanifold is algebraic.
- PolynomialRoots, used to find all root of a (scalar) polynomial equation.
- IterativeSolvers, used to solve matrix systems for veolocity constraints.
- YAML, used to parse the configure file cfg.yml.
- LinearAlgebra
- PyPlot
For example, the HomotopyContinuation package can be installed as follows.
julia> import Pkg
julia> Pkg.add("HomotopyContinuation")
git clone https://github.com/zwpku/Constrained-HMC.git
Afterwards, the code should be available in the directory ./Constrained-HMC
cd ./Constrained-HMC
cp -r working_dir_template working_dir_task1
In the example above, the directory ./working_dir_task1 is created by duplicating the template directory ./working_dir_template
It is necessary to specify the model (e.g., parameters, potential, and the mapping whose zero level-set defines the submanifold) in order to run the code. Several model files are provided under ./model_files directory and they can be used as templates. For example, to sample the 3D torus, we use
cd working_dir_task1
cp ../model_files/3d_torus.jl .
The file cfg.yml should be prepared under the working directory. A template configure file cfg.yml is provided under ./working_dir_template.
In particular, the parameter "model_file_name" should be set to the name of the model file created in step 2. For example, the following line in ./cfg.yml tells the code that we want to use the model provided in the file ./3d_torus.jl.
model_file_name : 3d_torus.jl
julia ../src/constrained_hmc.jl