-
Notifications
You must be signed in to change notification settings - Fork 0
Running with pyALF
pyALF is a Python interface that wraps ALF's parameter generation, compilation, execution, and analysis into a single scripted workflow. It is the recommended way to run ALF for most users.
Full documentation: pyALF docs
pyALF requires HDF5. ALF automatically downloads and compiles HDF5 on first compilation (~15 minutes).
pip install pyALFfrom py_alf import ALF_source, Simulation
# Point to your existing ALF source directory
alf_src = ALF_source(alf_dir="/path/to/ALF")
# Create a simulation with custom parameters
sim = Simulation(
alf_src,
"Hubbard", # Hamiltonian name
{"Lattice_type": "Square"}, # Override default parameters
machine='GNU' # Compiler: 'GNU', 'intel', or 'PGI'
)
sim.compile() # configures and compiles ALF (first run also builds HDF5)
sim.run() # runs the simulation
sim.analysis() # post-processes resultspyALF creates a directory tree, writes the parameters file, compiles ALF (if needed), runs the simulation, and calls the analysis programs — all from the Python script.
After analysis, read results into a Pandas DataFrame:
obs = sim.get_obs()
# Access the internal energy and its error
obs.iloc[0][['Ener_scal0', 'Ener_scal0_err']]Simulations can be resumed by calling sim.run() again — new bins are appended to existing data.
The pyALF documentation covers parameter scans, parallel runs, Jupyter notebooks, and advanced configuration. This wiki focuses on the underlying ALF code; see Running without pyALF for the direct Fortran workflow.