Learn to Use ITensor
Stopping a DMRG Run "Gracefully"
Often it is helpful to set DMRG to do more sweeps than is needed, monitor its convergence, then stop it manually when converged. But killing the process would not allow any cleanup, final measurements, or saving of the wavefunction.
Fortunately the DMRG code included with ITensor can be stopped gracefully
(meaning, it finishes whichever sweep it is on then exits normally)
by simply putting a file named
STOP_DMRG in the directory where
the DMRG process is running. A nice unix command to use for
creating this file is:
touch command creates an empty file if it doesn't already exist
(otherwise it updates the file's time stamp).
The iDMRG code included with ITensor works a bit differently from the
finite DMRG code, in that it uses the finite DMRG as an inner loop.
STOP_DMRG file will only exit from this inner loop and
won't stop the iDMRG process.
To stop iDMRG, do the following:
Internally, this keeps the object governing the DMRG algorithm's behavior in a permanent "stop now" state, causing iDMRG to quit after it finishes the step it is currently on.
STOP_DMRG_ALL file functionality is handled
in ITensor by the
DMRGObserver class. You can customize this class
by creating your own subclass of it. The (virtual) class method
of DMRGObserver responsible for ending a DMRG calculation is called
checkDone, and in
checkDone just looks for
STOP_DMRG_ALL files, signaling done
true) if they are found.
In your own subclass of
DMRGObserver you have a few options:
checkDonejust inherits the same behavior as
DMRGObserver::checkDone()allows you to combine your own custom "done" conditions with the default behavior.
Finally, overriding and ignoring
DMRGObserver::checkDone()lets you turn off the
STOP_DMRGfile checking, allowing you to replace it with other custom "done" conditions.
Back to Formulas
Back to Main