Scienza / Schroedinger

A Schroedinger Equation solver in C++, with flexible basis definition
GNU Lesser General Public License v2.1
31 stars 9 forks source link

Basis Initializer #35

Closed AndreaIdini closed 5 years ago

AndreaIdini commented 6 years ago

State

In the last commit before this issue, there is a stub for a public class (also commutable to structure) initializer.

The idea behind this is to get an intuitive and versatile initialisation of basis states.

It is related to problems throughout the last instance of the code #33 #30 #22 #8

Problem

The problem is that the state can be initialized in several different ways, and operator overload is boring, complicated and sometimes not straightforward to implement. E.g. we want to implement as continuous basis as int unsigned nbox; double mesh, or double start, end; int nbox and also double start, end, mesh;. A way to solve this is to overload operators.

But, when we want to initialise a spherical basis, other than one continuous r coordinate we need also quantized angular momentum quantum numbers. Therefore we can implement a spherical basis (l coupling) providing only maximum l either with 1 double and 2 int, or 2 double and 2 int, or 3 double and 1 int. But what if we want to provide min and max l? how could you overload? there are several possible overload combinations, and

Solutions:

pro - easy and straightforward to implement. cons - tedious implementation; many methods that can confuse user.

Implement in [this commit] (https://github.com/Scienza/Schroedinger/commit/230a020a2fb798579ff4d701aacf4cb2553ac7e3)

pro - versatile, agile, amazing, computersciency... etc... cons- as it is doesn't really fit the story

pro - easy cons- ?

Stories

Ideally we want the user (and us) to build factorized basis with ease. In pseudocode we could think to build a 3D spherical, j-coupled or ls-coupled basis, just like this in pseudocode:

Mesh = 0.1
Nbox = 1000
Lmax = 20
spin = 1/2
build(SphericalJ)

Or a 3D Cartesian

Mesh = 0.1
Nbox = 1000
build(Cartesian, 3)

Or directly providing the vector for cartesian

std::vec<double> x
build(Cartesian, 1)

or otherwise basis

std::vec<double> x
Lmax = 20
spin = 1/2
build(SphericalJ)
AndreaIdini commented 5 years ago

@mechanapoleon look here.

AndreaIdini commented 5 years ago

@GabrielePisciotta is this solved?

GabrielePisciotta commented 5 years ago

Many ways to initialize basis has been implemented. Can be closed.