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

Update and centralize the C constants #691

Merged
merged 10 commits into from
Nov 16, 2023
3 changes: 1 addition & 2 deletions atintegrators/BeamLoadingCavityPass.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "atconstants.h"
#include "atelem.c"
#include "atimplib.c"
#include "attrackfunc.c"
Expand All @@ -6,8 +7,6 @@
* BeamLoadingCavity pass method by Simon White.
*
*/

#define C0 2.99792458e8

struct elem
{
Expand Down
6 changes: 1 addition & 5 deletions atintegrators/BndMPoleSymplectic4E2Pass.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

struct elem
{
double Length;
Expand Down
10 changes: 1 addition & 9 deletions atintegrators/BndMPoleSymplectic4E2RadPass.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

#define SQR(X) ((X)*(X))

struct elem
Expand Down Expand Up @@ -44,10 +40,6 @@ struct elem
Last modified on 8/26/2009
*/


#define TWOPI 6.28318530717959
#define CGAMMA 8.846056192e-05

static double B2perp(double bx, double by, double irho,
double x, double xpr, double y, double ypr)
/* Calculates sqr(|e x B|) , where e is a unit vector in the direction of velocity */
Expand Down
6 changes: 1 addition & 5 deletions atintegrators/BndMPoleSymplectic4Pass.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"
#include "driftkick.c" /* fastdrift and bndthinkick */
#include "quadfringe.c" /* QuadFringePassP, QuadFringePassN */

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

struct elem
{
double Length;
Expand Down
6 changes: 1 addition & 5 deletions atintegrators/BndMPoleSymplectic4QuantPass.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"
Expand All @@ -6,11 +7,6 @@
#include "quadfringe.c" /* QuadFringePassP, QuadFringePassN */
#include <math.h>

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

struct elem
{
double Length;
Expand Down
6 changes: 1 addition & 5 deletions atintegrators/BndMPoleSymplectic4RadPass.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"
#include "driftkickrad.c" /* bndthinkickrad.c */
#include "quadfringe.c" /* QuadFringePassP, QuadFringePassN */

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

struct elem
{
double Length;
Expand Down
6 changes: 1 addition & 5 deletions atintegrators/BndStrMPoleSymplectic4Pass.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "atphyslib.c"
#include "driftkick.c" /* strthinkick.c */

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

/* Straight dipole w/ multipole using Symplectic Integration and rotation at
* dipole faces.
* Created by Xiaobiao Huang, 7/31/2018 */
Expand Down
5 changes: 1 addition & 4 deletions atintegrators/CavityPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
* Revision 3/10/04
* A.Terebilo
*/

#include "atconstants.h"
#include "atelem.c"

#define TWOPI 6.28318530717959
#define C0 2.99792458e8

struct elem
{
double Length;
Expand Down
3 changes: 1 addition & 2 deletions atintegrators/DeltaQPass.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"

#define TWOPI 6.28318530717959

struct elem
{
double Alphax;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactMultipolePass.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "driftkick.c" /* fastdrift.c, strthinkick.c */
#include "exactdrift.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem {
double Length;
double *PolynomA;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactMultipoleRadPass.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "exactdrift.c"
#include "exactkickrad.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem {
double Length;
double *PolynomA;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactRectBendPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "driftkick.c" /* strthinkick.c */
#include "exactbend.c"
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactRectBendRadPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "exactkickrad.c"
#include "exactbend.c"
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactRectangularBendPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "exactdrift.c"
#include "driftkick.c" /* strthinkick.c */
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactRectangularBendRadPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "exactdrift.c"
#include "exactkickrad.c"
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactSectorBendPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "driftkick.c" /* strthinkick.c */
#include "exactbend.c"
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
18 changes: 1 addition & 17 deletions atintegrators/ExactSectorBendRadPass.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "exactkickrad.c"
#include "exactbend.c"
#include "exactbendfringe.c"
#include "exactmultipolefringe.c"

/* Generated by:

#!/usr/bin/env python
c1 = 1.0/(2.0*(2.0-2.0**(1.0/3.0)))
c2 = (1-2**(1.0/3.0))/(2.0*(2.0-2.0**(1.0/3.0)))
d1 = 1.0/(2.0-2.0**(1.0/3.0))
d2 = -(2**(1.0/3.0)/(2.0-2.0**(1.0/3.0)))
print(f"#define DRIFT1 {c1: .18}")
print(f"#define DRIFT2 {c2: .18}")
print(f"#define KICK1 {d1: .18}")
print(f"#define KICK2 {d2: .18}")
*/
#define DRIFT1 0.675603595979828886
#define DRIFT2 -0.17560359597982883
#define KICK1 1.35120719195965777
#define KICK2 -1.70241438391931532

struct elem
{
double Length;
Expand Down
1 change: 1 addition & 0 deletions atintegrators/RFCavityPass.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Nicola Carmignani
*/

#include "atconstants.h"
#include "attrackfunc.c"


Expand Down
6 changes: 1 addition & 5 deletions atintegrators/StrMPoleSymplectic4Pass.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#include "atconstants.h"
#include "atelem.c"
#include "atlalib.c"
#include "driftkick.c" /* fastdrift.c, strthinkick.c */
#include "quadfringe.c" /* QuadFringePassP, QuadFringePassN */

#define DRIFT1 0.6756035959798286638
#define DRIFT2 -0.1756035959798286639
#define KICK1 1.351207191959657328
#define KICK2 -1.702414383919314656

struct elem
{
double Length;
Expand Down
Loading
Loading