Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main in dev #164

Merged
merged 152 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
cff5770
Update LICENSE
NicoRenaud Apr 6, 2022
48e204b
hrv 0.27
NicoRenaud Apr 6, 2023
2848b3a
remove np deprecation warning supression
NicoRenaud Apr 6, 2023
e16db65
add libstd
NicoRenaud Apr 6, 2023
ccb3117
install mpi
NicoRenaud Apr 6, 2023
e340f84
remove 3.7
NicoRenaud Apr 6, 2023
99dd8b8
remove autograd.F
NicoRenaud Apr 6, 2023
17f62e4
simplify build
NicoRenaud Apr 6, 2023
55b1c6d
fix pip install
NicoRenaud Apr 6, 2023
38c5737
add libstdcxx
NicoRenaud Apr 6, 2023
129d7d9
Merge pull request #140 from NLESC-JCER/fix_master_23
NicoRenaud Apr 6, 2023
3a0166f
first draft of the paper
NicoRenaud Apr 11, 2023
07cdbfc
added picture
NicoRenaud Apr 11, 2023
a00e3ba
add workflow
NicoRenaud Apr 11, 2023
c2e6570
add workflow
NicoRenaud Apr 11, 2023
bf68aff
add workflow
NicoRenaud Apr 11, 2023
4f09d77
add workflow
NicoRenaud Apr 11, 2023
dc55f1e
add workflow
NicoRenaud Apr 11, 2023
8febc8d
add workflow
NicoRenaud Apr 11, 2023
744b042
add workflow
NicoRenaud Apr 11, 2023
80fe96b
add workflow
NicoRenaud Apr 11, 2023
647ee83
fix figure
NicoRenaud Apr 11, 2023
4f9afb7
add workflow
NicoRenaud Apr 11, 2023
43416e2
Merge branch 'paper' of https://github.com/NLESC-JCER/QMCTorch into p…
NicoRenaud Apr 11, 2023
b168405
new picture
NicoRenaud Apr 11, 2023
fee089a
draft paper
NicoRenaud Apr 11, 2023
3bb1fd0
Merge branch 'paper' of https://github.com/NLESC-JCER/QMCTorch into p…
NicoRenaud Apr 11, 2023
21bd08d
draft
NicoRenaud Apr 11, 2023
870ac4b
Add files via upload
NicoRenaud Apr 11, 2023
c4f0216
draft paper
NicoRenaud Apr 11, 2023
469e174
draft paper
NicoRenaud Apr 12, 2023
e394fe9
added qmc pic
NicoRenaud Apr 12, 2023
b4278d9
added 1min intro
NicoRenaud Apr 12, 2023
9a98d6b
doc
NicoRenaud Apr 12, 2023
1e0ea82
fix list of tensor in hdf5_utils
NicoRenaud Apr 12, 2023
93e8d7b
fixed opt example
NicoRenaud Apr 12, 2023
1c69f93
fix optimization example
NicoRenaud Apr 12, 2023
bc07dd0
fix missing variables
NicoRenaud Apr 12, 2023
baa4bab
working on the doc
NicoRenaud Apr 13, 2023
8cf625b
doc
NicoRenaud Apr 14, 2023
4d272b1
added hdf5 for notebooks
NicoRenaud Apr 14, 2023
d1e08eb
move example in docs
NicoRenaud Apr 14, 2023
a5c3181
move pics in docs
NicoRenaud Apr 14, 2023
3faa258
clean figs
NicoRenaud Apr 14, 2023
cf95f0c
clean up doc structure
NicoRenaud Apr 14, 2023
d80fe9c
opt tuto
NicoRenaud Apr 14, 2023
755dca9
added nbsphinx
NicoRenaud Apr 14, 2023
cdab5ab
added requirements for nbshinx
NicoRenaud Apr 14, 2023
999ab6c
allow error nbsphinx
NicoRenaud Apr 14, 2023
60eaf3b
fix horovod tuto
NicoRenaud Apr 14, 2023
a9280a8
clean nb output
NicoRenaud Apr 14, 2023
bd41fec
add ams calculator
NicoRenaud Apr 21, 2023
51efe6d
make bohr possible for adf2023
NicoRenaud Apr 21, 2023
23ab8f2
Merge pull request #142 from NLESC-JCER/adf2023_calc
NicoRenaud Apr 21, 2023
ea32d10
add doc about ams driver
NicoRenaud Apr 21, 2023
6da8180
added scf example
NicoRenaud Apr 21, 2023
85e38b5
merged the adf calcs
NicoRenaud Apr 21, 2023
9da7f8e
versionning
NicoRenaud Apr 21, 2023
2aa6904
improves docstring
NicoRenaud Apr 23, 2023
896f8cd
fixed matj in docstring
NicoRenaud Apr 24, 2023
46b8041
rename solvers
NicoRenaud Apr 24, 2023
ed02189
fixed adf calc for extra basis in 2020+
NicoRenaud Apr 24, 2023
b62d802
doc for wave functions
NicoRenaud Apr 24, 2023
5876efa
doc for wave functions
NicoRenaud Apr 24, 2023
1818e83
fix fdoc
NicoRenaud Apr 24, 2023
ad7b8f1
fix fdoc
NicoRenaud Apr 24, 2023
7bf5fe5
fix some docstrings
NicoRenaud Apr 25, 2023
5590971
expanded wf explanation
NicoRenaud Apr 25, 2023
9da24a5
clean up some doc
NicoRenaud Apr 25, 2023
e8db1ac
fix math
NicoRenaud Apr 25, 2023
5d01451
fix math
NicoRenaud Apr 25, 2023
ff30b81
rename combined jastrow
NicoRenaud Apr 25, 2023
0da91c1
fix picture
NicoRenaud Apr 25, 2023
1925bf2
fix spelling errors
NicoRenaud Apr 25, 2023
6463a85
fix codacy
NicoRenaud Apr 26, 2023
b64dc6a
fix spelling mistakes
NicoRenaud Apr 26, 2023
c7f3ac2
Merge pull request #141 from NLESC-JCER/paper
NicoRenaud Apr 26, 2023
4f9b9fb
replace codacy badge
NicoRenaud Apr 28, 2023
9c6a2e1
Added DOO for qmc=chem
NicoRenaud May 12, 2023
8fbcfe2
fix paper
NicoRenaud May 12, 2023
6b74ff9
Merge branch 'master' of https://github.com/NLESC-JCER/QMCTorch
NicoRenaud May 12, 2023
56ac662
Update paper.md
NicoRenaud May 13, 2023
9e14b01
Update paper.md
NicoRenaud May 13, 2023
db501c7
Update paper.md
NicoRenaud May 13, 2023
005f76c
Update paper.md
NicoRenaud May 13, 2023
d0a25ca
Update paper.md
NicoRenaud May 13, 2023
2c9e8fc
Update paper.md
NicoRenaud May 13, 2023
439a79e
Merge pull request #144 from NLESC-JCER/NicoRenaud-paper-patch-1
NicoRenaud May 13, 2023
73bb164
fix conversion
NicoRenaud Aug 29, 2023
2274ca6
fix anthony
NicoRenaud Aug 29, 2023
0f96c3a
Update paper.bib
NicoRenaud Aug 29, 2023
68d446c
added references
NicoRenaud Aug 29, 2023
4ab751a
fix bib
NicoRenaud Aug 29, 2023
4bd1f54
Merge pull request #147 from NLESC-JCER/fix_anthony_mol
NicoRenaud Aug 29, 2023
40d136f
Merge pull request #148 from NLESC-JCER/review_paper
NicoRenaud Aug 29, 2023
49a6ed7
fix size issue
NicoRenaud Oct 19, 2023
9938815
check for jastow before resetting params
NicoRenaud Oct 25, 2023
5c27746
clean up get basis
NicoRenaud Oct 25, 2023
d77368e
added rd yaml file
NicoRenaud Oct 25, 2023
23f59b5
added rtdyaml
NicoRenaud Oct 25, 2023
6424cf5
Merge pull request #152 from NLESC-JCER/issue149_docs
NicoRenaud Oct 25, 2023
66fd172
added theme
NicoRenaud Oct 25, 2023
965cf99
removed the rtd yaml
NicoRenaud Oct 25, 2023
775165a
Update README.md
NicoRenaud Oct 25, 2023
3a98e68
horovod install
NicoRenaud Oct 25, 2023
f02c982
Merge pull request #143 from NLESC-JCER/NicoRenaud-codacy
NicoRenaud Oct 25, 2023
07ebf63
add gxx install
NicoRenaud Oct 26, 2023
bee4ff2
added pep517 ignore flag as recommended
NicoRenaud Oct 26, 2023
3034993
install packaging and use pip3
NicoRenaud Oct 26, 2023
e9de5df
downgrade setupools
NicoRenaud Oct 26, 2023
34eab79
remove stdcxx install ...
NicoRenaud Oct 26, 2023
3c24145
install cmake
NicoRenaud Oct 26, 2023
cedc320
upgrade pip
NicoRenaud Oct 26, 2023
01a3631
fix typo
NicoRenaud Oct 26, 2023
764494c
stdxx again
NicoRenaud Oct 26, 2023
38ac3d9
stdcxx
NicoRenaud Oct 26, 2023
0fa2d1f
env var for horovod
NicoRenaud Oct 26, 2023
b906aa5
codacy fix
NicoRenaud Oct 26, 2023
45cc6bf
wheel
NicoRenaud Oct 26, 2023
6069631
install pytorch from pip
NicoRenaud Oct 26, 2023
95609a2
install pytorch from pip
NicoRenaud Oct 26, 2023
a463eac
install pytorch from pip
NicoRenaud Oct 26, 2023
71525f9
remove hvd test
NicoRenaud Oct 26, 2023
273cb08
start fixing inter issue
NicoRenaud Oct 26, 2023
6a4123c
start fixing inter issue
NicoRenaud Oct 26, 2023
77aaddc
fix interpolate
NicoRenaud Oct 26, 2023
53289b4
deprecate integrator
NicoRenaud Oct 26, 2023
c9b9589
reverted to pytorch2.0.0
NicoRenaud Oct 26, 2023
43eaff5
fix ypo
NicoRenaud Oct 26, 2023
54bd7c2
reactivte hrovod test
NicoRenaud Oct 27, 2023
92fe2bb
Merge branch 'master' into issue150_dimensions
NicoRenaud Oct 27, 2023
7f0620a
bumped action version
NicoRenaud Oct 27, 2023
db0b001
Merge pull request #153 from NLESC-JCER/bump_action
NicoRenaud Oct 27, 2023
2851980
Merge pull request #151 from NLESC-JCER/issue150_dimensions
NicoRenaud Oct 27, 2023
209559c
bump version
NicoRenaud Oct 27, 2023
8ced0f9
change log
NicoRenaud Oct 27, 2023
bfabcb0
change log [skip ci]
NicoRenaud Oct 27, 2023
5cfaf74
cast to int
NicoRenaud Nov 11, 2023
33a3d8f
Update qmctorch.rst
NicoRenaud Nov 11, 2023
6bf1788
Update qmctorch.rst
NicoRenaud Nov 11, 2023
1fb6eaa
Update wfopt.ipynb
NicoRenaud Nov 11, 2023
3f6b047
Update geoopt.ipynb
NicoRenaud Nov 11, 2023
fa2af24
removed empty cell
NicoRenaud Nov 11, 2023
6915cb6
Merge pull request #156 from NLESC-JCER/Review-Tony
NicoRenaud Nov 11, 2023
228b440
Merge pull request #155 from NLESC-JCER/issue154_int_norm_orb
NicoRenaud Nov 11, 2023
adede99
Fix DOI
NicoRenaud Nov 13, 2023
5aed134
Merge pull request #157 from NLESC-JCER/Fix-DOI-paper
NicoRenaud Nov 13, 2023
29c5eff
bump version
NicoRenaud Nov 14, 2023
f1e4a53
Update paper.md
NicoRenaud Nov 21, 2023
c7ea891
Update paper.md
NicoRenaud Nov 21, 2023
1787a72
Merge pull request #158 from NLESC-JCER/typo-fix
NicoRenaud Nov 21, 2023
a1b4e11
Added JOSS badge
NicoRenaud Nov 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,33 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [3.7, 3.8]
version: [3.8]

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.0
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.version }}
conda-channels: anaconda
- run: conda --version
- run: which python
- run: conda install mpi4py h5py pytorch torchvision cpuonly -c pytorch -c conda-forge
- name: Install essential
run: |
sudo apt update
sudo apt install build-essential
- name: Install conda packages
run: |
conda install -c anaconda cmake
conda install mpi4py h5py pytorch==2.0.0 torchvision==0.15.0 cpuonly -c pytorch -c conda-forge
conda install -c conda-forge libstdcxx-ng
conda install -c anaconda gxx_linux-64

- name: Install the package
run: pip install .[test,hpc]
run: python -m pip install .[test,hpc]
env:
CONDA_PREFIX: /usr/share/miniconda

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on: [push]

jobs:
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
Change Log
##########

0.3.1 [Released]
*****************

Change
-------

* Support cc-pvdz orbitals (#151)
* Freeze Pytorch version (#151)
* Fix read the doc (#150)

0.3.0 [Released]
********************

* Support ADF2023 (#142)
* JOSS paper (#141)
* Fix bug in converting distance unit (#148)
* Hamiltonian Monte Carlo (#117)
* Jastrow kernels (#112)
* Backflow transformation (#115)

0.1.1 [Unreleased]
******************

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyy] [name of copyright owner]
Copyright 2022 Nicolas Renaud

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Pytorch Implementation of Real Space Quantum Monte Carlo Simulations of Molecula
[![PyPI version](https://badge.fury.io/py/qmctorch.svg)](https://badge.fury.io/py/qmctorch)
[![Build Status](https://github.com/NLESC-JCER/QMCTorch/workflows/build/badge.svg)](https://github.com/NLESC-JCER/QMCTorch/actions)
[![Coverage Status](https://coveralls.io/repos/github/NLESC-JCER/QMCTorch/badge.svg?branch=master)](https://coveralls.io/github/NLESC-JCER/QMCTorch?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5d99212add2a4f0591adc6248fec258d)](https://www.codacy.com/manual/NicoRenaud/QMCTorch?utm_source=github.com&utm_medium=referral&utm_content=NLESC-JCER/QMCTorch&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1c52407422a7428083968833341b5945)](https://app.codacy.com/gh/NLESC-JCER/QMCTorch/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3780094.svg)](https://doi.org/10.5281/zenodo.3780094)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05472/status.svg)](https://doi.org/10.21105/joss.05472)

## Installation

Expand All @@ -15,8 +16,4 @@ Clone the repository and install the code from source or use the Python package
`pip install qmctorch`

## Documentation
https://qmctorch.readthedocs.io/en/latest/intro.html


## Disclaimer
QMCTorch is currently under developmement and most likely won't behave as expected
https://qmctorch.readthedocs.io
2 changes: 1 addition & 1 deletion bin/qmctorch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os
import argparse


dist_solvers = ['SolverSlaterJastrowHorovod']
dist_solvers = ['SolverMPI']


def check_file(fname):
Expand Down
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode'
'sphinx.ext.viewcode',
'nbsphinx'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -139,7 +140,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -165,7 +166,7 @@
# html_theme = 'classic'

html_theme = 'sphinx_rtd_theme'
html_logo = "qmctorch_white.png"
html_logo = "./pics/qmctorch_white.png"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -261,3 +262,4 @@

autoclass_content = 'init'
autodoc_member_order = 'bysource'
nbsphinx_allow_errors = True
File renamed without changes.
1 change: 1 addition & 0 deletions docs/example/colab/google_collab.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cells":[{"attachments":{},"cell_type":"markdown","metadata":{"colab_type":"text","id":"PA9WOB4zJfCu"},"source":["# Installation on Google Collab\n","To install `QMCTorch` copy the code from one of the 3 text cells below in a code cell and run that cell. "]},{"cell_type":"markdown","metadata":{"colab_type":"text","id":"6KLOhN_dGQ11"},"source":["## Install QMCTorch from Pypi Package manager\n","\n","```\n","! pip install qmctorch\n","```\n","\n"]},{"cell_type":"markdown","metadata":{"colab_type":"text","id":"Eb9wI3eOGfz1"},"source":["## Install QMCTorch from GitHub\n","```\n","from google.colab import drive\n","drive.mount('/content/gdrive')\n","% cd gdrive/My Drive/\n","! git clone https://github.com/NLESC-JCER/QMCTorch\n","% cd QMCTorch\n","! pip install -e .\n","% cd ../\n","```"]},{"cell_type":"markdown","metadata":{"colab_type":"text","id":"_VNw5sAeHC7M"},"source":["## Pull latest code from Github\n","```\n","from google.colab import drive\n","drive.mount('/content/gdrive')\n","% cd gdrive/My Drive/QMCTorch\n","! git pull origin master\n","! pip install -e .\n","% cd ../\n","```"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":671},"colab_type":"code","executionInfo":{"elapsed":9770,"status":"ok","timestamp":1588617088336,"user":{"displayName":"Nicolas Renaud","photoUrl":"","userId":"07120063468244602126"},"user_tz":-120},"id":"khGd1-ewHZWF","outputId":"674fbe9e-7817-4e11-cc91-cd508bda8107","vscode":{"languageId":"python"}},"outputs":[],"source":["# from google.colab import drive\n","# drive.mount('/content/gdrive')\n","# % cd gdrive/My Drive/QMCTorch\n","# ! git pull origin master\n","# ! pip install -e .\n","# % cd .."]},{"cell_type":"markdown","metadata":{"colab_type":"text","id":"MGNu_L-OJ-7u"},"source":["# Using QMCTorch"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":52},"colab_type":"code","executionInfo":{"elapsed":11632,"status":"ok","timestamp":1588617090211,"user":{"displayName":"Nicolas Renaud","photoUrl":"","userId":"07120063468244602126"},"user_tz":-120},"id":"p7qEQTV2HB4h","outputId":"52c2bbce-3775-442c-95de-d18bd432c2e3","vscode":{"languageId":"python"}},"outputs":[],"source":["import torch\n","from torch import optim\n","from qmctorch.scf import Molecule\n","from qmctorch.wavefunction import SlaterJastrow\n","from qmctorch.solver import Solver\n","from qmctorch.sampler import Metropolis\n","from qmctorch.utils import set_torch_double_precision\n","from qmctorch.utils import plot_energy, plot_data"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"x-s06JyaHUdN","vscode":{"languageId":"python"}},"outputs":[],"source":["use_gpu = torch.cuda.is_available()\n","set_torch_double_precision()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":52},"colab_type":"code","executionInfo":{"elapsed":11608,"status":"ok","timestamp":1588617090213,"user":{"displayName":"Nicolas Renaud","photoUrl":"","userId":"07120063468244602126"},"user_tz":-120},"id":"7HO4cNaAID-F","outputId":"a1f652aa-9bcb-4e9b-c038-833b29da2eae","vscode":{"languageId":"python"}},"outputs":[],"source":["mol = Molecule(atom='H 0 0 0.69; H 0 0 -0.69', unit='bohr', \\\n"," calculator='pyscf', basis='sto-3g')"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"hFZg-XanIOeY","vscode":{"languageId":"python"}},"outputs":[],"source":["wf = SlaterJastrow(mol, configs='cas(2,2)', cuda=use_gpu)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"Mqlk1N3tIVXN","vscode":{"languageId":"python"}},"outputs":[],"source":["sampler = Metropolis(nwalkers=2000, nstep=2000, step_size=0.2, \\\n"," ntherm=-1, ndecor=100, nelec=wf.nelec, \\\n"," init=mol.domain('atomic'), \\\n"," move={'type':'all-elec', 'proba':'normal'},\n"," cuda=use_gpu)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"5-I7abLxI5qG","vscode":{"languageId":"python"}},"outputs":[],"source":["lr_dict = [{'params': wf.jastrow.parameters(), 'lr': 3E-3},\n"," {'params': wf.ao.parameters(), 'lr': 1E-6},\n"," {'params': wf.mo.parameters(), 'lr': 1E-3},\n"," {'params': wf.fc.parameters(), 'lr': 2E-3}]\n","opt = optim.Adam(lr_dict, lr=1E-3)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"xgXSp8JwJIr9","vscode":{"languageId":"python"}},"outputs":[],"source":["scheduler = optim.lr_scheduler.StepLR(opt, step_size=100, gamma=0.90)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"g6TE--nNJL1H","vscode":{"languageId":"python"}},"outputs":[],"source":["solver = Solver(wf=wf, sampler=sampler,\n"," optimizer=opt, scheduler=scheduler)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":87},"colab_type":"code","executionInfo":{"elapsed":26805,"status":"ok","timestamp":1588617105475,"user":{"displayName":"Nicolas Renaud","photoUrl":"","userId":"07120063468244602126"},"user_tz":-120},"id":"Y5MPLiv2JTCy","outputId":"ef067f86-11b3-48e0-9dac-dc8ff5784905","vscode":{"languageId":"python"}},"outputs":[],"source":["# obs = solver.single_point()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{},"colab_type":"code","id":"yfx4g1Luz9Z-","vscode":{"languageId":"python"}},"outputs":[],"source":["# solver.configure(freeze=['ao', 'mo'], loss='energy', grad='manual')\n","# solver.track_observable(['local_energy'])\n","\n","# solver.configure_resampling(mode='update',\n","# resample_every=1,\n","# nstep_update=50)\n","# solver.ortho_mo = False"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"colab_type":"code","executionInfo":{"elapsed":52595,"status":"ok","timestamp":1588617131289,"user":{"displayName":"Nicolas Renaud","photoUrl":"","userId":"07120063468244602126"},"user_tz":-120},"id":"VtrVSk620A1A","outputId":"32ad9904-40e5-4efa-bcee-27145e04cfd4","vscode":{"languageId":"python"}},"outputs":[],"source":["# obs = solver.run(50)"]}],"metadata":{"accelerator":"GPU","colab":{"authorship_tag":"ABX9TyMr6DKmNBGlyg+0pzpuupgz","name":"qmctorch.ipynb","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"}},"nbformat":4,"nbformat_minor":0}
4 changes: 0 additions & 4 deletions docs/example/example_gpu.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/example/example_horovod.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/example/example_opt.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/example/example_sp.rst

This file was deleted.

4 changes: 2 additions & 2 deletions example/gpu/h2.py → docs/example/gpu/h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from qmctorch.scf import Molecule
from qmctorch.wavefunction import SlaterJastrow
from qmctorch.solver import SolverSlaterJastrow
from qmctorch.solver import Solver
from qmctorch.sampler import Metropolis
from qmctorch.utils import set_torch_double_precision
from qmctorch.utils import (plot_energy, plot_data)
Expand Down Expand Up @@ -45,7 +45,7 @@
scheduler = optim.lr_scheduler.StepLR(opt, step_size=100, gamma=0.90)

# QMC solver
solver = SolverSlaterJastrow(wf=wf, sampler=sampler,
solver = Solver(wf=wf, sampler=sampler,
optimizer=opt, scheduler=None)

# perform a single point calculation
Expand Down
12 changes: 7 additions & 5 deletions example/horovod/h2.py → docs/example/horovod/h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from qmctorch.scf import Molecule
from qmctorch.wavefunction import SlaterJastrow
from qmctorch.solver import SolverSlaterJastrowHorovod
from qmctorch.solver import SolverMPI
from qmctorch.sampler import Metropolis
from qmctorch.utils import set_torch_double_precision
from qmctorch.utils import (plot_energy, plot_data)
Expand All @@ -15,7 +15,8 @@
# bond dissociation energy 4.478 eV -> 0.16 hartree

hvd.init()
if torch.cuda.is_available():
use_cuda = torch.cuda.is_available()
if use_cuda:
torch.cuda.set_device(hvd.rank())

set_torch_double_precision()
Expand All @@ -29,14 +30,15 @@
# define the wave function
wf = SlaterJastrow(mol, kinetic='jacobi',
configs='cas(2,2)',
cuda=False)
cuda=use_cuda)

# sampler
sampler = Metropolis(nwalkers=200,
nstep=200, step_size=0.2,
ntherm=-1, ndecor=100,
nelec=wf.nelec, init=mol.domain('atomic'),
move={'type': 'all-elec', 'proba': 'normal'})
move={'type': 'all-elec', 'proba': 'normal'},
cuda=use_cuda)


# optimizer
Expand All @@ -50,7 +52,7 @@
scheduler = optim.lr_scheduler.StepLR(opt, step_size=100, gamma=0.90)

# QMC solver
solver = SolverSlaterJastrowHorovod(wf=wf, sampler=sampler,
solver = SolverMPI(wf=wf, sampler=sampler,
optimizer=opt, scheduler=scheduler,
rank=hvd.rank())

Expand Down
34 changes: 17 additions & 17 deletions example/optimization/h2.py → docs/example/optimization/h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from qmctorch.scf import Molecule
from qmctorch.wavefunction import SlaterJastrow
from qmctorch.solver import SolverSlaterJastrow
from qmctorch.sampler import Metropolis, Hamiltonian
from qmctorch.solver import Solver
from qmctorch.sampler import Metropolis
from qmctorch.utils import set_torch_double_precision
from qmctorch.utils import (plot_energy, plot_data)

Expand All @@ -26,43 +26,43 @@
# define the wave function
wf = SlaterJastrow(mol, kinetic='jacobi',
configs='single_double(2,2)',
jastrow_kernel=PadeJastrowKernel)
jastrow_kernel=PadeJastrowKernel).gto2sto()

# sampler
sampler = Hamiltonian(nwalkers=100, nstep=100, nelec=wf.nelec,
step_size=0.1, L=30,
ntherm=-1, ndecor=10,
init=mol.domain('atomic'))

sampler = Metropolis(nwalkers=5000,
nstep=200, step_size=0.2,
ntherm=-1, ndecor=100,
nelec=wf.nelec, init=mol.domain('atomic'),
move={'type': 'all-elec', 'proba': 'normal'})

# optimizer
lr_dict = [{'params': wf.jastrow.parameters(), 'lr': 3E-3},
lr_dict = [{'params': wf.jastrow.parameters(), 'lr': 1E-2},
{'params': wf.ao.parameters(), 'lr': 1E-6},
{'params': wf.mo.parameters(), 'lr': 1E-3},
{'params': wf.mo.parameters(), 'lr': 2E-3},
{'params': wf.fc.parameters(), 'lr': 2E-3}]
opt = optim.Adam(lr_dict, lr=1E-3)

# scheduler
scheduler = optim.lr_scheduler.StepLR(opt, step_size=100, gamma=0.90)
scheduler = optim.lr_scheduler.StepLR(opt, step_size=10, gamma=0.90)

# QMC solver
solver = SolverSlaterJastrow(wf=wf, sampler=sampler,
solver = Solver(wf=wf, sampler=sampler,
optimizer=opt, scheduler=None)

# perform a single point calculation
obs = solver.single_point()

# configure the solver
solver.configure(track=['local_energy'], freeze=['ao', 'mo'],
loss='energy', grad='auto',
solver.configure(track=['local_energy', 'parameters'], freeze=['ao'],
loss='energy', grad='manual',
ortho_mo=False, clip_loss=False,
resampling={'mode': 'update',
'resample_every': 1,
'nstep_update': 50})
'nstep_update': 25})

# optimize the wave function
obs = solver.run(250)
obs = solver.run(50)

# plot
plot_energy(obs.local_energy, e0=-1.1645, show_variance=True)
plot_data(solver.observable, obsname='jastrow.weight')
plot_data(solver.observable, obsname='jastrow.jastrow_kernel.weight')
23 changes: 23 additions & 0 deletions docs/example/scf/scf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from qmctorch.scf import Molecule

# Select the SCF calculator
calc = ['pyscf', # pyscf
'adf', # adf 2019
'adf2019' # adf 2020+
][1]

# select an appropriate basis
basis = {
'pyscf' : 'sto-6g',
'adf' : 'VB1',
'adf2019': 'dz'
}[calc]

# do the scf calculation
mol = Molecule(atom='H 0 0 -0.69; H 0 0 0.69',
calculator=calc,
basis=basis,
unit='bohr')



Loading