Skip to content

Commit

Permalink
Merge pull request #1075 from tpersson/fixCoupling2022
Browse files Browse the repository at this point in the history
Fixes a bug in the dqmin calculation.
  • Loading branch information
tpersson committed Feb 2, 2022
2 parents 0ffd882 + 6d4cd5d commit c0b52a5
Show file tree
Hide file tree
Showing 169 changed files with 32,272 additions and 4,160 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/make.yml
Expand Up @@ -181,7 +181,15 @@ jobs:
mingw-w64-${{ matrix.arch }}-toolchain
- name: Build MAD-X
run: make all-win${{ matrix.bits }}-gnu STATIC=no
run: make all-win${{ matrix.bits }}-gnu

- name: Upload artifact executable
uses: actions/upload-artifact@v2
with:
name: madx-windows
path: |
build
madx-win64-gnu.exe
- name: Run tests
# Skip 32bit build - it's broken and mind-boggelingly slow (>>2h)!
Expand Down
2 changes: 1 addition & 1 deletion Makefile_test
Expand Up @@ -93,7 +93,7 @@ test-sequence test-sequence-2 test-sequence-3 test-sequence-4 test-sequence-5 te
test-line \
test-plot test-plot-2 \
test-setknob test-fillknob \
test-coupling test-coupling-2 \
test-coupling test-coupling-2 test-coupling-dqmin \
test-machine-clear \
\
$(call onlx64,$(user-cases),)
Expand Down
6 changes: 4 additions & 2 deletions src/twiss.f90
Expand Up @@ -2520,7 +2520,9 @@ SUBROUTINE twcptk_twiss(matx, maty, R, error, currpos)

if (abs(f1001) .gt. eps) then
deltas = currpos - prev_pos_s
dqmin_rdt = dqmin_rdt + deltas * f1001*exp(-(cmplx(0d0,amuy)-cmplx(0d0,amux))+cmplx(0d0,delta_tune_dqmin*currpos)) &
dqmin_rdt = dqmin_rdt + deltas * &
f1001*exp(-(cmplx(0d0,amuy)-cmplx(0d0,amux))+ &
cmplx(0d0,delta_tune_dqmin*currpos/circ)) &
/ (one + 4d0* abs(f1001)**2)
dqmin_rdt_c = dqmin_rdt_c + 1
prev_pos_s = currpos
Expand Down Expand Up @@ -3589,7 +3591,7 @@ SUBROUTINE tw_summ(rt,tt)
! 'use chrom option or manual calculation')
! endif

dqmin2 = 4d0*abs((qx-floor(qx))-(qy-floor(qy)))*(abs(dqmin_rdt)/tot_int_length)
dqmin2 = 4d0*abs(delta_tune_dqmin/twopi)*(abs(dqmin_rdt)/tot_int_length)
dqmin_ph = atan2(aimag(dqmin_rdt), real(dqmin_rdt))
if(diff_bigger_sum/dqmin_rdt_c .gt. 0.1 .and. dqmin2 .ge. 1e-8) then
write (warnstr, '(a, I0, a, I0, a)') "The f1010 is bigger than the f1001 in: ", int(diff_bigger_sum), &
Expand Down
2 changes: 1 addition & 1 deletion testing/updateFromList.py
Expand Up @@ -48,7 +48,7 @@
# onlyfiles[i] = [mypath + onlyfiles[i]]

for f in onlyfiles:
if(f.endswith('.ref') and f.startswith("test-")):
if(f.endswith('.ref')):
oname = f[:-4]
print(oname, f)
if(isfile(oname)):
Expand Down
10 changes: 5 additions & 5 deletions tests/test-aperture-2/test-aperture-2.ref
@@ -1,9 +1,9 @@

++++++++++++++++++++++++++++++++++++++++++++
+ MAD-X 5.07.00 (64 bit, Linux) +
+ MAD-X 5.08.00 (64 bit, Linux) +
+ Support: mad@cern.ch, http://cern.ch/mad +
+ Release date: 2021.05.03 +
+ Execution date: 2021.12.10 13:04:40 +
+ Release date: 2022.01.13 +
+ Execution date: 2022.01.27 22:43:01 +
++++++++++++++++++++++++++++++++++++++++++++
TITLE, "LHC Version 6.503 - July 2009 - version with RCOLLIMATORs" ;

Expand Down Expand Up @@ -105,10 +105,10 @@ orbit: -2.000002E-03 -6.829941E-10 3.774066E-11 1.700000E-04 0.000000E+00 0
0 0 0 0

synch_6 synch_8 nflips dqmin
0 0 0 8.334552298e-10
0 0 0 7.142973632e-08

dqmin_phase
-1.571990328
1.84139616


! Initialize PTC
Expand Down
10 changes: 5 additions & 5 deletions tests/test-aperture-2/twiss-table.ref
Expand Up @@ -42,12 +42,12 @@
@ SYNCH_5 %le 0
@ SYNCH_6 %le 0
@ SYNCH_8 %le 0
@ DQMIN %le 8.334552298e-10
@ DQMIN_PHASE %le -1.571990328
@ DQMIN %le 7.142973632e-08
@ DQMIN_PHASE %le 1.84139616
@ TITLE %58s "LHC Version 6.503 - July 2009 - version with RCOLLIMATORs"
@ ORIGIN %16s "5.05.02 Linux 64"
@ DATE %08s "10/08/20"
@ TIME %08s "13.27.50"
@ ORIGIN %16s "5.08.00 Linux 64"
@ DATE %08s "27/01/22"
@ TIME %08s "23.17.56"
* NAME S BETX BETY X PX Y PY APERTYPE APER_1 ON_ELEM
$ %s %le %le %le %le %le %le %le %s %le %le
"TAS.1R1" 20.915 50.76701356 50.76701002 -0.002000016307 -6.829940792e-10 0.003555549899 0.0001699999934 "CIRCLE" 0 0
Expand Down
16 changes: 8 additions & 8 deletions tests/test-c6t-3/fc.3.aper.ref
@@ -1,8 +1,8 @@
qf.1_AP EL 20.000 10.000 0.000 0.000 0.000 0.000 0.000
mb_AP CR 100.000 0.000 0.000 0.000 0.000 0.000 0.000
qd.1_AP RT 22.000 23.000 1.000 2.000 0.000 0.000 0.000
qf.2_AP RL 22.000 20.000 23.000 21.000 1.000 2.000 90.000
qd.2_AP OC 30.000 40.000 30.000 60.000 0.000 0.000 0.000
qf.3_AP RC 24.000 23.000 22.000 0.000 3.000 4.000 0.000
qf.4_AP RC 26.000 25.000 24.000 0.000 0.000 0.000 0.000
qf.5_AP RE 30.000 35.000 0.000 0.000 0.001 0.000 0.000
qf.1_AP EL 20.000 10.000 0.000 0.000 0.000 0.000 0.000
mb_AP CR 100.000 0.000 0.000 0.000 0.000 0.000 0.000
qd.1_AP RT 22.000 23.000 1.000 2.000 0.000 0.000 0.000
qf.2_AP RL 22.000 20.000 23.000 21.000 1.000 2.000 90.000
qd.2_AP OC 30.000 40.000 30.000 60.000 0.000 0.000 0.000
qf.3_AP RC 24.000 23.000 22.000 0.000 3.000 4.000 0.000
qf.4_AP RC 26.000 25.000 24.000 0.000 0.000 0.000 0.000
qf.5_AP RE 30.000 35.000 0.000 0.000 0.001 0.000 0.000
4 changes: 2 additions & 2 deletions tests/test-c6t-3/fc.3.aux.ref
Expand Up @@ -10,6 +10,6 @@ QF 1.281097325030291
QD 1.292216906500214
NEXT
CHRO
SXF 0.872490887979457
SXD 0.867509055937630
SXF 0.872490887979456
SXD 0.867509055937631
NEXT
22 changes: 11 additions & 11 deletions tests/test-c6t-3/fc.34.ref
@@ -1,11 +1,11 @@
3.8150000000000e+00 mscbh 3 -1.0917111865000e-05 1.7924369660855e+02 3.0597074284989e+01 3.2712530203335e-03 2.0603536752444e-02
5.7275000000000e+01 mscbv.1 3 2.1791705650000e-05 3.1660437609589e+01 1.7274383527491e+02 1.3855765196596e-01 1.4227169607841e-01
1.1073500000000e+02 mscbh 3 -1.0917111865000e-05 1.6756921830298e+02 3.2694798495168e+01 2.5994849580212e-01 2.7798332831672e-01
1.6419500000000e+02 mscbv 3 2.1791705650000e-05 3.1781834870955e+01 1.7352366669396e+02 4.0121096586692e-01 3.9442324564822e-01
2.1765500000000e+02 mscbh 3 -1.0917111865000e-05 1.7931459012805e+02 3.0607806126140e+01 5.1733737648196e-01 5.3594180885701e-01
2.7111500000000e+02 mscbv 3 2.1791705650000e-05 3.1465409029190e+01 1.7381491395836e+02 6.5314946745811e-01 6.5711305009555e-01
3.2457500000000e+02 mscbh 3 -1.0917111865000e-05 1.6759641604922e+02 3.2665937558535e+01 7.7499919459582e-01 7.9234359636794e-01
3.7803500000000e+02 mscbv 3 2.1791705650000e-05 3.1974220826515e+01 1.7245511799076e+02 9.1565814307421e-01 9.0928955068959e-01
4.3149500000000e+02 mscbh 3 -1.0917111865000e-05 1.7918952825758e+02 3.0654545451696e+01 1.0314056314060e+00 1.0512656514764e+00
4.8495500000000e+02 mscbv 3 2.1791705650000e-05 3.1585792443468e+01 1.7458797120877e+02 1.1677723062569e+00 1.1718651966128e+00
5.3460000000000e+02 end_marker 100 0.0000000000000e+00 1.8277690916090e+02 2.9981397726461e+01 1.2810973250303e+00 1.2922169065002e+00
3.815000000000000e+00 mscbh 3 -1.091711186500000e-05 1.792436966085543e+02 3.059707428498908e+01 3.271253020333500e-03 2.060353675244352e-02
5.727500000000000e+01 mscbv.1 3 2.179170565000000e-05 3.166043760958879e+01 1.727438352749106e+02 1.385576519659640e-01 1.422716960784112e-01
1.107350000000000e+02 mscbh 3 -1.091711186500000e-05 1.675692183029791e+02 3.269479849516795e+01 2.599484958021241e-01 2.779833283167193e-01
1.641950000000000e+02 mscbv 3 2.179170565000000e-05 3.178183487095485e+01 1.735236666939625e+02 4.012109658669195e-01 3.944232456482201e-01
2.176550000000000e+02 mscbh 3 -1.091711186500000e-05 1.793145901280452e+02 3.060780612614005e+01 5.173373764819580e-01 5.359418088570065e-01
2.711150000000000e+02 mscbv 3 2.179170565000000e-05 3.146540902918960e+01 1.738149139583567e+02 6.531494674581061e-01 6.571130500955529e-01
3.245750000000000e+02 mscbh 3 -1.091711186500000e-05 1.675964160492165e+02 3.266593755853494e+01 7.749991945958171e-01 7.923435963679374e-01
3.780350000000000e+02 mscbv 3 2.179170565000000e-05 3.197422082651515e+01 1.724551179907607e+02 9.156581430742085e-01 9.092895506895887e-01
4.314950000000000e+02 mscbh 3 -1.091711186500000e-05 1.791895282575784e+02 3.065454545169567e+01 1.031405631406035e+00 1.051265651476362e+00
4.849550000000000e+02 mscbv 3 2.179170565000000e-05 3.158579244346770e+01 1.745879712087696e+02 1.167772306256908e+00 1.171865196612764e+00
5.346000000000000e+02 end_marker 100 0.000000000000000e+00 1.827769091608957e+02 2.998139772646085e+01 1.281097325030291e+00 1.292216906500214e+00
2 changes: 1 addition & 1 deletion tests/test-c6t-3/fc.8.ref
@@ -1 +1 @@
qd.5 0.000000e+00 0.000000e+00 1.745329252e+01
qd.5 0.000000e+00 0.000000e+00 1.745329252e+01
14 changes: 7 additions & 7 deletions tests/test-c6t-3/test-c6t-3.ref
@@ -1,9 +1,9 @@

++++++++++++++++++++++++++++++++++++++++++++
+ MAD-X 5.07.00 (64 bit, Linux) +
+ MAD-X 5.08.00 (64 bit, Linux) +
+ Support: mad@cern.ch, http://cern.ch/mad +
+ Release date: 2021.05.03 +
+ Execution date: 2021.12.10 13:03:54 +
+ Release date: 2022.01.13 +
+ Execution date: 2022.01.27 20:47:37 +
++++++++++++++++++++++++++++++++++++++++++++
TITLE;

Expand Down Expand Up @@ -35,10 +35,10 @@ orbit: 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0
0 0 0 0

synch_6 synch_8 nflips dqmin
0 0 0 0.000139362666
0 0 0 0.0113267459

dqmin_phase
-2.311877287
-1.659294127
makethin: style chosen : teapot
makethin: slicing sequence : fivecell
makethin: slicing sequence : ins
Expand Down Expand Up @@ -68,10 +68,10 @@ orbit: 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0
0 0 0 0

synch_6 synch_8 nflips dqmin
0 0 0 0.0112000422
0 0 0 0.0004694091789

dqmin_phase
1.516725951
3.046048374
++++++++++++++++++++++++++++
+ c6t version 2.0 +
++++++++++++++++++++++++++++
Expand Down

0 comments on commit c0b52a5

Please sign in to comment.