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)
# ~ os.system("/afs/cern.ch/eng/sl/MAD-X/pro/releases/5.02.00/madx-linux64 < Flat_file.madx") os.system("../../madx-linux64_v5_02_00 < Flat_file.madx") orbit_mpi.MPI_Barrier(comm) # Generate PTC RF table #----------------------------------------------------------------------- print '\n\t\tCreate RF file on MPI process: ', rank from lib.write_ptc_table import write_RFtable from simulation_parameters import RFparameters as RF write_RFtable('input/RF_table.ptc', *[RF[k] for k in ['harmonic_factors','time','Ekin_GeV','voltage_MV','phase']]) # Initialize a Teapot-Style PTC lattice #----------------------------------------------------------------------- print '\n\t\tRead PTC flat file: on MPI process: ', rank PTC_File = 'PTC-PyORBIT_flat_file.flt' Lattice = PTC_Lattice("PS") Lattice.readPTC(PTC_File) print '\n\t\tRead PTC files on MPI process: ', rank CheckAndReadPTCFile('PTC/fringe.ptc') CheckAndReadPTCFile('PTC/time.ptc') CheckAndReadPTCFile('PTC/ramp_cavities.ptc') # Create a dictionary of parameters #----------------------------------------------------------------------- print '\n\t\tMake paramsDict on MPI process: ', rank paramsDict = {} paramsDict["length"]=Lattice.getLength()/Lattice.nHarm # Add apertures #-----------------------------------------------------------------------
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"