mpi_mkdir_p('input') mpi_mkdir_p('output') mpi_mkdir_p('lost') #---------------------------------------------- # Generate Lattice (MADX + PTC) #---------------------------------------------- if not rank: os.system("/afs/cern.ch/eng/sl/MAD-X/pro/releases/5.02.00/madx-linux64 < Input/SIS18.madx") orbit_mpi.MPI_Barrier(comm) #---------------------------------------------- # Initialize a Teapot-Style PTC lattice #---------------------------------------------- PTC_File = "SIS_18_BENCHMARK.flt" Lattice = PTC_Lattice("MACHINE") Lattice.readPTC(PTC_File) readScriptPTC('Input/time.ptc') paramsDict = {} paramsDict["length"]=Lattice.getLength()/Lattice.nHarm #---------------------------------------------- # Add apertures #---------------------------------------------- position = 0 for node in Lattice.getNodes(): myaperturenode = TeapotApertureNode(1, 10, 10, position) node.addChildNode(myaperturenode, node.ENTRANCE) node.addChildNode(myaperturenode, node.BODY) node.addChildNode(myaperturenode, node.EXIT)
index_files = 1 index_files_max = 100 # nb of turns to run after injection: nb_turn_after_inj = 10 #---------------------------------------------- turn = index_files_max + 1 turns_max = index_files_max + nb_turn_after_inj turns_print = xrange(-1, turns_max, 2) #---------------------------------------------- # Initialize a Teapot-Style PTC lattice #---------------------------------------------- PTC_File = 'Input/PSB_FLAT_Pert_r0.TXT' Lattice = PTC_Lattice("PSB") Lattice.readPTC(PTC_File) readScriptPTC('ptc/fringe.txt') readScriptPTC('ptc/time.txt') readScriptPTC('ptc/chrom.txt') readScriptPTC('ptc/ramp_magnet.ptc') readScriptPTC('ptc/ramp_cavities.ptc') readScriptPTC('ptc/energize_lattice.ptc') readScriptPTC('ptc/twiss_script.ptc') readScriptPTC('ptc/write_FINAL_SETTINGS.ptc') paramsDict = {} paramsDict["length"] = Lattice.getLength() / Lattice.nHarm print '\nLattice parameters ...' print ' circumference: \t', Lattice.getLength(), 'm' print ' alphax0: \t\t', Lattice.alphax0
from orbit.teapot import BaseTEAPOT from libptc_orbit import * from ext.ptc_orbit import PTC_Lattice from ext.ptc_orbit import PTC_Node from ext.ptc_orbit.ptc_orbit import setBunchParamsPTC, readAccelTablePTC,\ readScriptPTC, updateParamsPTC, synchronousSetPTC, synchronousAfterPTC,\ trackBunchThroughLatticePTC, trackBunchInRangePTC PTC_File = "MAIN_1_5_KIND7_1" length_of_name = len(PTC_File) ptc_init_(PTC_File, length_of_name - 1) Lattice = PTC_Lattice("TestCase") Lattice.readPTC(PTC_File) print Lattice.getLength( ), Lattice.betax0, Lattice.betay0, Lattice.alphax0, Lattice.alphay0, Lattice.etax0, Lattice.etapx0 PhaseLength = Lattice.getLength() print Lattice.getLength(), PhaseLength """ for node in Lattice.getNodes(): print node.getType(), node.getLength(), node.getParam("node_index"), node.getParam("betax"), node.getParam("betay"), node.getParam("alphax"), node.getParam("alphay"), node.getParam("etax"), node.getParam("etapx") """ b = Bunch() print "Read Bunch." runName = "PTC Test"
#---------------------------------------------- # Simulation Parameters #---------------------------------------------- turn = 0 turns_max = 5000 turns_print = xrange(-1, turns_max, 100) #---------------------------------------------- # Initialize a Teapot-Style PTC lattice #---------------------------------------------- PTC_File = "BUMP_STUDIES.flt" length_of_name = len(PTC_File) ptc_init_(PTC_File, length_of_name - 1) Lattice = PTC_Lattice("PS") Lattice.readPTC(PTC_File) # readScriptPTC('Input/fringe.txt') # readScriptPTC('Input/time.txt') # readScriptPTC('Input/chrom.ptc') #~ readScriptPTC('madx/ptc/chrom.txt') readScriptPTC('Input/PS-TIME-TABLES.PTC') print '\nLattice parameters ...' print ' circumference: \t', Lattice.getLength(), 'm' print ' alphax0: \t\t', Lattice.alphax0 print ' betax0: \t\t', Lattice.betax0, 'm' print ' alphay0: \t\t', Lattice.alphay0 print ' betay0: \t\t', Lattice.betay0, 'm' print ' Dx0: \t\t\t', Lattice.etax0, 'm'
from orbit.teapot import BaseTEAPOT from libptc_orbit import * from ext.ptc_orbit import PTC_Lattice from ext.ptc_orbit import PTC_Node from ext.ptc_orbit.ptc_orbit import setBunchParamsPTC, readAccelTablePTC,\ readScriptPTC, updateParamsPTC, synchronousSetPTC, synchronousAfterPTC,\ trackBunchThroughLatticePTC, trackBunchInRangePTC PTC_File = "ptc_data_test_0.txt" length_of_name = len(PTC_File) ptc_init_(PTC_File, length_of_name - 1) Lattice = PTC_Lattice("TestCase") Lattice.readPTC(PTC_File) print Lattice.getLength(), Lattice.betax0, Lattice.betay0, Lattice.alphax0, Lattice.alphay0, Lattice.etax0, Lattice.etapx0 PhaseLength = Lattice.getLength() print Lattice.getLength(), PhaseLength """ for node in Lattice.getNodes(): print node.getType(), node.getLength(), node.getParam("node_index"), node.getParam("betax"), node.getParam("betay"), node.getParam("alphax"), node.getParam("alphay"), node.getParam("etax"), node.getParam("etapx") """ b = Bunch() print "Read Bunch." runName = "PTC Test"