aromanro / nrg

A simple program implementing the numerical renormalization group

Home Page:https://compphys.go.ro/the-numerical-renormalization-group/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nrg

A simple program implementing the numerical renormalization group

Codacy Badge CodeFactor

A more detailed description of the project is on the computational physics blog: https://compphys.go.ro/the-numerical-renormalization-group/

Everything related with NRG is either in the NRG namespace or has the class name starting with NRG. There are three kind of classes for NRG implementation, one is dealing with data passing around and adjusting and controlling the algorithm running, one is the operators, derived from the Operator abstract class and one is the NRG algorithms, derived from the abstract class NRGAlgorithm.

The rest of the program is very simple, just an interface to the NRG. It allows starting/stopping the computation, some configuration settings and it displays the charts. That's about it.

PROGRAM IN ACTION

Program video

TOOLS

The project compiles on Windows with Visual Studio 2015.

LIBRARIES

Besides mfc and other typical VC++ runtime libraries, the program uses GDI+ for drawing.

The program deals with matrices using Eigen: http://eigen.tuxfamily.org/index.php?title=Main_Page

CLASSES

The NRG Namespace:

ControllerInterface and ResultsRetrieverInterface are interfaces that allow by deriving from them classes that respectively cancel calculation and get the results from it.

The operators are derived from the Operator class. Operator::Extend() extends the operator by adding new states for the new Wilson site. Added states are in the most significant bits position. The changeSign member allows extending the operator matrix for fermionic operator type (if true) or bosonic operator type (if false). The minus sign there is due of anti-commutation. Classes derived from it are: Hamiltonian, the hopping operators FUpOperator and FDownOperator and the spectral operator, SpectralOperator. This one is a regular operator with some methods added that allow calculating the spectral function for the operator. DUpOperator is the spectral operator that is used for generating the spectral function for the Anderson and two quantum dots models.

The NRGAlgorithm class implements the NRG. From this class three examples are derived: QDAnderson, a quantum dot with the Anderson model, QDKondo, a quantum dot with the Kondo model, TwoQDRKKY, two quantum dots coupled by spin-spin interaction, only one being coupled to the leads. The later should be considered only qualitatively, to have better precision one should use symmetries for calculation. Anyway, it's enough to show the split of the Kondo resonance due of the two stage Kondo effect.

NRGComputationThread is the class that implements the computation thread for NRG, the calculations run in a different thread to avoid locking the UI.

NRGController is derived from NRG::ControllerInterface and allows cancelling computations (the thread checks it each computation step).

NRGResultsData is derived from NRG::ResultsRetrieverInterface and allows passing the results to the main thread and allows it to check if computation is finished.

The options are implemented by Options and they are saved/loaded into/from registry. The options UI are implemented by COptionsPropertySheet, CNRGPropertyPage, CParametersPropertyPage and CChartsPropertyPage.

The charts are implemented by the Chart class. It's pretty messy and far from perfect, I might improve it in the future. It uses GDI+ for drawing.

CAboutBox needs no explanation.

CMainFrame is the main frame window, it implements/routes commands.

CnrgApp is the application class. There aren't many changes in there except initializing and shutting down GDI+, setting the registry key and loading the options from registry.

CnrgDoc is the 'document' class. It contains the computation thread, the thread controller and the computation data objects. It also contains the chart objects. The most important member is CnrgDoc::StartComputation() the others are pretty straightforward.

CnrgView is the 'view' class. Has some changes compared with the class generated by App Wizard, related with drawing/printing. There is a timer implemented there which allows checking for computation finish and updating the charts. There is also some handling of the cursor, making it a 'wait' cursor during calculations.

CNumberEdit implements an edit box for double and float values. By setting allowNegative one can control if negative numbers can be entered or not.

ComputationThread is the base class for the NRG thread. There is not much in there, just starting the thread.

About

A simple program implementing the numerical renormalization group

https://compphys.go.ro/the-numerical-renormalization-group/

License:GNU General Public License v3.0


Languages

Language:C++ 94.7%Language:C 5.3%