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

Input radius and skin thickness #31

Conversation

MichaelHeines
Copy link

I've implemented basic changes such that you can give input values for the size/shape of the nucleus. The radius keyword takes the solid sphere equivalent radius (as was happening internally before) and the skin thickness changes 't' in the Fermi2 model.

These changes are mainly useful for the nuclear/particle physics side of the muonic atom community. With the radius, one can evaluate how precise one needs to determine the transition energy for a certain experimental radius precision. With the skin thickness, it's also possible to evaluate what systematics are induced by changes in the nuclear shape.

@subindev-d subindev-d self-requested a review September 11, 2024 16:58
@subindev-d subindev-d changed the base branch from main to dev September 12, 2024 09:55
Copy link
Contributor

@subindev-d subindev-d left a comment

Choose a reason for hiding this comment

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

hi looks good to me, there are few formatting needed .
You may format the code using astyle which can be installed using sudo apt install astyle in Ubuntu

for this project, the code can be formatted by running astyle src/*.cpp src/*.hpp lib/*.cpp lib/*.hpp --style=google -s2 -S -n command in the source code directory.

Once that's done I can implement the limits for the thickness and radius as mentioned in #32

lib/atom.cpp Outdated
@@ -112,24 +112,35 @@ Atom::Atom(int Z, double m, int A, NuclearRadiusModel radius_model, double fc,
// Define radius
if (A == -1) {
R = -1;
} else {
} else if (radius < 0) {
Copy link
Contributor

@subindev-d subindev-d Sep 16, 2024

Choose a reason for hiding this comment

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

@MichaelHeines , could you please explain this check?

Copy link
Author

Choose a reason for hiding this comment

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

This is something Frederik put in and I slightly tweaked. If I'm not mistaken, this check tells you whether or not an input radius is given. If it isn't given, radius = -1, which defaults to the standard methods from mudirac. I suppose one could also rewrite this as else if (radius == -1)

Copy link
Contributor

Choose a reason for hiding this comment

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

Then it would be good to write it as radius == -1, less confusing.

Suggested change
} else if (radius < 0) {
} else if (radius == -1) {

lib/atom.cpp Outdated
}

if (radius_model == FERMI2) {
V_coulomb = new CoulombFermi2Potential(Z, R, A);
} else {
} else if (radius_model == SPHERE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Currrenlty if the radiusl_model == 'POINT' case is ignored, It would be cause error if the keyword nuclear_model: POINT.

Suggested change
} else if (radius_model == SPHERE) {
} else {

lib/atom.cpp Outdated
@@ -83,7 +83,7 @@ double TransitionMatrix::totalRate() {
* @param dx: Logarithmic step of the grid (default = 0.005)
* @retval
*/
Atom::Atom(int Z, double m, int A, NuclearRadiusModel radius_model, double fc,
Atom::Atom(int Z, double m, int A, double radius, NuclearRadiusModel radius_model, double fc,
Copy link
Contributor

Choose a reason for hiding this comment

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

documentation comment @param radius: missing for the new parameter
reference

lib/atom.cpp Outdated
@@ -112,24 +112,35 @@ Atom::Atom(int Z, double m, int A, NuclearRadiusModel radius_model, double fc,
// Define radius
if (A == -1) {
R = -1;
} else {
} else if (radius < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Then it would be good to write it as radius == -1, less confusing.

Suggested change
} else if (radius < 0) {
} else if (radius == -1) {

lib/atom.cpp Outdated
@@ -325,9 +337,9 @@ double Atom::sphereNuclearModel(int Z, int A) {
* (default = -1)
* @retval
*/
DiracAtom::DiracAtom(int Z, double m, int A, NuclearRadiusModel radius_model,
DiracAtom::DiracAtom(int Z, double m, int A, double R, NuclearRadiusModel radius_model,
Copy link
Contributor

Choose a reason for hiding this comment

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

missing comments for the documentation @param R:

@MichaelHeines
Copy link
Author

I've added the changes you requested. Besides that, I changed around some R to radius for clarity of use throughout the code. Let me know if there's anything else

@subindev-d subindev-d self-requested a review October 3, 2024 10:45
@subindev-d
Copy link
Contributor

I've added the changes you requested. Besides that, I changed around some R to radius for clarity of use throughout the code. Let me know if there's anything else

Hi currently some tests are failing, you may run the tests by make test command

introudcing the the newparmeter radius breaks the test_lines
@MichaelHeines
Copy link
Author

**subindev-d ** requested changes

I'm trying to figure out why things are different. In principle they shouldn't be. I don't see any cases that would be treated differently with these changes here. Would you mind having a look?

@subindev-d
Copy link
Contributor

**subindev-d ** requested changes

I'm trying to figure out why things are different. In principle they shouldn't be. I don't see any cases that would be treated differently with these changes here. Would you mind having a look?

It was becasue earlier there was only radius_model as an optional parameter, but now we added the radius parameter as well, so while the test was running it was giving value of radius_model to radius .
I fixed the tests in in these commits: fixing line test, other testst.
Eventhough it works, I am looking into if there are any good practices to implement multiple optional parameters.

As radius will be applicable only after changning radius_model, radius_model should be first
Copy link

@MilanSCD MilanSCD left a comment

Choose a reason for hiding this comment

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

Looks good to me. I agree optional parameters would be useful if any other parameters need to added or changed.

@subindev-d subindev-d merged commit 22cf900 into muon-spectroscopy-computational-project:dev Nov 7, 2024
1 check passed
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