From 4076379f0568ef79eb58ceb870fc5dc69d5992e5 Mon Sep 17 00:00:00 2001 From: Piotr Skowronski on macbe16187 Date: Thu, 7 Jan 2021 12:23:45 +0100 Subject: [PATCH 1/5] Fixed bug in issue 692 in indexing of arrays --- src/madx_ptc_track_run.f90 | 41 +++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/madx_ptc_track_run.f90 b/src/madx_ptc_track_run.f90 index 9af385cd2..351feacca 100644 --- a/src/madx_ptc_track_run.f90 +++ b/src/madx_ptc_track_run.f90 @@ -1913,13 +1913,18 @@ SUBROUTINE track_beam_elementwise_with_PTC ! int.subroutine ! save coordinates for the current particle ---! + + if (getdebug() > 3) then + print*, "Saving X for j_th_partic = ", j_th_partic + endif + do k_th_coord=1,6 if (ISNAN(current_x_coord_incl_co(k_th_coord))) then ! BUG !? Aperture does not work, if lattice with spread multipoles XXXX + ! ! NaN_coord_after_track_VK=.TRUE. x_coord_incl_co(k_th_coord,j_th_partic)=999 else - x_coord_incl_co(k_th_coord,j_th_partic)= & + x_coord_incl_co(k_th_coord,j_th_partic)= & current_x_coord_incl_co(k_th_coord) endif end do @@ -2242,7 +2247,12 @@ SUBROUTINE Final_Coord_to_tables ! Complete all tables by one subroutine: last_turn_of_lost_particle(particle_ID(j_part_tmp))= turn_final ! last_position_of_lost_particle(particle_ID(j_part_tmp))= sum_length ! remember last turn and position of particles + last_orbit_of_lost_particle(:, particle_ID(j_part_tmp))= x_coord_incl_co(:, j_part_tmp) + + if (ptc_track_debug) then + print*, "j_part_tmp ", j_part_tmp, " id ", particle_ID(j_part_tmp), " coord ", x_coord_incl_co(:, j_part_tmp) + endif ! ! enddo @@ -2343,9 +2353,17 @@ SUBROUTINE Final_Coord_to_tables ! Complete all tables by one subroutine: ENDDO !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>! ! ! ! CALL Coord_PTC_to_MAD(X_PTC,X_MAD) ! - ! ! + ! + if (ptc_track_debug) then + print*, "putting in tracksumm part no ", j_part_tmp + endif ! DO i_coord = 1, 6 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>! ! - doublenum = X_MAD(i_coord) ! ! + doublenum = X_MAD(i_coord) + ! ! + if (ptc_track_debug) then + print*, " coord ", i_coord, " = ", doublenum + endif + call double_to_table_curr('tracksumm ', vec_names(i_coord), doublenum) ! ! !call double_to_table_curr('tracksumm ', vec_names(j), tmp_d) ! ! ! ! ! @@ -3727,14 +3745,16 @@ SUBROUTINE kill_ptc_track (n_particle, & last_position_of(np)=sum_accum_length ! Save Position of n_particle - - last_orbit_of(:,np) = x_coord_incl_co(:,np) + if(getdebug() > 3) then + print*,"kill_ptc_track, n_particle=",n_particle," np=",np, " x = ", x_coord_incl_co(:,n_particle) + endif + last_orbit_of(:,np) = x_coord_incl_co(:,n_particle) if (recloss) then namelen = LEN_TRIM(el_name) if (namelen > name_len) namelen = name_len madx_name = el_name(1:namelen) - call tp_ploss(np,i_th_turn, sum_accum_length, x_coord_incl_co(:,np), madx_name, en) + call tp_ploss(np,i_th_turn, sum_accum_length, x_coord_incl_co(:,n_particle), madx_name, en) endif ! Renumbering arrays @@ -3748,7 +3768,14 @@ SUBROUTINE kill_ptc_track (n_particle, & END IF enddo - + + + if(getdebug() > 3) then + do j_th=1,j_max + print*,"kill_ptc_track, part_ID(",j_th,")",part_ID(j_th) + enddo + endif + j_max = j_max - 1 END SUBROUTINE kill_ptc_track From d2a03cc9332f6ecdcbb44e90fafa8403095c731d Mon Sep 17 00:00:00 2001 From: tpersson Date: Fri, 8 Jan 2021 17:26:28 +0100 Subject: [PATCH 2/5] Updated the tests. --- tests/test-ptc-track-2/test-ptc-track-2.ref | 14 +++++++------- tests/test-ptc-track-2/tfv9recloss.tfs.ref | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test-ptc-track-2/test-ptc-track-2.ref b/tests/test-ptc-track-2/test-ptc-track-2.ref index a8267ed71..70bf5b301 100644 --- a/tests/test-ptc-track-2/test-ptc-track-2.ref +++ b/tests/test-ptc-track-2/test-ptc-track-2.ref @@ -1,9 +1,9 @@ ++++++++++++++++++++++++++++++++++++++++++++ - + MAD-X 5.05.02 (64 bit, Linux) + + + MAD-X 5.06.01 (64 bit, Linux) + + Support: mad@cern.ch, http://cern.ch/mad + - + Release date: 2019.07.25 + - + Execution date: 2020.07.29 16:35:20 + + + Release date: 2020.09.01 + + + Execution date: 2021.01.08 17:21:07 + ++++++++++++++++++++++++++++++++++++++++++++ !TITLE,' Example 1 for for MAD-X with PTC_TRACK_RUN'; @@ -144,8 +144,8 @@ ptc_track,icase=56,element_by_element, turns=10, file="tfv9", recloss ; 1 10 0.0002252020254 -1.111922841e-05 2 10 3.234489974e-05 -2.017208596e-06 3 1 0.0001 0 - 4 1 0.001229979172 6.360301388e-05 - 5 1 0.001178855988 6.095440089e-05 + 4 1 0.01000609926 0.0005239391492 + 5 1 0.01009694549 0.0001422990216 6 10 0.009370093381 0.0001176678106 y py t pt @@ -158,8 +158,8 @@ ptc_track,icase=56,element_by_element, turns=10, file="tfv9", recloss ; -0.00311135335 3.238436512e-05 -1.897391847e-05 0 -0.001097781795 1.132710343e-05 1.047619194e-06 0 0 0 2 0.02 - 0 0 8.054090825e-06 0.0024 - 0 0 7.720682552e-06 0.0023 + 0 0 0.05006345122 0.02 + 0 0 -0.0001838485114 0.0024 0.0004919324094 1.388568373e-05 -0.004391133034 0.0023 s e diff --git a/tests/test-ptc-track-2/tfv9recloss.tfs.ref b/tests/test-ptc-track-2/tfv9recloss.tfs.ref index 1761f5509..8ab7d4ca6 100644 --- a/tests/test-ptc-track-2/tfv9recloss.tfs.ref +++ b/tests/test-ptc-track-2/tfv9recloss.tfs.ref @@ -1,11 +1,11 @@ @ NAME %09s "TRACKLOSS" @ TYPE %09s "TRACKLOSS" @ TITLE %08s "no-title" -@ ORIGIN %16s "5.05.02 Linux 64" -@ DATE %08s "29/07/20" -@ TIME %08s "16.35.20" +@ ORIGIN %16s "5.06.01 Linux 64" +@ DATE %08s "08/01/21" +@ TIME %08s "17.19.54" * NUMBER TURN X PX Y PY T PT S E ELEMENT $ %d %d %le %le %le %le %le %le %le %le %s 3 1 0.0001 0 0 0 -2 0.02 0 100 "FIVECELL$START" - 4 1 0.001229979172 6.360301388e-05 0 0 -8.054090825e-06 0.0024 73.18000769 100 "MB" - 5 1 0.001178855988 6.095440089e-05 0 0 -7.720682552e-06 0.0023 211.4200077 100 "MB" + 4 1 0.01000609926 0.0005239391492 0 0 -0.05006345122 0.02 73.18000769 100 "MB" + 5 1 0.01009694549 0.0001422990216 0 0 0.0001838485114 0.0024 211.4200077 100 "MB" From 6ee3f6ff90a1fc65f0fbd2ce0bed1859de48a11e Mon Sep 17 00:00:00 2001 From: tpersson Date: Mon, 11 Jan 2021 10:10:13 +0100 Subject: [PATCH 3/5] Added the update to the actions. --- .github/workflows/make.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 2455ba27b..e81496a50 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -40,8 +40,8 @@ jobs: - name: Install dependencies run: | - set -ex - sudo apt-get update + set -ex \ + sudo apt-get update \ sudo apt-get install -qy \ libblas-dev \ liblapack-dev \ From 8eaad8d1411f612c1f68b1b54bd08271dc12967f Mon Sep 17 00:00:00 2001 From: tpersson Date: Mon, 11 Jan 2021 11:40:50 +0100 Subject: [PATCH 4/5] wrong syntax before.. --- .github/workflows/make.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index e81496a50..2455ba27b 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -40,8 +40,8 @@ jobs: - name: Install dependencies run: | - set -ex \ - sudo apt-get update \ + set -ex + sudo apt-get update sudo apt-get install -qy \ libblas-dev \ liblapack-dev \ From 485298706c8b6ea44dee0c2fe08e9427c62ad7be Mon Sep 17 00:00:00 2001 From: tpersson Date: Mon, 11 Jan 2021 11:49:32 +0100 Subject: [PATCH 5/5] Fixing hopefully. --- .github/workflows/manylinux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manylinux.yml b/.github/workflows/manylinux.yml index 0cd3aac37..b29abf79e 100644 --- a/.github/workflows/manylinux.yml +++ b/.github/workflows/manylinux.yml @@ -88,7 +88,7 @@ jobs: - name: Install runtime dependencies run: | - sudo apt-get update \ + sudo apt-get update sudo apt-get install -qy gnuplot - name: Run tests