Skip to content

Commit

Permalink
Added some documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkwagner committed Jan 2, 2021
1 parent de8e933 commit a85d0e3
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 16 deletions.
12 changes: 12 additions & 0 deletions doc/source/api_reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
API reference
-------------------------------

.. toctree::
:maxdepth: 2

highlevel
methods
wavefunction
accumulators
func3d
testwf
4 changes: 2 additions & 2 deletions doc/source/developer.md → doc/source/benchmarking.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Developer information
Benchmarking
-------------------------------

### Performance profiling
### Performance profiling using asv
Benchmarks are present in the /benchmark directory in the repository. These benchmarks can be run directly, or using [asv](https://asv.readthedocs.io).


Expand Down
5 changes: 5 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#extensions.append("faculty_sphinx_theme")
#html_theme = "faculty-sphinx-theme"

#html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


8 changes: 8 additions & 0 deletions doc/source/developer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Developer information
-------------------------------

.. toctree::
:maxdepth: 2

benchmarking
api_reference
17 changes: 3 additions & 14 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,14 @@ Welcome to pyQMC's documentation!
=================================

.. toctree::
:maxdepth: 2
:maxdepth: 1
:caption: Contents:

install

highlevel

tutorial
specific_instructions
developer

methods

wavefunction


accumulators

func3d
testwf

Indices and tables
==================

Expand Down
1 change: 1 addition & 0 deletions doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ GitHub
export PYTHONPATH:$PYTHONPATH:/path/to/pyqmc
`specific_instructions`



127 changes: 127 additions & 0 deletions doc/source/specific_instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Specific instructions for HPC machines
--------------------------------------------------------------


### Illinois campus cluster
#### Setting up your conda installation

Make sure your `.bashrc` is not loading another conda environment and that `PYTHONPATH` is not set. If it is, clear those things, log out, and log back in.

```
module load anaconda/3
conda create --name fast-mpi4py python=3.8
module load openmpi/3.1.1-gcc-7.2.0
export MPICC=$(which mpicc)
. /usr/local/anaconda/5.2.0/python3/etc/profile.d/conda.sh
conda activate fast-mpi4py
pip install -v --no-binary mpi4py mpi4py
pip install -v --no-binary numpy numpy
pip install pyscf
module load git
pip install git+git://github.com/WagnerGroup/pyqmc --upgrade
pip install snakemake
```

#### Submission script

```
#!/bin/bash
#SBATCH --time=24:00:00 # Job run time (hh:mm:ss)
#SBATCH --nodes=1 # Number of nodes
#SBATCH --ntasks-per-node=40 # Number of task (cores/ppn) per node
#SBATCH --job-name=a120
#SBATCH --partition=wagner
#SBATCH --output=myjob.o%j # Name of batch job output file
module load anaconda/3
module load openmpi/3.1.1-gcc-7.2.0
. /usr/local/anaconda/5.2.0/python3/etc/profile.d/conda.sh
conda activate fast-mpi4py
srun python test.py
```



#### snakemake setup

I would suggest starting with the setup here: https://github.com/WagnerGroup/Energy-Entropy

```
module load anaconda/3
module load openmpi/3.1.1-gcc-7.2.0
. /usr/local/anaconda/5.2.0/python3/etc/profile.d/conda.sh
conda activate fast-mpi4py
pip install cookiecutter
cookiecutter https://github.com/Snakemake-Profiles/slurm.git
```

The profile will be installed in `~/.config/snakemake/slurm`. I have changed my version of `slurm-submit.py` to include the partition:
```
RESOURCE_MAPPING = {
"time": ("time", "runtime", "walltime"),
"mem": ("mem", "mem_mb", "ram", "memory"),
"mem-per-cpu": ("mem-per-cpu", "mem_per_cpu", "mem_per_thread"),
"nodes": ("nodes", "nnodes"),
"partition": ("partition",)
}
```

Then your snakemake can look like the following, if you'd like to run on `qmc_threads` cores on one node and the secondary partition. Note the resources section in the rule.
```
rule VMC_MF:
input: hf="{dir1}/{dir2}/mf.chk", wffile="{dir1}/{dir2}/vmc_mf_{tol}_{orbs}_{nconfig}.chk"
output: "{dir1}/{dir2}/eval_mf_{tol}_{orbs}.chk"
threads: qmc_threads
resources:
walltime="4:00:00", partition="secondary"
run:
with concurrent.futures.ProcessPoolExecutor(max_workers=qmc_threads) as client:
functions.evaluate_vmc(input.hf, None, input.wffile, output[0],
slater_kws=None, nblocks=1000, client=client, npartitions=qmc_threads)
```
TODO: change this to work with MPI.

You can run by doing something like the following:
```
module load anaconda/3
module load openmpi/3.1.1-gcc-7.2.0
. /usr/local/anaconda/5.2.0/python3/etc/profile.d/conda.sh
conda activate fast-mpi4py
hostname >> run.out
nohup nice snakemake --jobs=10 --profile=slurm [filenames] > vmc.out &
```
You can run this on a login node and it will execute your jobs.



### Summit

Some information is available here: https://www.olcf.ornl.gov/wp-content/uploads/2019/02/STW_Feb_20190211_summit_workshop_python.pdf

Set up your environment:
```
module load python/3.7.0-anaconda3-5.3.0
conda create -n pyqmc3.8 python=3.8
conda init
. .bashrc
conda install numpy pandas h5py
module load gcc/4.8.5
CC=gcc MPICC=mpicc pip install --no-binary mpi4py install mpi4py
```

Install pyscf and pyqmc.
```
module load gcc/4.8.5
module load cmake
module load openblas/0.3.9-omp
git clone https://github.com/pyscf/pyscf
cd build
cmake ..
make
cd [pyscf root directory]
pip install .
pip install pyqmc
```
58 changes: 58 additions & 0 deletions doc/source/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Tutorial
----------------

Each of these snippets can be run in a separate

### Mean-field

```
from pyscf import gto, scf
mol = gto.M(
atom="""
O 0.0000000, 0.000000, 0.00000000
H 0.761561 , 0.478993, 0.00000000
H -0.761561, 0.478993, 0.00000000""",
basis="ccecp-ccpvtz",
ecp={"O": "ccecp"},
)
mf = scf.RHF(mol)
mf.chkfile = "mf.chk"
mf.run()
```


### Optimize wave function

```
import pyqmc.recipes
pyqmc.recipes.OPTIMIZE("mf.chk", "opt.chk", nconfig=1000,
linemin_kws={"max_iterations": 30 },
slater_kws={"optimize_orbitals": False},
)
```

### VMC evaluation

```
import pyqmc.recipes
pyqmc.recipes.VMC("scf.chk", "vmc.chk",
start_from="opt.chk",
accumulators={"energy": True, "rdm1": True},
vmc_kws={"nblocks": 100},
)
```

### DMC evaluation

```
import pyqmc.recipes
pyqmc.recipes.DMC("scf.chk", "dmc.chk",
start_from="opt.chk",
accumulators={"energy": True, "rdm1": True},
vmc_kws={"nblocks": 100},
)
```

0 comments on commit a85d0e3

Please sign in to comment.