# Code Formulas

Below are code "formulas" for common tasks that come up when using ITensor. Please email us to suggest a formula you would like to see.

## General Formulas

- Creating your own "driver" code that builds against ITensor
- Running your program in debug mode
- Reading input from a file
- Writing and reading ITensor objects to and from HDF5 files

## ITensor Formulas

Formulas about working with ITensors, Index, etc.

- Evaluate a Function on Each Element of a Tensor
- Extract the Storage of a Dense ITensor
- Create a set of Site indices to use as a lattice
- Make a single-site operator (no quantum numbers)
- Exactly Compute the Ground State of a Small Hamiltonian
- Replace an ITensor Index with Another Index

## MPS and DMRG Formulas

Formulas involving matrix product states and DMRG.

**MPS Basics & Updating MPS****Running DMRG**- Perform a basic DMRG calculation
- Perform a quantum number (QN) conserving DMRG calculation
- Make a Ladder Hamiltonian for DMRG
- Make a 2D Hamiltonian for DMRG
- Compute excited states using DMRG
- Read and write an MPS or MPO to and from disk
- Stopping a DMRG Run "Gracefully"
- Making a Custom DMRGObserver
- Using a Mixed Site Set (Holstein Polaron Example)

**Measuring MPS****Time Evolution & Quantum Circuits**

Back to Main