Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
252a317
check energy is pass for wiggler methods
oscarxblanco Nov 10, 2025
c74340c
black, isor, flake8, numpy as np.; and energy check
oscarxblanco Nov 10, 2025
7218a92
energy=1e9; and black
oscarxblanco Nov 10, 2025
a943191
add RFCavityPass
oscarxblanco Dec 1, 2025
09e05bc
add RFCavityPass
oscarxblanco Dec 1, 2025
7724c5f
check if Energy exists
oscarxblanco Dec 1, 2025
bb8a422
check if Energy exists
oscarxblanco Dec 1, 2025
8016563
Merge branch 'master' into check_elem_track_needs_energy
oscarxblanco Dec 1, 2025
bb599d7
Merge branch 'master' into check_elem_track_needs_energy
oscarxblanco Dec 2, 2025
e550f11
restore from master
oscarxblanco Dec 3, 2025
0bd4453
check Param->energy
oscarxblanco Dec 3, 2025
de17590
check gamma
oscarxblanco Dec 3, 2025
b8f0876
check RFCavityPass
oscarxblanco Dec 3, 2025
b1bcbcb
add energy parameter
oscarxblanco Dec 17, 2025
8819a28
remove energy from lattice_track
oscarxblanco Dec 17, 2025
2494d4f
rename lattice to rflattice
oscarxblanco Dec 17, 2025
4e66393
pyat redefine atEnergy, atGamma
oscarxblanco Dec 22, 2025
2e997ff
check error
oscarxblanco Dec 22, 2025
a926212
check error
oscarxblanco Dec 22, 2025
4f76528
check error
oscarxblanco Dec 22, 2025
a98e1a0
add check_error
oscarxblanco Dec 22, 2025
6da92a7
rm asv
oscarxblanco Dec 22, 2025
052f68c
black isort flake8; numpy as np
oscarxblanco Dec 22, 2025
1c06e64
remove double definition atEnergy atGamma
oscarxblanco Dec 22, 2025
652fa5f
Merge branch 'master' into check_elem_track_needs_energy
oscarxblanco Dec 22, 2025
ba8c554
restore atelem
oscarxblanco Jan 5, 2026
616152c
add check_error
oscarxblanco Jan 5, 2026
9234171
check gamma == 0
oscarxblanco Jan 5, 2026
86712c1
check gamma == 0
oscarxblanco Jan 5, 2026
dbe20a5
check Energy
oscarxblanco Jan 5, 2026
2c30334
check Energy
oscarxblanco Jan 5, 2026
d462c70
check Energy
oscarxblanco Jan 5, 2026
7eb9905
check Energy
oscarxblanco Jan 5, 2026
baf49c1
check Energy
oscarxblanco Jan 5, 2026
04ce66a
check Energy
oscarxblanco Jan 5, 2026
48cd9fd
remove check_error
oscarxblanco Jan 5, 2026
d2327cc
check Energy
oscarxblanco Jan 5, 2026
c47d255
remove check_error
oscarxblanco Jan 5, 2026
71d94e6
check Energy
oscarxblanco Jan 5, 2026
348216b
check Energy
oscarxblanco Jan 5, 2026
69908c5
check Energy
oscarxblanco Jan 5, 2026
f975807
check Energy
oscarxblanco Jan 5, 2026
73408b6
check Energy
oscarxblanco Jan 5, 2026
88aa4d0
remove check_error
oscarxblanco Jan 5, 2026
68984dc
remove check_error
oscarxblanco Jan 5, 2026
51a498d
check Energy
oscarxblanco Jan 5, 2026
1c7fbaa
check Energy
oscarxblanco Jan 5, 2026
b2eff67
check Energy
oscarxblanco Jan 5, 2026
3cfdb4e
remove comment
oscarxblanco Jan 5, 2026
d6139ad
test rf element track
oscarxblanco Jan 5, 2026
294d495
flake8
oscarxblanco Jan 5, 2026
55bf4a8
remove ;
oscarxblanco Jan 5, 2026
4c8ef7b
remove extra space
oscarxblanco Jan 5, 2026
f96bf96
remove ;
oscarxblanco Jan 5, 2026
6f4f9b6
remove ;
oscarxblanco Jan 5, 2026
9a50c14
remove atEnergy
oscarxblanco Jan 5, 2026
31f060d
hard code pass methods in elempass.m
oscarxblanco Jan 5, 2026
87e8de7
fix energy
oscarxblanco Jan 5, 2026
d177814
remove unnecessary check_error
oscarxblanco Jan 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion atintegrators/BeamLoadingCavityPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
Energy=atGetOptionalDouble(ElemData,"Energy",Param->energy); check_error();
z_cuts=atGetOptionalDoubleArray(ElemData,"ZCuts"); check_error();
feedback_angle_offset=atGetOptionalDouble(ElemData,"feedback_angle_offset", 0.0); check_error();


/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

int dimsth[] = {Param->nbunch*nslice*nturns, 4};
atCheckArrayDims(ElemData,"_turnhistory", 2, dimsth); check_error();
int dimsvb[] = {Param->nbunch, 2};
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/BndMPoleSymplectic4E2RadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
RApertures=atGetOptionalDoubleArray(ElemData,"RApertures"); check_error();
KickAngle=atGetOptionalDoubleArray(ElemData,"KickAngle"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/BndMPoleSymplectic4QuantPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
RApertures=atGetOptionalDoubleArray(ElemData,"RApertures"); check_error();
KickAngle=atGetOptionalDoubleArray(ElemData,"KickAngle"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/BndMPoleSymplectic4RadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
RApertures=atGetOptionalDoubleArray(ElemData,"RApertures"); check_error();
KickAngle=atGetOptionalDoubleArray(ElemData,"KickAngle"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/CrabCavityPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
SigPhi = atGetOptionalDouble(ElemData,"SigPhi",0.0); check_error();
SigVV = atGetOptionalDouble(ElemData,"SigVV",0.0); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->Vx=Voltages[0];
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/ExactMultipoleRadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData, struct elem *Elem,
atError("NumIntSteps must be positive"); check_error();
}

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem *)atMalloc(sizeof(struct elem));
Elem->Length = Length;
Elem->PolynomA = PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/ExactRectBendRadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
atError("NumIntSteps == 0 not allowed with radiation"); check_error();
}

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/ExactRectangularBendRadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
atError("NumIntSteps must be positive"); check_error();
}

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/ExactSectorBendRadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
atError("NumIntSteps == 0 not allowed with radiation"); check_error();
}

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/GWigSymplecticPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
T1 = atGetOptionalDoubleArray(ElemData, "T1"); check_error();
T2 = atGetOptionalDoubleArray(ElemData, "T2"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Energy=Energy;
Elem->Length=Ltot;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/GWigSymplecticRadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
T1 = atGetOptionalDoubleArray(ElemData, "T1"); check_error();
T2 = atGetOptionalDoubleArray(ElemData, "T2"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Energy=Energy;
Elem->Length=Ltot;
Expand Down
10 changes: 9 additions & 1 deletion atintegrators/RFCavityPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
Energy=atGetOptionalDouble(ElemData,"Energy",energy); check_error();
TimeLag=atGetOptionalDouble(ElemData,"TimeLag",0); check_error();
PhaseLag=atGetOptionalDouble(ElemData,"PhaseLag",0); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->Voltage=Voltage;
Expand All @@ -56,7 +64,7 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
Elem->TimeLag=TimeLag;
Elem->PhaseLag=PhaseLag;
}
if (energy == 0.0) energy = Elem->Energy;
energy = atEnergy(energy, Elem->Energy);

RFCavityPass(r_in, Elem->Length, Elem->Voltage/energy, Elem->Frequency, Elem->HarmNumber, Elem->TimeLag,
Elem->PhaseLag, nturn, T0, num_particles);
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/StrMPoleSymplectic4QuantPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
RApertures=atGetOptionalDoubleArray(ElemData,"RApertures"); check_error();
KickAngle=atGetOptionalDoubleArray(ElemData,"KickAngle"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
7 changes: 7 additions & 0 deletions atintegrators/StrMPoleSymplectic4RadPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ ExportMode struct elem *trackFunction(const atElem *ElemData,struct elem *Elem,
RApertures=atGetOptionalDoubleArray(ElemData,"RApertures"); check_error();
KickAngle=atGetOptionalDoubleArray(ElemData,"KickAngle"); check_error();

/* Check energy */
Energy = atEnergy(Param->energy, Energy);
if (Energy == 0) {
atError("Energy needs to be defined. Check lattice parameters or pass method options.\n");
check_error();
}

Elem = (struct elem*)atMalloc(sizeof(struct elem));
Elem->Length=Length;
Elem->PolynomA=PolynomA;
Expand Down
2 changes: 1 addition & 1 deletion atmat/atphysics/Radiation/atdiffmat.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
end
% Calculate 6-by-6 linear transfer matrix in each element
% near the equilibrium orbit
m=findelemm66(elem,passm,orbit);
m=findelemm66(elem,passm,orbit,'Energy',energy);
% Cumulative diffusion matrix of the entire ring
BCUM = m*BCUM*m' + bdiff;
btx=BCUM;
Expand Down
22 changes: 22 additions & 0 deletions atmat/attrack/elempass.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@
props.Particle=particle;
end

method_req_energy = { 'BeamLoadingCavityPass' , ...
'BndMPoleSymplectic4E2RadPass', ...
'BndMPoleSymplectic4QuantPass', ...
'BndMPoleSymplectic4RadPass', ...
'CrabCavityPass', ...
'ExactMultipoleRadPass', ...
'ExactRectangularBendRadPass', ...
'ExactRectBendRadPass', ...
'ExactSectorBendRadPass', ...
'GWigSymplecticPass', ...
'GWigSymplecticRadPass', ...
'RFCavityPass', ...
'StrMPoleSymplectic4QuantPass', ...
'StrMPoleSymplectic4RadPass' ...
};

if any(strcmp(method_req_energy, methodname))
if props.Energy <= 0
error("Energy parameter must be defined.");
end
end

rout = feval(methodname,elem,rin,props);

end
Loading