Giter Club home page Giter Club logo

vmachine's Introduction

VMaChine

VMaChine is a general variational Monte Carlo (VMC) solver written in object-oriented C++. It was implemented with focus on quantum dot systems, and standard trial wave functions (Hermite functions) are implemented. However, we primary aim of examining trial wave functions where a less amount of physical intuition is required. Therefore, several trial wave functions based on neural networks and machine learning are also included, hence VMaChine. The code is largely parallelizable and is well-suited for large clusters.

Basic usage

After compiling the code, a configuration file input.in is run by

vmachine input.in

on a single thread or

mpirun -n 4 vmachine input.in

on 4 CPUs (might be any number).

What's new?

Update 2022-08-01

  • Added Xavier initialisation class
  • Now supporting weight initialisation from file

Update 2022-07-11

  • Added better comments
  • Splitted up system.cpp in several files to increase readability

Update 2021-01-01

  • An interaction class is added. The old style "interaction: true" is now superseded by "interactionStyle: coulomb".

Update 2020-12-28

  • The log (printed to the terminal by default) is now more readable both for a human eye and for the computer
  • Examples added

Update 2020-12-27

  • Fixed bug in CMakeLists.txt
  • Removed support for Armadillo, as it was found to be more confusing than useful

Prerequisites

To run the code without issues, C++14 is required. In addition, a few external packages are needed:

  • MPI
  • Eigen

MPI

MPI is used for parallel processing. On Linux, the package can be installed by the following commands

sudo apt-get install libopenmpi-dev
sudo apt-get install openmpi-bin

MPI is also avaliable on other platforms.

Eigen

Eigen is a C++ template library for linear algebra operations. See http://eigen.tuxfamily.org/ for installation details.

Install

VMaChine can be installed by cloning this repository. This is preferably done in the home directory:

cd
git clone https://github.com/evenmn/VMaChine.git

Then copy Eigen header files and blocker files to VMaChine:

cd ~/Download/eigen-3.3.9   # insert correct path here
cp -r Eigen ~/VMaChine/include/

Build

The code can be compiled by either CMake or QMake

CMake (recommended)

Build VMaChine in the usual CMake way:

mkdir build
cd build
cmake ..
make -j8

The executable is then found in ~/VMaChine/build folder, which is added to the bash resource path by

echo "export PATH=~/VMaChine/build:\$PATH" >> ~/.bashrc

QMake (QT-creator)

  1. Download QT-creator
  2. Configure the building file src/vmachine.pro

The project can then be run in QT-creator using ctrl + R.


Running simulation

The desired simulation parameters are specified in a configuration file. A typical configuration file can be found in input.in:

# system
numParticles: 2
numDimensions: 2
hamiltonian: harmonicOscillator
omega: 1.0
interactionStyle: coulomb

# wave function
waveFunctionElement: gaussian
waveFunctionElement: padeJastrow

# simulation
numIterations: 100
numSteps: 100000
learningRate: 0.1
stepLength: 0.1

The configuration file is simply run by

vmachine input.in

License

MIT

vmachine's People

Contributors

evenmn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mtrynoha

vmachine's Issues

Documentation

Write up documentation. This is very easy to do using Sphinx

Fix memory leaks

There are a few places where memory is allocated, but never freed up (src/system.cpp and src/initialWeights/automaize.cpp). This is unfortunate and should be fixed asap.

Create interaction class and move computeLocalEnergy function

In the current version, the interaction energy (inter-particle energy) is restricted to Coulomb interaction, and is located in the Hamiltonian class. At the same time, the kinetic energy is called from the Hamiltonian class, which does not really makes sense.

In order to make VMaChine more flexible and accept other interaction styles, it would be better to create an interaction class where Coulomb is a subclass and None is another subclass (and the default). The local energy should be computed in the sampler.

Better VMC

The current VMC algorithm can be improved by allowing for variance minimization and more sophisticated optimization algorithms based on the Hessian

Split system.cpp

system.cpp contains the write-functions and the parser. These could with advantage be moved to respective files (ex. write.cpp and read.cpp).

Object representation

Find a neat way to represent the various objects, preferably similar to the built-in repr()-method in Python.

Clean up

The code can be made more transparent. First, the set*-methods in system are no longer needed after the configuration file was made the way to configure the system. When the set*-methods are removed, the initialize-methods found in all classes can be moved to init, making the code more readable.

Torch support

Add support for the PyTorch C++ API. This can be used for setting up models, autograd, optimization and GPU acceleration

Python interface

A Python interface could be implemented in order to ease the usage of the package. Using PyBind11, this should now take more than a few hours

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.