Skip to content
Snippets Groups Projects
Commit 2ccdd909 authored by zhang's avatar zhang
Browse files

Make small change to make the code more compact

parent da7d4445
Branches
Tags
No related merge requests found
...@@ -20,10 +20,11 @@ extern bool freq_map; ...@@ -20,10 +20,11 @@ extern bool freq_map;
// turn on globval.Cavity_on and globval.radiation to get proper synchr radiation damping // turn on globval.Cavity_on and globval.radiation to get proper synchr radiation damping
// IDs accounted too if: wiggler model and symplectic integrator (method = 1) // IDs accounted too if: wiggler model and symplectic integrator (method = 1)
globval.H_exact = false; globval.H_exact = false;
globval.quad_fringe = false; // quadrupole fringe field /*The following values are set in the Read_lattice( ) in soleilcommon.cc*/
globval.radiation = false; // synchrotron radiation // globval.quad_fringe = false; // quadrupole fringe field
globval.emittance = false; // emittance // globval.radiation = false; // synchrotron radiation
globval.pathlength = false; // globval.emittance = false; // emittance
// globval.pathlength = false;
// globval.bpm = 0; // globval.bpm = 0;
// const double x_max_FMA = 10e-3, delta_FMA = 10e-2; // const double x_max_FMA = 10e-3, delta_FMA = 10e-2;
...@@ -41,7 +42,7 @@ extern bool freq_map; ...@@ -41,7 +42,7 @@ extern bool freq_map;
/************************************************************************ /************************************************************************
start read in files and flags read in files and flags
*************************************************************************/ *************************************************************************/
if (argc > 1){ if (argc > 1){
read_script(argv[1], true);} read_script(argv[1], true);}
...@@ -50,15 +51,10 @@ extern bool freq_map; ...@@ -50,15 +51,10 @@ extern bool freq_map;
exit_(1); exit_(1);
} }
/************************************************************************ /************************************************************************
end read in files and flags writes flat file with all the design values of the lattice, very important file for debug
*************************************************************************/ *************************************************************************/
prtmfile("flat_file.dat"); // writes flat file /* very important file for debug*/ prtmfile("flat_file.dat");
printlatt(); /* SOLEIL print out lattice functions */
printglob();
// Flag factory // Flag factory
...@@ -211,27 +207,32 @@ extern bool freq_map; ...@@ -211,27 +207,32 @@ extern bool freq_map;
if (ReadMultipoleFlag == true){ if (ReadMultipoleFlag == true){
fprintf(stdout, "\n Read Multipoles file for lattice with thick sextupoles \n"); fprintf(stdout, "\n Read Multipoles file for lattice with thick sextupoles \n");
ReadFieldErr(multipole_file); ReadFieldErr(multipole_file);
//first print the full lattice with error as a flat file
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob();
} }
//Old version to multipole errors in soleil lattice, is obsoleted
if (MultipoleFlag == true ){ if (MultipoleFlag == true ){
if (ThinsextFlag ==true){ if (ThinsextFlag ==true){
fprintf(stdout, "\n Setting Multipoles for lattice with thin sextupoles \n"); fprintf(stdout, "\n Setting Multipoles for lattice with thin sextupoles \n");
Multipole_thinsext(fic_hcorr,fic_vcorr,fic_skew); /* for thin sextupoles */ Multipole_thinsext(fic_hcorr,fic_vcorr,fic_skew); /* for thin sextupoles */
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob(); printglob();
} }
else{ else{
fprintf(stdout, "\n Setting Multipoles for lattice with thick sextupoles \n"); fprintf(stdout, "\n Setting Multipoles for lattice with thick sextupoles \n");
Multipole_thicksext(fic_hcorr,fic_vcorr,fic_skew); /* for thick sextupoles */ Multipole_thicksext(fic_hcorr,fic_vcorr,fic_skew); /* for thick sextupoles */
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */ Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob(); printglob();
} }
} }
//first print the full lattice with error as a flat file
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
printlatt(); /* SOLEIL print out lattice functions */
printglob();
/******************************************************************************************/ /******************************************************************************************/
// COMPUTATION PART after setting the model // COMPUTATION PART after setting the model
...@@ -288,16 +289,16 @@ extern bool freq_map; ...@@ -288,16 +289,16 @@ extern bool freq_map;
if (MomentumAccFlag == true){ if (MomentumAccFlag == true){
bool cavityflag, radiationflag; bool cavityflag, radiationflag;
/* record the initial values*/ /* record the initial values*/
cavityflag = globval.Cavity_on; cavityflag = globval.Cavity_on;
radiationflag = globval.radiation; radiationflag = globval.radiation;
if(strncmp("6D",DimTrack,2)==0){ /* set the dimension for the momentum tracking*/
if(strncmp("6D",TrackDim,2)==0){
globval.Cavity_on = true; globval.Cavity_on = true;
globval.radiation = true; globval.radiation = true;
} }
else if(strncmp("4D",DimTrack,2)==0){ else if(strncmp("4D",TrackDim,2)==0){
globval.Cavity_on = false; globval.Cavity_on = false;
globval.radiation = false; globval.radiation = false;
} }
...@@ -306,12 +307,13 @@ extern bool freq_map; ...@@ -306,12 +307,13 @@ extern bool freq_map;
exit_(1); exit_(1);
}; };
/* calculate momentum accepetance*/
MomentumAcceptance( MomentumAcceptance(
_MomentumAccFlag_istart, _MomentumAccFlag_istop, _MomentumAccFlag_istart, _MomentumAccFlag_istop,
_MomentumAccFlag_deltaminp, _MomentumAccFlag_deltamaxp, _MomentumAccFlag_nstepp, _MomentumAccFlag_deltaminp, _MomentumAccFlag_deltamaxp, _MomentumAccFlag_nstepp,
_MomentumAccFlag_deltaminn, _MomentumAccFlag_deltamaxn, _MomentumAccFlag_nstepn); _MomentumAccFlag_deltaminn, _MomentumAccFlag_deltamaxn, _MomentumAccFlag_nstepn);
/* reset back to the initial values*/ /* restore the initial values*/
globval.Cavity_on = cavityflag; globval.Cavity_on = cavityflag;
globval.radiation = radiationflag; globval.radiation = radiationflag;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment