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" setBunchParamsPTC(b) kin_Energy = b.getSyncParticle().kinEnergy() print kin_Energy, b.charge(), b.mass() total_macroSize = 1.0e+10 bunch_orbit_to_pyorbit(Lattice.getLength(), kin_Energy, "bunch.dat", b) nParticlesGlobal = b.getSizeGlobal() b.macroSize(total_macroSize / nParticlesGlobal) print nParticlesGlobal, b.macroSize() """ Acc_File = "ACCWAVE_40kV_280kV_350ms.DAT" readAccelTablePTC(Acc_File) """
#---------------------------------------------- # 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) position += node.getLength() #---------------------------------------------- # Add the main bunch and lost particles bunch #---------------------------------------------- bunch = Bunch() setBunchParamsPTC(bunch) from simulation_parameters import parameters as p p['harmonic_number'] = Lattice.nHarm p['phi_s'] = 0 p['gamma'] = bunch.getSyncParticle().gamma() p['beta'] = bunch.getSyncParticle().beta() p['energy'] = 1e9 * bunch.mass() * bunch.getSyncParticle().gamma() p['bunch_length'] = p['blength_rms']/speed_of_light/bunch.getSyncParticle().beta()*4 kin_Energy = bunch.getSyncParticle().kinEnergy() print 'Energy of particle = ', p['energy'] print 'Kinetic Energy of particle = ', kin_Energy if horizontal: Particle_distribution_file = generate_initial_5mm_distributionH(s['InitialParticleTransversePosition'], p, Lattice, output_file='input/ParticleDistribution.in', summary_file='input/ParticleDistribution_summary.txt') else:
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" setBunchParamsPTC(b) kin_Energy = b.getSyncParticle().kinEnergy() print kin_Energy, b.charge(), b.mass() total_macroSize=1.0e+10 bunch_orbit_to_pyorbit(Lattice.getLength(), kin_Energy, "bunch_ini.dat", b) nParticlesGlobal = b.getSizeGlobal() b.macroSize(total_macroSize/nParticlesGlobal) print nParticlesGlobal, b.macroSize() updateParamsPTC(Lattice, b) synchronousSetPTC(-1)