Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidimensional basis and other improvements #43

Merged
merged 13 commits into from
Feb 12, 2019

Conversation

GabrielePisciotta
Copy link
Member

  • Numerov is now a class (precedently known as Schroedinger.cpp): you can instantiate a Numerov solver object and then use it passing the proper potential object. You can save wavefunction and probability to a file using the proper method, also you can directly print everything evaluated, also the energy, simply calling std::cout << solver (where solver is a Numerov object). It can handle separable potentials, so you can use it with multidimensional basis. (need tests!)
  • Potential class can now manage multidimensional basis (at the moment, considering only separable potentials), instead of taking only monodimensional vectors in input. Now you can also save the potential to a file, calling the proper method. Little changes such as using an enum instead of strings to define the type.
  • Created a new main executable, where you can run examples such as box, finite well and harmonic oscillator.
  • Fixed tests to be consistent with all the improvements

Copy link
Contributor

@Pandry Pandry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor tweaks that in my opinion should be at least noted, if not discussed...

Copy link
Member

@AndreaIdini AndreaIdini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the comments



std::vector<double> Numerov::findProbability() {
std::vector<double> probability = this->tempWavefunction;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should take wave function as input

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wavefunction is an object property, so the method take it using this->

return probability;
}

void Numerov::normalize(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The probability is an object property, so the method take it using this->

if (solver.getWavefunction().size() > 0) {
stream << "Wavefunction: " << std::endl;
for (double x : solver.getWavefunction())
stream << "\t" << x << std::endl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer spaces to tabs for ASCII compatibility.

Way better to print all together

x (from the basis)         waveFunction         Probability
0.000000                    1.234e-10            2.012e-20
0.100000 ...
...

Could be made into a easy issue for @Bhez

Copy link
Member

@AndreaIdini AndreaIdini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'uomo del monte ha detto si'!

@GabrielePisciotta GabrielePisciotta merged commit 4c439c6 into dev Feb 12, 2019
@GabrielePisciotta GabrielePisciotta deleted the temp-main-generalizedpotential branch February 12, 2019 23:39
@GabrielePisciotta GabrielePisciotta restored the temp-main-generalizedpotential branch February 13, 2019 16:07
@GabrielePisciotta GabrielePisciotta deleted the temp-main-generalizedpotential branch February 14, 2019 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants