Input and Configuration
This page describes the startup side of the codebase: how param and data are interpreted, how symmetry is selected, and how the initial runtime objects are constructed.
Runtime Inputs
The native executable expects two files in the working directory:
param: user-facing runtime configurationdata: generated seed data for the first NRG step
The split is intentional:
paramcontrols how the run should proceeddatacontains the precomputed initial Hamiltonian basis, operator blocks, and coefficient tables
param Parsing
Params is defined in c++/params.hpp.
Important characteristics:
- user-facing parameters are stored as many
param<T>members Paramsalso holds derived runtime quantities such asNmax,Nlen, and channel/combinatorics metadata- the constructor parses a named block from
param, normally[param] - if an
[extra]block is present, it is parsed intoextra_params
Startup flow in the constructor is roughly:
- parse the requested block from
param - apply recognized values to the registered
param<T>members - print any leftover keys as unused settings
- optionally parse
[extra] - validate the resulting configuration
- initialize resume-related bookkeeping
data Parsing
The data file is read by InputData<S> in c++/read-input.hpp.
The InputData constructor performs these steps:
- read the file header and version information
- extract symmetry name, channel count,
Nmax, and the number of initial subspaces - instantiate the correct
Symmetry<S>backend throughset_symmetry(...) - load the seed eigenspectrum into
DiagInfo<S> - load the seed
foperators intoOpch<S> - read the remaining operator blocks and coefficient tables
- finalize chain-length-related derived parameters in
Params
Symmetry Selection
Symmetry objects are created through set_symmetry(...) in c++/mk_sym.hpp.
That function:
- resets the global
Invarmetadata - stores the selected
symtypeintoParams - derives channel and combination counts
- constructs the matching concrete symmetry backend
- loads backend-specific quantum number tables
This means the symmetry object is a structural dependency for almost everything that follows:
- interpreting invariant subspaces
- generating new subspaces
- building Hamiltonians
- recalculating operators
Coefficients And Derived Lengths
Coef<S> is populated while reading the data blocks. After that, determine_Nmax_Nlen(...) in read-input.hpp finalizes the effective number of iteration steps, taking substeps into account.
This is an important boundary: before data is loaded, Params is not fully initialized for iteration; after data is loaded, the runtime has enough information to start the NRG loop.
Ownership After Initialization
Once NRG_calculation is constructed in c++/nrg-general.hpp, the startup objects are held like this:
NRG_calculation
├── Params P
├── InputData<S> input
│ ├── shared_ptr<Symmetry<S>> Sym
│ ├── DiagInfo<S> diag
│ ├── Operators<S> operators
│ └── Coef<S> coef
├── Stats<S> stats
├── ThermoStore<S> store
└── BackiterStore store_all
From this point on, the runtime has everything it needs to start run_phase(RUNTYPE::NRG, ...).
Why This Matters For Contributors
If you change any of the following, this page's area of the code is where you should start:
- adding a new parameter
- changing parameter validation
- altering the
datafile format - selecting or configuring symmetry backends
- modifying chain-length or coefficient initialization rules
For the next stage after startup, see Iteration engine.