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

Changes in sroptcryst.h to add Laue geometry #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Angelrf86
Copy link

Dear all,

We have been working in adding the Laue Case to SRW. This is the merge request after having cross check that the simulations perform with the Laue code fit the theory and comparison with other codes.

Best wishes,
Angel, Ilia, Liubov

@@ -52,9 +54,13 @@ class srTOptCryst : public srTGenOptElem {
//TVector3d m_nv; // horizontal, vertical and longitudinal coordinates of outward normal to crystal surface in the frame of incident beam
TVector3d m_tv; // horizontal, vertical and longitudinal coordinates of central tangential vector [m] in the frame of incident beam
TVector3d m_sv; // horizontal, vertical and longitudinal coordinates of central saggital vector [m] in the frame of incident beam
TVector3d v_nv; //* horizontal, vertical and longitudinal coordinates of outward normal to crystal surface in the frame of incident beam */ //ARF06062019 Introduce Vector3d& v_nv,
Copy link
Owner

Choose a reason for hiding this comment

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

It's not clear why this (redundant) vector is re-introduced; it seems to be still used only in ctor (srTOptCryst::srTOptCryst). I reject this for the moment.

int m_uc; // crystal use case: 1- Bragg Reflection, 2- Bragg Transmission
// case: 3- Laue, 4- Laue Transmission ARF08052019 change char to

int m_ug; //ARF2305219 This variable define Laue (2) or Bragg (1)
Copy link
Owner

Choose a reason for hiding this comment

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

Do we really need it, if m_uc now clearly identifies each of the 4 supported cases. I reject this for the moment.

TVector3d v_nv; //* horizontal, vertical and longitudinal coordinates of outward normal to crystal surface in the frame of incident beam */ //ARF06062019 Introduce Vector3d& v_nv,

int m_uc; // crystal use case: 1- Bragg Reflection, 2- Bragg Transmission
// case: 3- Laue, 4- Laue Transmission ARF08052019 change char to
Copy link
Owner

Choose a reason for hiding this comment

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

Why changing char to int (char can have values 1 to 4)? I reject for the moment.

@@ -68,10 +74,13 @@ class srTOptCryst : public srTGenOptElem {
double m_PolTrn[2][2]; // 2x2 transformation matrix of the polarizations from (e1X,e2X) to (sg0X,pi0X).
double m_InvPolTrn[2][2]; //OC06092016
double m_HXAi[3]; // Reciprocal lattice vector coordinates
double m_HXAi_bee[3]; //ARF03062019 Reciprocal lattice vector coordinates in beam coordinates
Copy link
Owner

Choose a reason for hiding this comment

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

Added.


double m_sg0X[3];
double m_cos2t; //cos(2.*thBrd);

double thBrd; //ARF23052019 to calculate the gamma0 and gammaH
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure why double thBrd, alphrd need to be member variables; they seem to be used only in ctor. I reject for the moment.

@@ -154,11 +184,24 @@ class srTOptCryst : public srTGenOptElem {
double uBrd = m_RLabXt[0][2] * m_HXAi[0] + m_RLabXt[1][2] * m_HXAi[1] + m_RLabXt[2][2] * m_HXAi[2];
double uHX = sqrt(m_HXAi[0] * m_HXAi[0] + m_HXAi[1] * m_HXAi[1] + m_HXAi[2] * m_HXAi[2]);
double uRL = sqrt(m_RLabXt[0][2] * m_RLabXt[0][2] + m_RLabXt[1][2] * m_RLabXt[1][2] + m_RLabXt[2][2] * m_RLabXt[2][2]);
const double pi = 4.*atan(1.);
double thBrd = acos(uBrd / uHX / uRL) - pi / 2.;

Copy link
Owner

Choose a reason for hiding this comment

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

I reject this for the moment.

m_HXAi_bee[0] = 0; //ARF03062019 Change definition for the calculation of bee
m_HXAi_bee[1] = - sin(thBrd) / m_dA; //IP14062019 for Laue pi/2 rotation of rec. vector from Bragg
m_HXAi_bee[2] = - cos(thBrd) / m_dA; //IP14062019
}
Copy link
Owner

Choose a reason for hiding this comment

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

Added.

@@ -256,7 +299,7 @@ class srTOptCryst : public srTGenOptElem {
**/
}

void FindDefOutFrameVect(double phEn, double hn, double ht, TVector3d& tv, TVector3d& sv, TVector3d& vZ1, TVector3d& vX1)
void FindDefOutFrameVect(double phEn, double hn, double ht, TVector3d& nv, TVector3d& tv, TVector3d& sv, TVector3d& vZ1, TVector3d& vX1) //ARF06062019 Introduce Vector3d& nv,
Copy link
Owner

Choose a reason for hiding this comment

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

I reject this for the moment.

@@ -886,7 +929,8 @@ class srTOptCryst : public srTGenOptElem {
// deviation parameter Adev and normalized deviation parameter zeeC (as
// defined by Zachariasen gamma0, b, alpha and z.)
double gamma0 = -u0X[1];
double bee = 1. / (1. + m_HXAi[1] / k0wXAi[1]);
double bee = 1. / (1. + (m_HXAi_bee[1] * m_RXtLab[1][1] + m_HXAi_bee[2] * m_RXtLab[2][1]) / k0wXAi[1]); //ARF03062019 change from: double bee = 1. / (1. + m_HXAi[1] / k0wXAi[1]);
Copy link
Owner

Choose a reason for hiding this comment

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

Done.

Cph2C = exp(ph2C);
D0trsC = -Cph2C*(x2C - x1C)/x1C;
}
else if(real(ph2C) > logDBMax)
Copy link
Owner

Choose a reason for hiding this comment

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

These modifications look scary to me, as you remove special processing of possible overflow cases.
I have to compare these changes with John's code for the Laue case before proceeding.

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.

None yet

2 participants