This repository contains the code for the second project of the course FYS4411 (spring 2023). This code was adapted from the code for the first project, which was forked from this template repository, whose authors are thankfully acknowledged.
This README was written for the first project and has not been properly updated for the second project. It may be out of date.
The code is written in C++. To compile it, you need to have the nlopt library and OpenMP installed. The data analysis is written in python.
Provided Cmake is installed, compile by running the script compile_project
via
./compile_project
This produces an executable called vmc
in the top directory. It should be run as:
./vmc Input/simulation_input.txt
where Input/simulation_input.txt
is the file containing the parameters of the simulation.
There are two ways of running the code.
-
If the input file contains the line
calculateGradients=1
, the code will compute the gradients and run an optimization algorithm for the parameters of the wave function. By default this is LBFGS, but it can be set to be gradient descent with momentum by providing an extra command-line argumentGD
:./vmc Input/simulation_input.txt GD
Progress of the optimization is written to
Outputs/output.txt
. -
If the input file contains the line
calculateGradients=0
, the code will NOT compute the gradients. This is meant to spare the computational costs when the wave function is already optimized. It will output a lot of files in theOutputs
folder, which contain the sampled energies and the one-body histograms (in binary format).
The python scripts for the data analysis are contained in the DataAnalysis
folder, they assume that a simulation has been run without calculating gradients.
onebodydensity.py
computes and plots the histograms and the corresponding gaussian fit.blocking.py
contains the blocking function provided by Marius Jonsson and uses it to analyse the simulation data.
The first project whose code forms the basis of this project was done in collaboration with
Gianmarco Puleo