GithubHelp home page GithubHelp logo

aromanro / nrg Goto Github PK

View Code? Open in Web Editor NEW
18.0 5.0 8.0 196 KB

A simple program implementing the numerical renormalization group

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

License: GNU General Public License v3.0

C++ 94.69% C 5.31%
physics computational-physics renormalization nrg quantum-dot spectral eigen mfc gdi-plus

nrg's Introduction

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.

nrg's People

Contributors

aromanro avatar codacy-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nrg's Issues

Use symmetries

As described on the blog, add some separate code that takes advantage of symmetries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.