2. Basic Back-propagation with CPU build#
This example covers running AFQMC for a generic input Hamiltonian to obtain the ground state energy, and one-rdm using back-propagation. It assumes that you already have an HDF5 file containing a Hamiltonian and trial wavefunction. If not, see the examples in Setting Up AFQMC.
Here, it is assumed that a Hamiltonian and a trial wavefunction are both saved in an HDF5 file called afqmc.h5. SAFIRE uses an input file in .json format to set parameters in calculations. The input file is explained in detail in Input file, but a minimal example is shown here.
{
"afqmc": {
"project": {
"id": "qmc",
"series": 0
},
"execute": {
"walker_set": {
"walker_type": "COLLINEAR"
},
"wavefunction": {
"filename": "afqmc.h5"
},
"timestep": 0.01,
"steps": 10000,
"n_walkers_per_mpi_task": 60,
"walker_ortho_interval" : 10,
"population_control_interval": 5,
"measure_interval_multiplier": 2,
"seed": 42,
"estimator": {
"name": "back_propagation",
"path_restoration": true,
"bp_walker_ortho_interval": 10,
"measure_interval_multiplier": 80,
"equil_multiplier": 80,
"onerdm": {
"name": "one_rdm"
}
}
}
}
}
Note that all intervals are expressed in units of “steps”, including those within the back_propagation block. The “name” field in the “estimator” block is used to specify the type of estimator. Alternatively, a “mixed” estimator can be used. “equil” is the number of equilibration steps to use before beginning back-propagation steps. Specific observables are added to the estimator by specifying them by within the “estimator” block. Here, we add a one-rdm observable. When we run the code, the output will be written to a file called “qmc.s000.stats.h5” where stochastic samples of the one-rdm are stored.
A CPU-only build of SAFIRE can be invoked on rusty using the following runscript,
#!/bin/bash -l
#SBATCH -J afqmc
#SBATCH --partition=ccq
#SBATCH --constraint=ib
#! Number of MPI ranks (= tasks for Slurm)
#SBATCH --ntasks=160
#SBATCH --time=0:30:00
export AFQMC_PATH=/path/to/your/afqmc/build
module purge
source $AFQMC_PATH/env.bash
# Launch MPI code...
srun --cpu-bind=cores $AFQMC_PATH/bin/safire --filenames afqmc.json &> afqmc.out
- If the Hamiltonian and trial wavefunction file from Rectangular Hubbard Model (called “afqmc.h5”) is used with the input file above,
then we will see output similar to this (perhaps with differences in the timing)
See Analyzing One-Body Reduced Density Matrix Data for an example of analyzing this output.