Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Numerical experiments using an electrostatic, relativistic plasma simulation code Parachoniak, Ronald D. 1986

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1986_A6_7 P36_3.pdf [ 9.6MB ]
Metadata
JSON: 831-1.0085294.json
JSON-LD: 831-1.0085294-ld.json
RDF/XML (Pretty): 831-1.0085294-rdf.xml
RDF/JSON: 831-1.0085294-rdf.json
Turtle: 831-1.0085294-turtle.txt
N-Triples: 831-1.0085294-rdf-ntriples.txt
Original Record: 831-1.0085294-source.json
Full Text
831-1.0085294-fulltext.txt
Citation
831-1.0085294.ris

Full Text

N U M E R I C A L E X P E R I M E N T S USING AN E L E C T R O S T A T I C , RELATIVISTIC P L A S M A SIMULATION C O D E by R O N A L D D. P A R A C H O N I A K B.Sc. Engineering Physics, University of Saskatchewan, 1977 A THESIS S U B M I T T E D IN PARTIAL F U L F I L L M E N T OF T H E R E Q U I R E M E N T S FOR T H E D E G R E E OF M A S T E R OF SCIENCE in T H E F A C U L T Y OF G R A D U A T E STUDIES ( D E P A R T M E N T of PHYSICS) We accept this thesis as conforming to the required standard T H E UNIVERSITY OF BRITISH COLUMBIA September 1986 © R o n a l d D. Parachoniak, 1986 In presenting t h i s thesis i n p a r t i a l f u l f i l m e n t of the requirements for an advanced degree at the University of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y available for reference and study. I further agree that permission for extensive copying of t h i s thesis for scholarly purposes may be granted by the head of my department or by h i s or her representatives. I t i s understood that copying or publication of t h i s thesis for f i n a n c i a l gain s h a l l not be allowed without my written permission. Department of ^ ^  The University of B r i t i s h Columbia 1956 Main Mall Vancouver, Canada V6T 1Y3 Date DE-6 (3/81) ii A B S T R A C T A 1-1/2 dimensional electrostatic, relativistic, plasma simulation model was constructed, implemented on the U B C FPS array processor, and tested by solving three problems in plasma physics. The model will handle a variety of different initial conditions including cold plasmas, cold beams, and drifting niaxwellians. Relativistic particle velocities are properly modelled and up to two species of particles may be specified. The numerical experiments run with the model included cold plasma oscillations, cold and warm two-stream instabilities, and Landau damping. Results of the simulations were compared to theory and excellent agreement was obtained in all the cases studied. The model may now be used with confidence to research various (relativistic) electrostatic problems. It could also be modified to make it fully electromagnetic, in which case it would be useful for simulating many additional phenomena, including laser-plasma interactions. T A B L E O F C O N T E N T S A B S T R A C T ii T A B L E O F C O N T E N T S Hi LIST OF T A B L E S v LIST O F FIGURES vi A C K N O W L E D G E M E N T S viii I N T R O D U C T I O N 1 C H A P T E R 1 - P A R T I C L E SIMULATION T H E O R Y 1.1 Introduction 6 1.2 Particle models 7 1.3 The basic computational cycle 8 1.4 Particle Collisions 9 1.5 Particle and force weighting 11 1.6 Effects of the spatial grid 14 1.7 Time integration of the particles 16 1.8 Integration of the field equations 19 1.9 Particle position and velocity loading 22 1.10 Computer variables 25 C H A P T E R 2 - P R O G R A M ESR1 2.1 Introduction . 27 2.2 Overall structure of E S R l 28 2.3 Subroutine C R E A T R 29 2.4 Subroutine SETRHO 32 2.5 Subroutine FIELDS 32 2.6 Subroutine S E T V 33 2.7 Subroutine A C C E L 34 2.8 Subroutine M O V E 35 2.9 Miscellaneous Subroutines 35 2.10 Program E S l P L T 36 iv C H A P T E R 3 - T H E P L A S M A DISPERSION R E L A T I O N 3.1 Introduction 37 3.2 Derivation of the dispersion relation 37 3.3 Dispersion relation — cold beams 40 3.4 Dispersion relation — non-relativistic Maxwellian 41 3.5 Dispersion relation — relativistic Maxwellian 42 C H A P T E R 4 - C O L D P L A S M A OSCILLATIONS 4.1 Introduction 45 4.2 Theory 47 4.3 Trial runs and results 48 C H A P T E R 5 - T W O S T R E A M INSTABILITIES 5.1 Introduction 54 5.2 Theory 55 5.3 Trial runs and results 58 5.3.1 Non-relativistic two stream instability (cold beams) 58 5.3.2 Non-relativistic two stream instability (warm beams) 61 5.3.3 Relativistic two stream instability (cold beams) 62 C H A P T E R 6 - L A N D A U DAMPING 6.1 Introduction 76 6.2 Trial runs and results 77 6.2.1 Non-relativistic Landau damping 77 6.2.2 Relativistic Landau damping 80 C H A P T E R 7 - RESULTS and CONCLUSIONS 86 R E F E R E N C E S 88 A P P E N D I X A - Two-stream instability dispersion relation A. l Introduction 91 APPENDIX B - ESR1 users guide and program listing B. l Introduction 97 B.2 Setup Procedure 9 7 B.3 Running ESR1 and ES1PLT 99 L I S T O F T A B L E S 1-1 Bit-reversed fractions 24 III— 1 Dispersion relation — Non-relativistic Maxwellian 43 III- 2 Dispersion relation — Relativistic Maxwellian 44 IV- 1 Input Parameters. (Run no. 105422) 49 V - l Input Parameters (Run no. 121112) 58 V - 2 Two-stream Instability Results 64 V I - 1 Input Parameters. (Run no. 101708) 77 VI-2 Input Parameters. (Run no. 124958) 79 VI-3 Input Parameters (Run no. 164028) .80 L I S T O F F I G U R E S 4-l(a,b) DISPERSION R E L A T I O N 51 4-2 E L E C T R O S T A T I C E N E R G Y — S E L E C T E D M O D E S 52 4- 3 P A R T I C L E CROSSING E F F E C T S ; 53 A - l DISPERSION R E L A T I O N 57 5- 2 E L E C T R O S T A T I C E N E R G Y - M O D E 1 65 5-3 E L E C T R O S T A T I C E N E R G Y - M O D E S 1 and 2 66 5-4 E V O L U T I O N in P H A S E SPACE 66 5-5 DISTRIBUTION F U N C T I O N 68 5-6 E L E C T R O N KINETIC E N E R G Y and M O M E N T U M 69 5-7 E L E C T R O S T A T I C E N E R G Y - M O D E 1 70 5-8 E L E C T R O S T A T I C E N E R G Y - MODES 1 and 2 71 5-9 C H A R G E DENSITY 72 5-10 E L E C T R O S T A T I C P O T E N T I A L . 73 5-11 E V O L U T I O N in P H A S E SPACE 74 5- 12 DISTRIBUTION F U N C T I O N 75 6- l(a,b) DISTRIBUTION FUNCTION and M O D E 1 E N E R G Y 82 6-2 E L E C T R O S T A T I C E N E R G Y — M O D E 1 83 6-3(a,b) DISTRIBUTION FUNCTION & DENSITY P E R T U R B A T I O N 84 6-4(a,b) E L E C T R O S T A T I C E N E R G Y — M O D E 1 85 A - l DISPERSION R E L A T I O N 92 A-2a DISPERSION R E L A T I O N 93 A-2b DISPERSION R E L A T I O N (Cont.) 94 A-3a P R O G R A M R O O T E R 95 A-3b P R O G R A M R O O T E R (Cont.) 96 B - l INPUT FILES—ESR1 B-2 INPUT FILES—ES1PLT B-3 ESR1.INSERT Listing B-4 ESR1.CLICHE Listing B-5 ESR1 and ES1PLT— Listing A C K N O W L E D G M E N T S Special thanks to my supervisor Dr. A . J . Barnard for his advice and help in this work. I would also like to thank Sandy Calder for many useful discussions, and the National Sciences and Engineering Research Council for financial support. INTRODUCTION 1 INTRODUCTION Computer modelling is now established as a very important method in all branches of science. In many cases it is the only way to arrive at solutions for complex problems. Oftentimes experiments may be difficult or even impossible to do and analytical treatments may not be feasible. Also, there are cases where the correct theory is not known. Here, computer modelling may be helpful in differentiating among the possibilities. Computer simulations of plasmas have proven fruitful in all these areas. The goal of this thesis work was to construct and test a 1-1/2 dimensional electrostatic, relativistic, plasma simulation code. This goal was met and the the result of the work is the program E S R l (Electrostatic Relativistic 1-1/2 dimensional). A 1-1/2 dimensional code was selected mainly for economical reasons—working in a higher dimension would have increased running costs prohibitively. Fortunately, it turns out that working in only 1-1/2 dimensions is not excessively restrictive; there are many phenomena that may be ad-equately modelled. In addition to the problems examined in this thesis, examples include beam-plasma interactions, plasma expansion into a vacuum, and so-called explosive insta-bilities. Although many of the available topics have been well covered in the literature, a INTRODUCTION 2 number of them have not been treated relativisticall y. Thus having a 1-1/2 D relativis-tic code that is tested and inexpensive (compared to higher dimensional models) is very useful. Also, the program could be extended to include electromagnetic fields and then used to investigate a wide variety of phenomena related to laser-plasma interactions such as stimulated Raman scattering, two-plasmon decay, stimulated Brillouin scattering, etc. Finally, since the program is well documented and easy to use, it could be very useful as a learning tool for students taking graduate level courses in plasma physics. The extensive graphical output routines contained in the program would help to illuminate many basic plasma phenomena such as waves, oscillations, and instabilities. E S R l was constructed by taking an existing program, (ESI, originally written by A . B . Langdon in 1972), as a basic shell, extensively modifying it to include relativistic effects, and adding graphical output. The process of transforming ESI into E S R l and then implementing it at U B C required three main steps. The first step was to change the code in order to make the program relativistic. This mainly entailed modifications to the particle loading and particle acceleration routines. The particle loading was changed to allow either a relativistic or a non-relativistic Maxwellian distribution to be used (depending on the temperature specified). An option for using a quiet start and the ability to add, relativistically, a drift velocity to all particles were also included. In a quiet start, the particles are loaded in a uniform (but not ordered) way in order to reduce the initial noise level. In the particle acceleration subroutine, algorithms devised by Borisjl] and Buneman[2] were incorporated in order to handle properly the relativistic effects. INTRODUCTION 3 A number of other changes were also made; not all of them directly related to making the program relativistic. Examples include: • the system of units was changed from a modified MKS system to cgs-Heaviside/Lorentz. • all energies were normalized to the rest mass energy of species one (usually elec-trons) and momenta are reported in units of the speed of light. • the initial density (position) perturbation was changed to be in terms of interpar-ticle spacings instead of total system length. • routines were added to calculate frequencies and damping rates automatically. • restart capability was incorporated. The second major step in effecting the change from ESI to E S R l was to add the graphics routines. ESI was written with the graphics routines interwoven with the main part of the code and, unfortunately, the graphics routines used were not available at UBC. This meant that almost totally new graphics routines had to be written, debugged, and integrated into the new program. The third major step involved setting up E S R l to run on the U B C Floating Point Systems array processor (the "AP"). The A P is an attached arithmetic processor which, because of its speed and low operating charges, allows one to run large programs such as E S R l relatively inexpensively at any time of the day. Before the A P was available, one normally would only run a program of this size overnight on extra-low priority. While the A P is very good for running production programs, it is prohibitively expensive to use for program development and debugging (the compiler is very slow and expensive to run). Thus, E S R l was first run and debugged on the U B C Amdahl computer and then INTRODUCTION 4 transferred to the AP. Transferring the program was a fairly major undertaking, principally because of the data transfer that takes place between the Amdahl and the A P when doing a run. This data transfer is necessary because the A P has no facility for I/O; all the printed output as well as the plotting routines must be done by the Amdahl. Most of the data transfer is done via unformatted files which have to be translated before they can be used by the plotting program. This translation is necessary because the A P has a 64 bit word while the Amdahl uses a 32 bit word. After the program was running on the AP, it still had to be tested—i.e. verified against problems that had known solutions. This testing had to cover both the relativistic and non-relativistic regimes. Three tests were chosen. The first, "Cold Plasma Oscillations", provided a good opportunity to check out the overall program operation. Next came trial runs on the "Two Stream Instability" and "Landau Damping". Both these tests were run with relativistic and non-relativistic parameters and so they provided an opportunity to check out the relativistic modifications to the program. As well, such items as energy vari-ation, (a measure of overall energy conservation), and quiet start technique were checked. In all three of these cases E S R l provided results that agreed very well with the theoretical results. Thus the program may now be used with confidence to venture into new areas of reseach. The remainder of this report is organized along the following lines. In chapter 1, a brief account of the theory behind particle simulation is given. This chapter draws heavily on the work of Hockney and Eastwood[3] and Birdsall and Lang-don^]. Various aspects are covered including the effects of the mesh and timestep sizes, INTRODUCTION 5 solution of the field equations using fast fourier transform techniques, and initialization of the run. Chapter 2 gives a detailed description of the code E S R l . Subroutine functions are outlined and detailed explanations of the code "inner workings" are given when believed necessary. In chapter 3, we digress slightly by reviewing the dispersion relation for a plasma and solving it for various distribution functions. These results are used in the next three chapters as benchmarks to which the simulation results are compared. Chapters 4, 5, and 6 give the results of the computer trial runs performed using E S R l . In each case a brief theoretical discussion of the problem is given followed by the simulation parameters used and the results obtained. Finally, in chapter 7 we summarize the results obtained and draw some conclusions. There are two appendices. Appendix A contains a listing of the program used to solve the dispersion relation numerically for the two-stream instability and the results obtained from the program. Appendix B contains a users guide to E S R l and a complete program listing. Chapter 1 PARTICLE SIMULATION THEORY 6 Chapter 1 PARTICLE SIMULATION THEORY 1.1 I N T R O D U C T I O N There are three main classes of plasma simulation models — fluid codes, Vlasov codes and particle codes. Fluid codes use the equation of continuity, the force equation (Newton's second law of motion), and Maxwell's equations to describe the plasma. Essentially, the plasma is considered to be two interpenetrating fluids with no account being taken of the differing particle velocities. The advantage of the method is its simplicity, which is a result of only equations with three space dimensions and time being used. The disadvantage is that when using the fluid equations, no velocity-dependent effects such as Landau damping may be considered. Vlasov codes integrate the distribution function, f{x,v,t), forward in time according to the Vlasov equation. Although Vlasov codes have been successfully used in 1-D simula-tions, they have not yet proven to be as generally useful as particle simulations, especially in two or more dimensions. Chapter 1 PARTICLE SIMULATION THEORY 7 Particle codes represent the plasma by a large number of computational particles ( "superparticles" ), which move in their self-consistent electromagnetic fields according to the laws of classical mechanics. The name superparticle is used because each computer particle represents very many real plasma particles. Particle models may be electrostatic, magnetostatic, or fully electromagnetic. They come in 1, 1-^ , 2, 2-^, and 3 dimensions. For example, 1-1/2 dimensional implies a one-dimensional model which allows the charge slabs to have a y-velocity. The particle motions are specified by x,vx, and vy — there is no spatial variation in the y-direction. In this way, a magnetic field in the z-direction may be properly included in the simulation. Similarly, a 1-2/2 dimensional model would imply the specification of x,vx,vy, and vz; and so on for the higher dimensions. In this chapter we concentrate on the theory behind the construction and use of a 1-1/2 dimensional electrostatic, relativistic, particle model. 1.2 P A R T I C L E M O D E L S There are three principal types of particle simulation models. (i) Particle-Particle models use Coulomb's law directly to calculate forces between particles. (ii) Particle-Mesh models calculate the fields on a spatial grid and then use these grid quantities to calculate the forces acting on the particles. (iii) Particle-Particle-Particle-Mesh (Hybrid) models are combinations of the above two ideas. Chapter 1 PARTICLE SIMULATION THEORY 8 Particle-particle models have limited use due to the large number of calculations in-volved per timestep. They are generally used either for small systems with long range forces or for large systems where the interaction forces become negligible after a few interparticle distances. Hybrid models are generally only needed for large correlated systems that have long range forces. Particle-mesh models are the most widely used ones today. Although they smooth out forces and fields that have scale lengths less than a grid cell, they are computationally much faster than particle-particle methods. Also, in many problems, such as collisionless plasmas, the smoothing effect of the grid turns out to be more of an advantage than a disadvantage. E S R l is a particle mesh model. 1.3 T H E B A S I C C O M P U T A T I O N A L C Y C L E Starting at time zero the memory is loaded with the particle positions and velocities. Using these positions and velocities the charge density (and current density in electromag-netic codes) is calculated on the grid. The assignment of these quantities is done using a form of weighting which is a function of the particle positions. Knowing the charge and current densities, one uses Maxwell's equations to determine the electric and magnetic fields at each grid point. These fields are then used to calculate the forces on the particles using the Newton-Lorentz equation. Once the forces are known, the particle velocities and then the positions are advanced in time. The cycle then repeats with the assignment of new charge and current densities and so on. Chapter 1 PARTICLE SIMULATION THEORY 9 1.4 P A R T I C L E C O L L I S I O N S The effects of particle collisions are as important in simulation models as they are in real plasmas. A typical charged particle in a plasma is interacting electrostatically with many other charged particles. However, since the field of the particle is greatly reduced at distances greater than a Debye length[5], the particle is limited to roughly simultaneous coulomb collisions. Np is the number particles in a Debye sphere, i.e. a sphere with its radius equal to a Debye length, Ap. The Debye length is defined by Xo = ^ , (1 - 1) with u>p, the plasma frequency, given by , 47rn0e2 W J = - i f - . 1 - 2 ) m in cgs units, and the thermal velocity, vth, given by vth = y— • 1 -3 ) V m Note that some authors define vth to be a factor of y/2 larger than that given here. In our computer model, each superparticle represents a very large number of electrons or ions and so the forces between them are larger than in a real plasma. Since Coulomb's force is proportional to r - 2 , r _ 1 , and r° in 3-D, 2-D, and 1-D respectively, we see that it becomes very large, (in fact singular in 2-D and 3-D), when two particles get near to each other. These large, short range forces are what give rise to collision al effects. Since the superparticles have larger forces acting between them than in a real plasma, they will also Chapter 1 PARTICLE SIMULATION THEORY have larger collisional forces. We need to somehow reduce these forces if we are to model a real system properly. Additionally, in many plasmas of interest the temperatures are so high that collisional effects may be neglected altogether; these are known as collisionless plasmas. When modelling these systems it is especially important to reduce the collision rate. However, while we would like to reduce, or even eliminate, the large, short range forces which give rise to collisions, we must keep the long range part of the force since that is what allows many particles to interact simultaneously (giving rise to the collective behaviour of the plasma). It turns out that if we have two charge clouds, circular in 2-D and spherical in 3-D, which are free to pass through each other without rotating or changing in shape, we get just the right type of force—it is the Coulomb force at large distances but it goes to zero for short distances. This suggests that if we can somehow treat the point particles as charge "clouds", we may be able to get the desired force. A natural consequence of defining the charge density on a grid is that the point particles aquire an effective size and shape. The actual size and shape depends on the weighting scheme used to assign the charge to the grid. Thus, by using different weighting schemes one may alter the particle size and shape and hence modify the force law to reduce the collision rate. Studies of the collision rates for finite-sized particle systems[2,6] show that in 2-D the rate is independent of the number of particles in a Debye sphere and is reduced by approximately an order of magnitude compared to the point particle case. In 3-D, the reduction in collision rate does depend on the number of particles in a Debye sphere but the reduction is still generally larger than in the 2-D case. Chapter 1 PARTICLE SIMULATION THEORY 11 It should be noted that since the force is independent of r in 1-D, it is not necessary, from the standpoint of reducing collisions, to use a spatial grid. However, a grid is generally used since the number of numerical operations required is lowered significantly in most problems. Also, using a grid smooths the fields since no fluctuations smaller than a grid spacing are resolved. The limit on how coarse you may make the grid is generally set by the Debye length. The grid needs to be fine enough to resolve a Debye length in order to calculate properly the charge density (and hence the electric field). 1.5 P A R T I C L E and F O R C E W E I G H T I N G As mentioned in the previous section, whenever one uses a grid for the charge density, point particles acquire effective sizes and shapes; we will denote the effective shape by S(x). In the nearest grid point (NGP) or zero order weighting, the complete particle charge (or other grid quantity) is assigned to the nearest grid point. As a particle moves into the jth cell,through the cell boundaries at x — Xj ± A i / 2 , the grid density due to that particle jumps up. Likewise, when the particle moves out of the cell, the grid density jumps down. The net result is that the particles appear to be finite sized with a rectangular shape of width Ax. Unfortunately, the abrupt change in density at the particle edges produces sharp discontinuities in the field quantities as particles pass through the grid. This makes the N G P method very "noisy" in both space and time. First order weighting schemes are an improvement over the NGP scheme. They are called Cloud-in-cell (CIC) or Particle-in-cell (PIC) weighting. In CIC weighting, the par-Chapter 1 PARTICLE SIMULATION THEORY tides are considered to be uniformly charged clouds of a definite size and shape which can pass freely through each other. In PIC weighting, the particles are considered to be point particles but their total charge is interpolated to the grid. Although CIC and PIC weighting are not identical, in 1-D the difference is more one of viewpoint—they are com-putationally equivalent[7]. Therefore no further distinction between the two will be made here. In the particle-in-cell scheme, assignment of the point charge at position x is by linear interpolation to the nearest two grid points. The net effect is to produce a particle with a triangular shape of width 2 Ax. Since there are no sharp discontinuities, first order weighting smooths density and field fluctuations relative to zero order weighting. First order schemes do require more computation time per particle than NGP weighting but this is usually more than offset by the fact that a coarser grid and fewer particles can be used for a given noise level. Particle-in-cell weighting is used for both charge assignment and force interpolation in E S R l . Higher order weighting schemes involving the use of quadratic or cubic splines have also been employed by others [3,7]. These methods smooth out the particle shape even more than CIC/PIC weighting and so are a further improvement as far as noise suppression is concerned. The drawback to their use is the further increase in computation time required. Following Langdon[7], we will look at the effect of the grid on the charge density for a point particle at position x. Without a grid, the charge density is given by q6[x' - x). With the inclusion of a grid, the particle aquires an effective shape, S(x), (for example triangular of width 2 Ax in the case of first order weighting). Its charge density is then given by qS{x' — x), where q is the total charge given by q / dx'S(x' — x). Chapter 1 PARTICLE SIMULATION THEORY 13 The grid charge density pj, is obtained from the charges q< located at X{ from: Pi = X ] 9 t S ( z i - *t)» (1 - 4) i (t subscripts refer to particle quantities and j subscripts refer to grid quantities). The force on the particle may be found from: Fi = 9 i A i £ EJS{XJ - xi). (1 - 5) Here Ej is the electric field on the grid; we will defer its calculation to section 1.8. As also will be shown in section 1.8, one method of solving Poisson's equation involves using the Fourier transform of pj. In those cases, whenever we transform the charge density we must include the Fourier transform, S(k), of the charge shape S(x) : S(k) = j <fxS(x)e (- , k x>. (1 - 6) Normally, one uses the same weighting in both the density and force calculations in order to prevent particles from accelerating themselves (self-force) and to ensure momen-tum conservation. Using different weighting functions can also lead to a gravitation-like instability[8]. Hockney and Eastwood[3] show that in the absence of roundoff errors, total momentum is conserved if: (i) identical charge assignment and force interpolation functions are used, and, (ii) correctly space-centered difference approximations to derivatives are used. Chapter 1 PARTICLE SIMULATION THEORY 1.6 E F F E C T S of the S P A T I A L G R I D Langdon[7] and Lindman[9] have analyzed grid effects in detail. They found that the effect of the spatial grid is twofold; it smoothes the interaction force and it couples plasma perturbations to perturbations at different wavelengths (aliases). The coupling strength depends on the smoothness of the weighting (interpolation) method used. Let us look at this in more detail. The force on a particle at position x is: where kp = k — pkg and the grid wavenumber, kg, is given by kg — 2n/Ax. The p 7^  0 terms couple the density perturbations and forces at wavenumbers that are integral multiples of the grid wavenumber, kg. These wavenumbers are known as aliases. Similarly, the charge density in k-space may be shown to be: (1 -7) where n(z') is the particle density. Transforming this we get, (1 -8 ) oo (1 -9) oo Again one sees that aliases become coupled through the grid. Chapter 1 PARTICLE SIMULATION THEORY 1.7 T I M E I N T E G R A T I O N of the P A R T I C L E S Assuming we already know the electric and magnetic fields on the grid, and hence at the particle positions, we need a discrete (finite difference) form for the Newton-Lorentz equation of motion. The most commonly used method, and the one used in E S R l , is the leap-frog method. In this method, the continuous equations are converted to the finite difference forms as follows: m — = F dt m At = Fold, (1 - 10) anc dt — v At — v. (1-11) Using equation (1-10), v n e u, is calculated and then equation (1-11) is used to solve for The leap-frog method used here is time centered and has an error that is proportional to {At)2. To see the time centering, consider equation ( l - l l ) . x n e w is defined at time t + At and x0;<i is at time t; the difference is centered about time t + At/2 —which is where vnetv is defined. Let us now examine the error in going from the continuous equations of motion (the LHS of equations (1-10) and (1-11)) to the finite difference forms (the RHS of the same equations). We will work in one dimension for simplicity. Let i be the solution to the continuous equation of motion, d?i dt2 - F / m . (1-12) Chapter 1 PARTICLE SIMULATION THEORY Combining the finite difference forms of equations (1-10) and (1-11) we get z t + A t - 2 i t + s t - A t _ F(xt) (1-13) A t 2 TO Now substitute x into equation (1-13). The error, tt, is defined as the difference between the LHS and the RHS: F(xt) i t + A t - 2xt + £ t - A t . . . U T~i • (1 - 14) TO At2 We now do a Taylor series expansion of i t + A t a n ^ ^t-At around xt to get: €t -F(x t) d2i TO dt2 {At)2 d*i + time — t 12 dt* + ... {higher order terms). (l — 15) time — t Thus we see that tt oc {At)2. Using the Newton-Lorentz equation for the force on the particles, F — q{E + v x B) , equation (1-10) becomes rt+At/2 - V t - A tJ1 = L ^ + * t + w + * * - « / * x B y ( 1 _ 1 6 ) At The method used in E S R l to solve this equation was devised by Boris[10]. Using this method, separation of the parallel and perpendicular components of v is not required. Briefly, if one substitutes gEAt v t - A t / 2 = v - — , (1-17) and . qEAt V T + A t / 2 = V + + , 1-18) ' 2m Chapter 1 PARTICLE SIMULATION THEORY into (1-16), then E cancels out, leaving v + _ V " ( v + + v ) x B , (1 - 19) At 2m which is just a rotation of v + and v~~. So the steps in the algorithm are : (i) calculate v~ from equation (1-17) knowing v t _ A t / 2 and E . (ii) use equation (1-19) to obtain v + . (iii) use equation (1-18) to obtain v t + A t / 2 . To handle relativistic particles, v is replaced by u where u = 7V [l|. Equation (l-16) becomes u t + A t / 2 - n , . A t / 8 = g_ / 1 u t + A t / 2 + u f _ A t / 2 x \ At m \ c 27t / y ' where m is the rest mass and 7 2 = 1 + (u~/c) 2 = 1 + (u + / c ) 2 . Using these definitions, equations (1-17),(1-18), and (1-19) become - qEtAt « t - A t / 2 = « . U " 2 1 ) ' 2m U « + A « / 2 = u + + (1 - 22) and, ( u + + U - ) x B t . (1-23) At 2m7fC Equation (1-23) expresses a rotation of u + and u~ through the angle fqBAt\ 0 = -2 arctan , (1-24) \ 2^mc J Chapter 1 PARTICLE SIMULATION THEORY 18 about an axis that is parallel to B . In E S R l , where we have only ux,uy, and Bz, an algorithm conceived by Buneman[2] is used to solve equation (1-23): u'x = u-+u-t, (1-25) it+ = tt" - u'xs, (1 - 26) and, where ut = u'x + up, (1-27) * = - t a n ( 0 / 2 ) = ^ ^ , (1-28) and 5 = - s i n ^ ( T T ^ ) - t 1 " 2 9 ) One final note. In order to be truly relativistic, the finite sized particles should undergo a Lorentz contraction—making the form factor a function of velocity. If the particles are highly relativistic, then the particle size may try to become less than a grid spacing (which of course it can't because of the charge interpolation scheme). Dawson, [6], notes that to his knowledge such corrections have never been employed and that for even strongly relativistic situations, reasonably accurate results are obtained without the correction. E S R l does not contain the correction. Chapter 1 PARTICLE SIMULATION THEORY 19 1.8 I N T E G R A T I O N o f the F I E L D E Q U A T I O N S Starting with the charge and current densities defined on the grid, one uses Maxwell's equations to solve for the fields, E and B . In electrostatic codes like E S R l , we have dB V x E = - — = 0, (1-30) at so that working in one dimension we get anc dd> E = -V<£ — Ex = (1-31) ox dEx V • E = p —> —- = P, (1-32) ox The finite difference forms of equations (1-31), and (1-33) are Ej - ^ , (1 - 34) and (Ax) 2 where the subscript j refers to the grid location. = -Pj, (1 - 35) One method of solution for the above equations is to use a direct finite-differencing technique such as Gaussian elimination [3j. In E S R l , we take advantage of the system periodicity to solve equations (1-33) and (1-34) by using Fourier transform methods. Dis-crete Fourier series are used for all the grid quantities—p, <j>, and E—and this means that Chapter 1 PARTICLE SIMULATION THEORY (spatial) spectral information is available on them. This proves helpful in relating the simulation results to theory and it also allows smoothing of field quantities. We define the discrete Fourier transform pair for p as [XJ = J Ax) : p{k) = Ax £ p{xj)e-ikxi, (1 - 36) i=o and 2 1 Pi*i) = l £ Pi*)'**'- (1-37) ( finite system with k — 2nn/L, L — NgAx, and Ng — no. of grid points). The transforms for <f> and E are similarly defined. With these definitions the gradient equation, (1-34), and Poisson's equation, (1-35), become <h^\-h±± = E . -K{k)4>{k) = E{k), (1-38) and 2Ax +i-*-2+i + +i" = — K \ k ) m = P(k), (1-39) (Ax)' with and ic(fc) = fcdif (fcAx), (1-40) tf2(fc) = fc2dif2 ( ^ ) , (1-41) sin 0 • . . d i f 0 = — - . (1-42) Chapter 1 PARTICLE SIMULATION THEORY 21 The term K2 is due to the finite grid size [4]. It is easy to see that K2 —» fc2 as the grid becomes finer. With Ng being the number of grid points, the procedure for solving for electric field, E , is (i) Fourier transform the Ng values of p[x) to get p(k). (ii) use equation (1-39) to obtain <£(k) from p(k). (iii) inverse transform ^(k) and use equation (1-34) to obtain E . There are Ng values of k, starting from fcmjn = 2n/L up to fcmax = T / A X and their negatives, or, in terms of wavelength, A m j n = 2Ax and A m a x = L. For the force we define /+ oo dxF{x)e - n o — ikx (1-43) Using the force interpolated from the grid, equation (1-5), we get /+ oo r dx q&x^EjSfa - x) - oo eik(xj-x)e-ikxj (1-44) Now, reverse the order of the integral and the sum to get F(k) = q •j r r + 0 0 Ax Ej€~ikx' I dx S{XJ - x) e* J \.J — OO fe(xy-z) (1-45) which, since S(-fc) is independent of jf, is F{k) = qE{k)S{-k). (1-46) Chapter 1 PARTICLE SIMULATION THEORY Application of the above ideas, i.e. the effects of the finite grid when one is trying to compare simulation results to plasma theory, may be found in chapter 4, entitled "Cold Plasma Oscillations". 1.9 P A R T I C L E P O S I T I O N and V E L O C I T Y L O A D I N G Since a particle code is basically solving for the development in time of an initial value problem, suitable initial conditions must be specified. This means that the t = 0 positions and velocities of each particle must be loaded into the program. Given the desired particle density, n 0(x), and velocity distribution, /o(v), one must determine the particle positions and velocities. This is done by inverting the appropri-ate cumulative distribution function. For simplicity, we will illustrate the procedure by examining the case of a 1-dimensional velocity distribution. Assume that we wish to load the particles from v — 0 to v — vmax using the distribution function f(v) = exp {-v2/2v2h). The cumulative velocity distribution function is defined by vi \ / 0 V exp(-t; 2 /2t; t 2 Jdt; Fiv) = 7 ^ ; 2 / o 2 v . • (1-47) Jo exp[-v2/2v*k)dv Here vth. is the thermal velocity, defined by / k T . , VtH = yJ— • 1 -48 V m (Note that for a 1-D thermal distribution, the integration over f(v) must be evaluated numerically). Chapter 1 PARTICLE SIMULATION THEORY First, the distribution function f[v) is normalized so that the integral from — vmax to +Vma.x equals the number of particles for the species. Then, the cumulative distribution function, F(v), represents the number of particles with velocities < v. The velocity in-itialization is obtained by integrating from 0 to v and assigning the velocity v to a particle each time the integral increases by one over its previous integer value, i.e. C 1 mdv nv)dv = 1 particle. (1-49) In this way, one-half of the particles are loaded with their velocities in the range 0 to +vmax- The remaining particles are then assigned the negatives of these velocities. Initially, the particle positions are loaded uniformly over L , the system length. Thus, if the velocities, v^ , are chosen ordered, as they are when loaded using cumulative distribution functions, then the positions must be scrambled. One way to do this is to assign positions randomly over the system length. Intuitively, this method would seem good since in real plasmas the particles are distributed randomly in space. Also, the method is easy to implement since random number generators are readily available. However, with random starts one usually gets a certain amount of bunching in phase space. This bunching is equivalent to having correlations amoung the particles. Thus, for example, although the particles may still conform to a Maxwellian distribution over the total system length, over short sections they may not. The result is that noise levels are introduced into the simulation which may be larger than exist in a laboratory plasma. For some simulation experiments this may not be a problem, but for others, such as Landau damping where the low-amplitude waves are important, it may be unacceptable. Chapter 1 PARTICLE SIMULATION THEORY 24 A way around this problem is to use what is known as a quiet start. In quiet starts, one tries to load the particles in phase space as smoothly as possible. This is done either by loading the particle velocities in regular arrays or, by using non-random point sets—bit-reversed sets. Generally, non-random point sets have been more successful since loading in regular arrays can lead to various non-physical instabilities and recurrences[ll,12]. Table 1-1 shows how base-two and base-three bit reversed fractions are obtained. Base 2 Bit Reversed Fractions Decimal Base-2 Base-2 Fraction Decimal 0 0 0.0 0 1 1 0.1 1/2 = 0.500 2 10 0.01 1/4 = 0.250 3 11 0.11 3/4 = 0.750 4 100 0.001 1/8 = 0.125 5 101 0.101 5/8 = 0.625 Base 3 Bit Reversed Fractions Decimal Base-3 Base-3 Fraction Decimal 0 0 0.0 0 1 1 0.1 1/3 = 0.3333 2 2 0.2 2/3 = 0.6666 3 10 0.01 1/9 = 0.1111 4 11 0.11 4/9 = 0.4444 5 12 0.21 7/9 = 0.7777 T A B L E I I B I T R E V E R S E D F R A C T I O N S Using these number sets the particles may be positioned uniformly (but not ordered) in phase space. Details on implementing this in the simulation code are deferred to section 2.3. Chapter 1 PARTICLE SIMULATION THEORY Comparisons between loading schemes that use bit-reversed, Fibonacci, and random number sets have been made by Denavit and Walsh[l3]. They found that bit-reversed number sets provide a good means of obtaining quiet starts with low initial noise levels. The noise levels do grow in time but they never exceed the levels obtained when random initializations are used. They also found that for a given mode the duration of the initial quiet period increases with wavelength. This means that quiet starts are especially suitable for problems where the long wavelength modes are most important. Regardless of which of the above loading schemes are used, the particles are not ar-ranged in phase-space to get Debye shielding. Thus, the simulation generally takes 1/4 to 1/2 of a plasma period to adjust so that the fields, positions, and velocities are self-consistent. This adjustment period is especially noticeable in the Landau damping runs where it appears as an abnormally large first peak in the electrostatic field and mode energies. 1.10 C O M P U T E R V A R I A B L E S If certain variables in the equations to be solved are normalized, it is possible to eliminate a number of numerical operations from each timestep. To see this, we first re-write equations (1-10) and (1-11) for the leap frog particle mover in order to solve for vnew and x n e u i . We get Vnew — V0ld H , (1-50) m and Xnew = *old + VnewAt. ( l ~ 5 l ) Chapter 1 PARTICLE SIMULATION THEORY If we now write x in terms of Ax and t; in terms of Ax/At, i.e. x x — + — , (1-52) Ax and vAt v — • — , (1 -53 Ax equations (1-50) and (1-51) become SvAt\ =(v_At\ ] qEold(At)2 and ( f ) = ( f ) + ( ^ ) • ( ' - » » ) ^ Ax/new V A x / o l d \ A x / n e u ; Equation (1-54) may be even further optimized (providing there are many more particles than grid points—the usual case) by normalizing E , the electric field, by forming the variable A as follows a = , e £ 1 4 M ! ( 1 _ 5 6 ) m Ax By normalizing x, v, and E as shown above, the process of updating the positions and velocities is reduced to a series of additions—numerous multiplications by At each timestep are avoided. Chapter 2 PROGRAM ESRl Chapter 2 P R O G R A M E S R l 2.1 I N T R O D U C T I O N In this chapter we show how the theory discussed in the previous chapter is imple-mented in an actual code; in this case a 1-1/2 dimensional electrostatic, relativistic model known as E S R l . A few of the main features of E S R l are: (i) it will handle a variety of different particle loading schemes including cold beams, maxwellians, drifting maxwellians, etc. (ii) it will handle relativistic particle velocities. (iii) it solves Poisson's equation using efficient fast Fourier transform methods. The program E S R l is usually run on the UBC Floating Point Systems FPS-164 Array Processor. Another version of the progam is available which runs on the Amdahl. A second program, ES1PLT, contains the routines for reading the unformatted output data from E S R l and producing plots. A user's guide and a complete listing of the program are included as Appendix B. Chapter 2 PROGRAM ESRl 2.2 O V E R A L L S T R U C T U R E o f E S R l The program starts by specifying various default values for system variables. These defaults ensure that if no other parameters are input a "cold plasma oscillation" run will be executed. Next, a call to S Y S $ G E T D A T E retrieves the system date and time from the FPS-164. Subroutine D A T E M E then formats this data so that it may be easily used for date and time stamping of all printed and plotted output. Following this, the program reads the changes to the default input data via the NAMELIST statements. E S R l then calculates several variables and system constants and, if the run is a restart, gets the resart parameters via a call to R E S T O R . A printout of the input parameters that characterize the run is then made. Particle position and velocity loading is done next. The particles are first loaded evenly spaced over the entire system length and given a drift velocity if required. When a non-zero temperature is specified, a call to subroutine C R E A T R will load the particles with a Maxwellian distribution of velocities. If the temperature is high enough, a relativistic Maxwellian distribution is used. Calls to S E T R H O , FIELDS, and S E T V follow. In SETRHO the charge density is accumulated on the grid and the positions are normalized. The initial call to FIELDS sets up the fields on the grid and calculates the field energy. SETV (via a call to A C C E L ) accomplishes the task of calculating the velocities a half step backwards in time. This is needed because the simulator loads all positions and velocities at time zero. However, the leap-frog particle mover requires the particle positions, x, to be defined at a time At/2 larger than the time at which the velocities, v, are defined. Chapter 2 PROGRAM ESRl Now, with x and E defined at t — 0, and v defined at - At/2, the program starts to cycle through the timestep loop. First a call to A C C E L is made. Here the velocity is advanced one timestep and the momentum and kinetic energies are calculated. Next, in subroutine M O V E , the particle positions are advanced and the charge is accumulated on the grid. FIELDS then uses these grid charge densities to calculate <f>, the electric potential, using Poisson's equation. Also in subroutine FIELDS, the electrostatic field and mode energies are calculated and field "snapshots" are saved. After FIELDS, program control passes back to A C C E L to begin another timestep loop. At the end of the run (and sometimes during the run if it is very long), subroutine HISTRY is called to save various quantities versus time for later plotting. The subroutines used in E S R l will now be discussed in more detail. 2.3 Subroutine C R E A T R In order to load a non-relativistic Maxwellian distribution of velocities, one does an inversion of the cummulative distribution function, F(v), where , ( T ) . ^ ( - ' V ' f * ( J _ „ Jo exp{-v2/2v*h)dv Here vth is the thermal velocity, defined by vtk=\^—- (2 -2 ) V m Chapter 2 PROGRAM ESRl For a 1-D thermal distribution, the integration over f(v) must be evaluated numerically. In the case of a 2-D isotropic, thermal distribution, /(v), the integration may be done analytically since we have speed, v = yj v* + v 2 , 9 — arctan ( — J , and dx — 2nvdv. If the temperatures are low (non-relativistic), then the distribution functions f{vx) and f{vy) are each normalized so that the integral from — vmax to +vTnax equals the number of particles for the species. The velocity initialization is obtained by integrating from 0 to v and assigning the velocity v to a particle each time the integral increases by one over its previous integer value. In this way, one-half of the particles are loaded with their velocities in the range 0 to vmax. The remaining particles are assigned the negatives of these velocities. In E S R l , vmax is set to 4vth-For isotropic distributions with relativistic temperatures, the 2-D relativistic Maxwellian is (p = Tf|v|/c): , N P m c 2 1 f\P) = ly rp~ ll , T I 2 T e i P 2w 1 (1 + T/mc') mc 2 ( 7 - 1 ) (2 -3 ) In E S R l , f{p) is normalized by setting the integral over all p equal to the number of particles in the species: r 2?r r oo / d9 / f{p)Pdp = NP, (2 -4 ) Chapter 2 PROGRAM ESRl 31 where 9 = cos~1(Px/p) = s in _ 1 (p y /p) . The number of particles in the first quadrant is obtained by integrating from 0 to 7r /2 . If we also change the integral to a sum (i.e. we integrate numerically) we obtain *- £ (nAp)Ap/(nAp) = -f. (2 - 5) n-l Np is the number of particles assigned to all quadrants up to the value of p. Each time the running index IP reaches a value which increases the value of the integral by one over its previous integer value, a particle is assigned the quantity p = IP&p and an angle 9 between 0 and n/2. To prevent drift and bias in vx and vy, 4 particles with the same p but the angles 9,9 + TT /2, 9 + n, and 9 + 37r/2 are loaded at each step. The particle velocities are obtained from p by using the relations p cos 9 — 7 vx, (2 -6 ) and psin 9 — 7 v y . (2 - 7) If a drift velocity, t;0, is specified, it is added relativistically to each particle velocity [14]: v * = 7 T ~Ti a n d "y = " T T TV • 2 - 8 , 9 For a quiet start, the angle 9 is generated using a radix-three bit reversed number set and the particle positions are "scrambled" using a radix-two bit reversed set. Chapter 2 PROGRAM ESRl If a random start is specified, the angle 9 is generated using a random number gener-ating routine and then a call to subroutine SMEAR is made in order to perform random pair exchanges of the particle positions. One final comment about subroutine C R E A T R . In E S R l , Ax/At is set equal to the speed of light, c. Since subroutine C R E A T R gives velocities in terms of c, it means that the velocities output from it are already normalized as discussed in section 1.10 ("computer variabl es"). 2.4 Subroutine S E T R H O During initialization , this subroutine is called once for each species. In S E T R H O , the particle positions, x, are converted to x/Ax, and the charge is accumulated on the grid points using linear (first order) weighting. 2.5 Subroutine F I E L D S As shown in section 2.6, the three point difference form for Poisson's equation gives <Pj-i ~ 2<t>j + <t>j+i (Ax)2 — > K2(k)<p(k) = p(k) , (2 - 10) with (2-11) and sin 9 (2-12) dif 9 = 9 Chapter 2 PROGRAM ESRl One of the first things done in FIELDS is to calculate K2(fc), the ratio of p(k) to <f>(k). At the same time, a quantity called SM(k) is calculated. SM(k) is a smoothing factor which allows one to modify the k spectrum in going from p(k) to <f>[k) [4]. It is usually used to eliminate unwanted short wavelengths but it may also be used to enhance long wavelength modes. Calls to subroutines C P F T and RPFT2 Fourier transform p(x) to p(k) which is then multiplied by l / K 2 (KSQI), to obtain 4>(k). At this time the electrostatic field energy is calculated using the formula 1 km a x E SE = — ] T > W ( * ) - (2-13) The electrostatic energies for specified individual modes are also calculated here. Next, p(k) and <f>(k) are transformed back by calls to RPFTI2 and C P F T and the electric field is solved for by using a centered difference across two cells. 2.6 Subroutine S E T V The subroutine C R E A T R loads particle positions and velocities at time t = 0. How-ever, the leap-frog particle moving algorithm requires x to be leading v by At/2. Subroutine S E T V is used to change v(0) to v( — At/2). First, if a magnetic field is present, the fields at t = 0 are used to give a half-step rotation backwards. Then, SETV makes a call to subroutine A C C E L with q replaced by —q/2. This causes a half-step acceleration qE to be applied. Chapter 2 PROGRAM ESRl 2.7 Subroutine A C C E L In this subroutine, the two-step acceleration/rotation scheme as outlined in section 1.7 is implemented. First, the variable _ q Eold[At)2 TO Ax is formed at each of the grid points. As shown in section 1.10, in this way vnew may be very simply calculated by using only one addition for each particle. Next, based on the value of \q/m\, A C C E L chooses either a relativistic or non-relativistic algorithm for doing the acceleration and rotation. After the particle velocities have been advanced one timestep the kinetic energy is calculated. The relativistic formulation of the kinetic energy is given by K E = (f - l)mc 2 . (2 - 14) The calculation is done both relativistically and non-relativistically and then the larger of the two values is used (since for low velocities the relativistic formulation may be too low because of truncation). The kinetic energies output from E S R l are given in terms of the total rest mass energy of species 1 (electrons). The drift momentum per unit mass is next calculated. Since the drift momentum is defined as m Yl Hvi the drift momentum per unit mass is given by YL livi (sum over all particles). Since all velocities are normalized to light speed, c, the drift momentum per unit mass as defined here will be in units of c. Chapter 2 PROGRAM ESRl 35 Whenever IT, the timestep iteration counter, equals I T H E R M , the temperature profile plotting frequency, the relative kinetic energy, R E L T , is calculated and temperature profiles are saved. R E L T is defined as (the K E of the average (drift) motion plus the random motion) minus (the K E of the average motion). The parameter V L I G H T is presently only a dummy variable. It will eventually be used to specify the ratio of the speed of light, c, to D X / D T . This will allow the program to be used with fewer timesteps when simulating non-relativistic phenomena. 2.8 Subroutine M O V E Subroutine M O V E calculates the new particle positions, x n e w , from xQn and vntw using equation (1—11). If x n e w is outside the range of the simulation box, it is shifted one period to the left or to the right in order to have it in the range 0 < x n e w < L. After the new positions are calculated, they are used to accumulate the charge on the grid using linear weghting (PIC). 2.9 Miscellaneous Subroutines Subroutines R I T E R l and RITER2 are used to write various system variables and constants to an output file for later printing. Subroutine C P F T is used to do forward and reverse fast Fourier transforms (FFT's) on complex data[4]. It transforms o(x) + ib(x) into A{k) + iB(k). Since in ESRl we only transform real data, (<j> and p), a factor of almost two in speed may be gained by setting up pairs of real data and transforming them at the same time. RPFT2 sets up the real Chapter 2 PROGRAM ESRl sequences and RPFTI2 extracts the sequences after an inverse transformation. Calls to R P F T and then C P F T will effect a forward transform while calls to RPFTI2 and C P F T will initiate an inverse F F T . Subroutine SAVEIT is used to periodically save certain system parameters so that the run may be restarted. Subroutine R E S T O R is called if a restart is specified. It reads the data stored by SAVEIT back into memory. Subroutine SMEAR does random pair exchanges on a specified array. It is used in the particle loading routines. Function R A D R E V generates a number between 0 and 1 by mixed-radix digit reversal. It is called by subroutine C R E A T R if a quiet start is specified. Subroutine P E A K S calculates the frequency and the damping rates from the electro-static field and mode energies. 2.10 Program E S 1 P L T Program E S l P L T first reads the unformatted data produced by program E S R l and then converts it to data that can be recognized by the Amdahl computer. This conversion is necessary because of the different word lengths on the A P and the Amdahl (64 and 32 bit words respectively). Next the requested plots are generated and put into a plot file. This plot file may then be used to view the plots on a graphics terminal or to produce hardcopy. Chapter S THE PLASMA DISPERSION RELATION Chapter 3 T H E P L A S M A DISPERSION RELATION 3.1 I N T R O D U C T I O N We start this chapter by first reviewing the derivation of the dispersion relation for a relativistic plasma. We then solve it for three different distribution functions—cold beams, non-relativistic Maxwellians, and finally relativistic Maxwellians. In the following chapters these results will serve as benchmarks to which the simulation results will be compared. 3.2 D E R I V A T I O N of the D I S P E R S I O N R E L A T I O N The index of refraction is defined by _ c ck Any medium in which the index of refraction is a function of frequency is said to be dispersive. By definition the dispersion relation is the equation that gives w as a function of k. All the information pertinent to the propagation, growth, and/or decay of waves in a plasma is contained in its dispersion relation and so this equation occupies a key position in plasma theory. Chapter S THE PLASMA DISPERSION RELATION We will derive the dispersion function by solving the collision less Boltzmann equation (the Vlasov equation). The relativistic generalization of the Vlasov equation is given by [15,16], p df / p x B \ df , TO7 ax \ 7mc / op dt We will consider a plasma with only one species (electrons) in a uniform, immobile neutralizing background of ions and no external magnetic field. We let the distribution function be a combination of an unperturbed velocity distribution function, fo — /o(p), and a small perturbation, f\ = / i (x ,p , i ) : / (x,p,t) = / 0 (p) + A ( x , p , 0 . (3-2) We let the electric field be in the x-direction and consider waves which vary in only this direction. In the absence of any externally applied fields, the electric field, E , is proportional to fx and we assume that fi, and hence E j are proportional to expt(k • x —wt). We now substitute equation (3-2) into (3-1) and look at linearized solutions (i.e. we drop all quadratic and higher terms). The first order equation is: ^ L + i . ^ l + , E l ^ o = „ . ( 3 _ 3 ) at m7 ox op The Fourier-Laplace transform and its inverse are defined by /oo r r r oo dt J J J dxexp[-t ' (kx + u;r)]/(x,<) , (3-4) anc Chapter S THE PLASMA DISPERSION RELATION where the integral over ui is along the Laplace contour. Using equation (3-4) and the fact that the Laplace transform of a differentiated quantity is given by = ->wg(w) - g(t - 0) , (3 -6) the first order Vlasov equation, (3-3), becomes -iw/jfk.p.w) + l—^-fi + qEx{u>)-^- = / , (k ,p , t = 0) , mf op (3-7) which may be solved for fx to get /i(k,p,u>) •gE1(u;)ap/o + / i (k ,v > t = 0) i (k • p / m f — u;) (3 -8) where dp = d/dp. When transformed as above, Poisson's equation becomes i&Ei(u;) = -4nqn0 J dp /i(k,p,u;) (3-9) Substituting equation (3-8) into (3-9) and rearranging yields [ 47r g 2 n 0 f dp f0 k 1 ^ — / d P T7U / — tk J i (K • p/m-y 7 - w) Ej (a») — —4nqn0 fdp-M J p i: fk • / 1 ( k , P , t = o) (  • p/nry - a/) ' (3 - 10) The factor in the square brackets is the dielectric function; working in 1-D, it is e{k,uj) = 1 w > f . °pfo (p/m7 - u/k) (3-11) Since the zeros of the dielectric function give the normal modes for the plasma, we set t(k,u>) — 0 to get the dispersion relation : k — 0JZ.m I dp dPfo v ' (p/»"7 - w/fc) (3-12) Chapter S THE PLASMA DISPERSION RELATION If we have more than one species the right hand side becomes a sum over j species : * = I » , / * ( p / m ^ , / t ) • (3 - .3) We will now look at solutions to this dispersion relation for various distribution func-tions, /o-3.3 D I S P E R S I O N R E L A T I O N — C O L D B E A M S A cold beam is composed of particles that have a drift velocity but no thermal spread. Its distribution function is foj{p) = % - 7 i " W ) • ( 3 - 14) Substituting (3-14) into (3-13) we get Y M 3 J ' ( p / m i 7 i - « / * ) 1 ' We now use the relation /OO /> oo dx 6'{x - a) f(x) = - / dz 6(z - o) /'(z) - oo J — oo = - / ' ( o ) , (3-16) to get * 2 = E ^ l — » ; ( 3 - 1 7 ) r 7 ? k - "/*)* or * 2 = : ^ . (3 - is) Chapter S THE PLASMA DISPERSION RELATION 41 where < = "lh? , (3 - 19) is the relativistic longitud inal plasma frequency, and is defined by : 7 j = ( l - v | / c 2 ) - 1 / 2 . (3-20) If we adopt the convention that these quantities are measured in the observer's coordinate system (so that Wpj/lj varies as the rest density and thus is invariant), then equation (3-18) is valid in any coordinate system[l7]. 3.4 D I S P E R S I O N R E L A T I O N — N O N - R E L A T I V I S T I C M A X W E L L I A N In the case of non-relativistic plasmas the dispersion relation, equation (3-12), reduces to the usual formula: Solution of this equation must be found by integrating along the Landau contour[5,l8]. Assuming we have a Maxwellian distribution and that the phase velocity of the wave, v^, is much larger than the thermal velocity, vth, the dispersion equation, (3-21), gives the following results: u; 2 = u , 2 + 3k2v2th , (3 - 22) a , ^ - W p ( ^ ) 2 ( ^ e x p ( T ) e x p ( 2 T % ) ' { 3 - 2 3 ) where = ~ ~ and vtk = J— . (3 - 24,25) w„ V m Chapter S THE PLASMA DISPERSION RELATION 42 The imaginary part of the frequency, Ui, vanishes for k —• 0 and increases rapidly with an increase in the wavenumber. When grid effects are taken into account, equations (3-22) and (3-23) become[4]: u,2 = S2(fc)u;2 + 3fc2t;2l , (3-26) and with <»-»> for first order weighting. The above results are only valid for small wavenumbers (i.e. only for u>j <S u>T). When this condition is not satisfied the dispersion relation, equation (3-21), must be solved numerically. A listing of well known numerical results is presented in Table III-l. 3.5 D I S P E R S I O N R E L A T I O N — R E L A T I V I S T I C M A X W E L L I A N When very hot distributions are encountered one must use the relativistic dispersion relation, equation (3-12): fc2 - « J m / dp d * f ° . (3 - 12) J (p/mi - u/k) The one dimensional Maxwell-Boltzmann distribution function is given by: f o = , y f ] \ , e x P ~ 1)1 . • (3 - 29) 2cKi (A)expA Chapter S THE PLASMA DISPERSION RELATION Dispersion Relation — Non-Relativistic Maxwellian k/kD 0.8000 0.7000 1.799899 1.673865 0.534552 0.392402 0.6500 0.6000 1.610048 1.545706 0.326331 0.264111 0.5500 0.5000 1.480879 1.415661 0.206241 0.153360 0.4500 0.4000 1.350249 1.285056 0.106291 0.066128 0.3500 0.3000 1.220952 1.159845 0.034318 0.012621 0.2500 0.2000 0.1500 1.105728 1.063980 1.034823 0.002164 0.000055 0.000000 T A B L E III - l DISPERSION R E L A T I O N — Non-relativistic Maxwellian. where mc 2 - y = ( l - v 2 / c 2 ) - * = (l + u 2 / c 2 ) " , u = 7 V , and Ki (A) is a modified Bessel function of the second kind. Using equation (3-29) for /o, the dispersion relation, equation (3-12), was was solved numerically for a number of different temperatures (ratios of uth/c). The results are displayed in Table III—2. This ends our review of the plasma dispersion relation. In the next three chapters, we compare analytical and numerical solutions to this equation with simulation results for three different distribution functions. Chapter S THE PLASMA DISPERSION RELATION © © C M 3 C M o © eM m t-—, oo TT CO d d m L A 0 — © r» 0 1 © M 4 o © © © © CM CM CO 00 LA CO 00 CM © CM Ol CM IA 00 o CM p ^ © 00 CO © 00 00 LA LA Ol © Ol CO © 00 o © l ~ CO © oo r- © © 1 - o> CM © r» CO co LA o> p ^ © © 1 1 1 © CO P ^ 00 © Ol LA co O 00 LA TT CO CM © o o © © 1 1 1 CO CO CO CM CM CM CM q p o q q © o q o © q © d d d d d d d d d d d d d d d d d d © © d d d d d CM © © tA CM CO 00 00 © LA CO CO LA 00 00 oo Ol CO © © CM CO L A © 00 o CO LA r» © Ol LA CO CO © CO © Ol r» LA 00 o> o p ^ CM CO in © 00 Ol CM CO LA r~ Ol •v © CO CM CO i 1 1 co © 00 LA CM ©1 © CO © r» CM Ol © CO o c- LA CM Ol C^  CM o 00 1 1 1 l"» © © © LA LA LA LA T1 CO CO CO CO CM CM CM © t~ eM CO — H o 00 CO t» o O) CO Ol IA 00 00 © 00 00 Ol CM LA CO lA CM lA © o> LA 00 O © 00 !•» tA tA © o 00 Ol LA Ol CM p ^ CM © p ^ •V 00 CM CM o> LA CO < CO © © LA CM Ol Ol Ol CM © CO p ^ © © 1 00 LA CO o 00 1 A CO p ^ Ol LA CO «^ Ol 00 © LA CO CM © o o © © 1 CO co CO CO CM CM CM CM o o q O © q © o o © © © © d d d d d d d d d d d d d d d d d d d d d © d d d d d © eM o o CM oo CM o © © t~ © Ol Ol Ol o Ol 00 ©1 | A P"« © © © c- t~ 00 CO Ol !>• © CO CM © © CO to Ol CM c» oi CM © Ol CO © 00 © CO LA 00 P H LA Ol CO Ol © LA © Ol 1 •v P " * oi © co © 00 tA CM Ol r» •"Cf 00 © CO O t-~ LA CM Ol TT CM © 00 © 1 r~ © © © © lA lA LA •<r TT •<r CO CO CO CO CM CM CM * H o © L A © o oi lA © LA 00 LA r- © Ol 00 LA LA t~ 00 Ol o CM Ol O IA CM IA LA Ol •v © © LA © p ^ 00 CM •V co © © r- LA © CM CM 00 CO LA © CO CO o t~ oi CM L A oi T Ol ««• 00 © LA LA © Ol CM |-~ CO o o CO CO © © •v p ^ oi © CO •—< 00 © ^4 Ol LA CO Ol 00 © LA CO CM © © © o © T co CO CO CO CM CM CM CM o q O o O © q o q q o q o d d d d d d d d d d d d d d d d d d d d © d d d d d d d CM 1 A CM CM © CO oo 00 CM CM Ol © 00 LA LA Ol 00 r- Ol CM CO CM 00 © T •-I 00 OS 00 *«r t» Ol © CM LA oo © CO O CO Ol © LA o> CO r» o 00 •V r~- o CO t- o 00 CO 00 CM CO CM Ol Ol © CO 00 LA co o LA CM Ol *4T « ^ Ol © CM o 00 © i~- © © © © 1 A LA LA LA ^ " CO CO CO CM CM CM CM © s LA CM CO CM CM © © CM •V © Ol •fl- LA * M 00 CO CM PP« c- CO © Ol © Ol ^ " LA CO 00 « M o c- •V o 00 I*. Ol "T CO Ol CM P M Ol CM © CM L A Ol CM CM 00 •r- CM O Ol 00 Ol CO t- CM Ol i>. © oo © CM © o © i—< 00 lA CO © 00 LA CO Ol © CM m l Ol r- © •"CP CO CM © o o o CO CO co co CM CM CM CM © O © o o o © O o o o © © d d d © d d © © d d d d d d d d d d d d d d d d d d d c- CM 00 © © 00 CM 00 © © co 00 CM © CM © © o LA T Ol o 00 00 CM lA r- O) oi Ol 00 c» LA CM Ol LA CM Ol © LA IA 00 © Ol © CO o O Ol 00 CO P M LA Ol co LA Ol CM © © co pH LA o> Ol © CO CM co © •*r CM oi c- CM Ol © Ol © CO 00 © co O OO LA CM © c- LA CO p 4 Ol t» © © © © lA tA LA LA T CO CO CO CO CM CM CM CM o O e*» o © CO CO CM C- CM O © LA o 00 © o Ol CM 00 Ol © CM © LA •T o 00 © »- oi © o O © o Ol © CM © CO CO IA CM LA LA CM 00 CM CM CM "cp © 00 © CO CM t~ CM Ol © CO CM CM CM •V © o LA «^ Ol ce Ol CM © CO p 4 o p ^ Ol © CO • P P 00 © CO Ol LA CO Ol 00 © IA CO CM o o o co co co co CM CM CM CM q o o O o O o © © © o o © d © d d © © d d d d d d d d d d d © d d d d d © © d d 00 © !•» o Ol © CO 00 LA LA 00 LA © 00 © CM on o CO LA 00 © CM co LA L A P - * CM CM lA Ol P M CM co CO CM © f~ LA co CM ~* co © l~- Ol p ^ oo **r CM oi oi co 00 CM © LA Ol CO *-* LA 00 CM © © •v oo CM CM 00 © L A 00 CM Ol T CM Ol t- •W Ol © *•* 00 © CO 00 IA CO o 00 LA CO Ol r~ c» r- © © © © LA IA lA LA rr CO CO CO CO CM CM CM CM P N p ^ P M o o © T CM o 00 © CM O 00 © CM O 00 © •V CM © 00 © rr CM O 00 © CM r» © © © © © LA LA LA LA LA co CO CO CO CO CM CM CM CM © o © o o o © o o © © o © o © © o o o o © o o o © o o o z < w x < H oo < •-3 u 2 O < u a. z o So Oi U Ou z o •=> P J O oo o L A © © © r» © 00 © CO d d 3 p - co LA CM © t-oo r« © o 3 L A © L A t— L A © t-L A d d oi "*r — L A O t-oo o L A © b. I Ol CO O 00 C M Ol L A L A CM LA CM o d Ol C M © co CM CO co © L A L A © © © Ol © T © t-00 t— O 00 oo r— Table III-2 DISPERSION R E L A T I O N . Relativistic Maxwellian. Chapter 4 COLD PLASMA OSCILLATIONS 45 Chapter 4 COLD P L A S M A OSCILLATIONS 4.1 I N T R O D U C T I O N In doing a computer simulation one converts the differential equations that describe the plasma behaviour into a set of finite difference equations. In the limit of infinitely small timesteps and grid spacings the difference equations give exactly the same results as the continuous differential equations. However, since in any practical simulation work we are limited to finite differences, we must be cognizant that certain properties may differ between the real plasma and the simulation plasma. For example, weakly damped modes of the plasma may be changed into growing ones (this is known as numerical instability); or, growing modes may be damped. In this chapter we will be concerned only with the effects of the finite grid—we will assume that the timestep is small enough that no effects from it are felt. This situation is generally true as long as the timestep used is shorter than any period of interest, for example, At <?C rp, the plasma period. As mentioned in the previous chapter, all the information pertinent to growth or decay of plasma waves is contained in the dispersion relation. Thus by comparing the computer dispersion relation with that for a real plasma the effects of the finite differencing may Chapter 4 COLD PLASMA OSCILLA TIONS be obtained. The simplest dispersion relation for comparison is the one for "cold plasma oscillations". To see how cold plasma oscillations arise, let us consider, for simplicity, a uniform distribution of electrons in a fixed, neutralizing background of ions. If the electrons are displaced from their equilibrium positions, electric fields are set up which tend to restore the electrons to their original positions. When the electrons return to their equilibrium positions, the electric fields vanish. However, the electrons overshoot their equilibrium positions due to their inertia and continue moving until the electric field is large enough to stop them. The electrons are then accelerated back towards their equilibrium positions where they again overshoot. In the absence of collisions, they will continue to oscillate indefinitely about these equilibrium positions. The frequency of oscillation is characteristic of the plasma and depends only on the density. It is given by [5] : u2p = + u>2 , (4 - 1) where 2 4nnee2 2 4nriiZ2e2 u>e — and u)i — , are the electron and ion plasma frequencies respectively (in cgs units), and Zt is the ion charge. The ions are so massive compared to the electrons that they may usually be considered stationary. We then have wp « oje . (4 - 2) We will now look at the dispersion relation for these waves. Chapter 4 COLD PLASMA OSCILLATIONS 4.2 T H E O R Y The dispersion relation for a cold plasma beam was shown (cf. chapter 3) to be: lj {Vj-U)/k) 2 ' (4 -3) In the non-relativistic, single beam limit (i,j — • 1), we have Jfc2 - - 2 (v - lo/k)' (4-4) For no drift (v — 0), i.e. a stationary, cold plasma, we get the Langmuir result: 2 2 (4 -5) Bird sail and Langdon [4] show that the dispersion relation for a cold plasma taking into account grid effects is given by: where and. Here dif 9 = sin t(k,oj) = 0 = 1 -wp2 kpK{kp)S2(kp) K,(kp) - kp dif(kpAx) , K2(fc) = fc2dty2(^) , S(Jfc) = J dxS{x)el-ik-*l For no drift (VQ — 0) equation (4-6) gives w = w. 1 0 0 — E fcp«(fcP)s2(fcP) p= — OO (4 -6) (4 -7) (4 -8) (4 -9) (4 - 10) Chapter 4 COLD PLASMA OSCILLA TIONS In a real plasma we have the Langmuir result, equation (4-5), but in the simulation the dispersion is given by equation (4-10). Thus we see that the effect of the grid on the dispersion relation is given by the terms in the square brackets in equation (4-10). For a momentum conserving algorithm (i.e. one where the force is calculated by interpolating the differenced potential) and CIC/PIC weighting, we have S(fc„) = dif5 -kpAx (4-11) so that the dispersion relation, equation (4-10) becomes [7], w = w„ COS (4 - 12) 4.3 T R I A L R U N S and R E S U L T S In order to test the effect of the grid on the behaviour of the simulation plasma, two cold plasma oscillation cases were run (run nos. 105422 and 104923). The input parameters for run 105422 are given in Table IV-1. The input parameters for run 104923 are identical to those for run 105422 with the exception of the number of grid points, NG; for run 104923, NG was increased from 32 to 64. In figures 4-l(a,b), the Langmuir result (w = u»p), the exact solution taking into account grid effects, equation (4-11), and the measured values from the trial runs for the dispersion relation are plotted. Good agreement between the exact and measured values were obtained. Chapter 4 COLD PLASMA OSCILLATIONS Input Parameters for run 105422 Parameter Value Description L 47T System length NQ 32 Number of grid points D X .3927 L / N G D T 0.02 Timestep size N T 500 Number of timesteps K0 0.5 27r/fundamental wavelength N l 256 Number of electrons X l l 0.5 Position perturbation V10 0.0 Drift velocity WP1 1.0 Plasma frequency WC1 0.0 Cyclotron frequency T E M P I 0.0 Species 1 temperature Table I V - 1 INPUT P A R A M E T E R S . Run no. 105422. Figure 4-2 displays the electrostatic mode energy plots from run 105422 for selected modes. From these results it is seen that in any system the lowest modes are represented the best. As the number of grid points is increased, the numerical dispersion and the contributions of the aliases (the term in the square brackets in equation 4-10), can be made negligible. Generally one needs n >C NG/2, where n is the mode number of interest. A third cold plasma oscillation case was run in which the initial position perturbation amplitude, X l l , was set to 0.75. All other parameters were the same as in run 105422. This perturbation was high enough so that particle crossings occurred. Figures 4-3(a,b,c,d) show the effect this has on selected mode energies. It is readily apparent that the modes are no longer independent. Particle-crossing effects are also evident on the phase space Chapter 4 COLD PLASMA OSCILLA TIONS plots ( figures 4-3(e,f) ) as "wave breaking". In wave breaking we have multiple particles at the same position but with different velocities. The cold plasma oscillation runs were also used to check the energy conservation prop-erties of the simulation. Since E S R l uses a momentum conserving algorithm, total energy is not conserved. However, in order for the results to be valid, the variation in the total energy should be much less than that of the field energy. This criterion was well met in all the runs made. Typically, the maximum variation in the total energy was less than 0.7 percent, while the field energy varied from zero to 100 percent of the total energy. Plots of the electric field, electric potential, and charge density, (not shown), were also checked and found to have the proper amplitudes and phases. Based on the above results, it may be concluded that E S R l is working properly in the non-relativistic regime. In the next two chapters we subject the program to more extensive tests in which relativistic effects are important. Figure 4-1 (a,b) DISPERSION R E L A T I O N . Run nos. 105422 and 104923. Cold plasma oscillations, (a) 32 grid points, (b) 64 grid points. Chapter 4 COLD PLASMA OSCILLATIONS MODE ENERGY VS TIME MODE ENERGY VS TIME MODE ENERGY VS TIME 16" - 10" 10" 10" CTYVtVH g .0" 10" 10' 10' 10' v!6< S3 1 , c an or 1 1 1 1 1 1 1 «CEC « . i 10 ft* T I * • « • . » omc • mens M S *QI*Tl V I l O T T O ft» IQ. « IOM23 i-M> N . W » J i - j a B J M * H . M 1I>C PLOT m. i 10 MODE ENERGY VS TIME 10" 10" 1 0 T Itt. • tl Figure 4-2 E L E C T R O S T A T I C E N E R G Y — S E L E C T E D MODES. Run #105422. Cold plasma oscillations. The decreasing frequency for the shorter wavelength modes is due to grid effects. Chapter 4 COLD PLASMA OSCILLATIONS Figure 4-3 P A R T I C L E CROSSING E F F E C T S . Run #125627. Cold plasma oscillations run showing the effect on selected mode energies (a,b,c,d). In (e,f), phase space plots at t=0 and at t=25 are displayed. The particle crossings show up here as wave-breaking. Chapter 5 TWO STREAM INSTABILITIES Chapter 5 TWO S T R E A M INSTABILITIES 5.1 I N T R O D U C T I O N In this chapter we examine the modelling of the instability that develops when two equal streams of electrons flow through each other. The temporal behaviour of this "two-stream instability" may be explained as follows, [13,22]. As the two electron beams pass through each other, they begin to interact because the density perturbation on one stream is reinforced by the forces due to the other stream and vice versa. Since An\ tx nj the perturbation grows exponentially in time[23]. As the perturbation is growing, a large potential well forms which traps the electrons. The trapped electrons then oscillate in this potential well at the bounce frequency, wj,, given by [5], l~qlcE V m with k equal to the wavenumber and E the electric field amplitude. The growth continues until the electric field amplitude becomes large enough for the bounce frequency, u>b, of the trapped electrons to become comparable to the growth rate. At this time the growth saturates due to the non-linear interaction of the trapped electrons with the wave. This non-linear interaction may be described as follows. When the trapped electrons reach their Chapter 5 TWO STREAM INSTABILITIES 65 minimum velocity, the wave reaches its peak amplitude. As the electrons regain velocity damp. As the electrons continue rotating in phase space, energy is traded back and forth between the beam and the wave and so the wave energy oscillates about some mean value. The two-stream instability has been studied extensively in connection with noise in the solar corona, enhanced diffusion in plasma confinement devices, and as a source for heating plasmas to thermonuclear temperatures [17, 19, 20, 21]. It is an ideal test for a relativistic simulation model since the linear growth rates in both the non-relativistic and the relativistic regimes may be compared to those obtained by numerically solving the dispersion relation. In our simulations we look at both cold and warm beams that have drift velocities ranging from 0.04c (non-relativistic), to 0.5c (very relativistic). 5.2 T H E O R Y First we will review the theory for non-relativistic cold beams. In chapter 3 we showed that the dispersion relation for cold beams is given by (rotate in phase space), conservation of energy dictates that the wave give up energy and 3 (5 -1 ) When we have two species present, this becomes (in the non-relativistic limit), Chapter 5 TWO STREAM INSTABILITIES We will look at two equal density beams travelling with equal and opposite velocities (wp l = w p 2 — u;p and vx — —V2 — VQ). Equation (5-2) becomes 1 = + (w - kv0) (w 4- kv0)' (5-3) Now we assume that we have complex u> and real fc (i.e. there is growth in time but not in space). The dispersion relation, equation (5-3), may be solved for UJ to yield u = ± fcV + u;? ± u ^ f c V + u , 2 ) 1 / 2 1 / 2 (5 -4) This equation is quartic in u> with four independent solutions. For 0 < kv/u>p < yjl there are two real and two imaginary roots. For kvo/up > \/2 there are four real roots. Equation (5-4) was solved numerically and the results are plotted in Figure 5-1. Ap-pendix A displays a listing of the program used to solve this equation, along with a comp-ilation of the positive imaginary root for kv/ujp = 0 to kv/u)p = y/2. Assuming that the perturbation is in mode 1, we can see from this figure that growth will occur whenever <.j_T. f.ir (5 -5 ) v/2" The maximum growth rate is given by: Imax — ^ imaginary — ^p/^ (5 -6) When dealing with relativistic velocities the analysis is identical to that just done except that uip must be replaced by u>r, the longitudinal relativistic plasma frequency, Chapter 5 TWO STREAM INSTABILITIES TWO STREflM ]N5TRB]LITY DISPERSION RELRT10N • \ / \ / X \ / \ 2 " / / s N. N. / s s s 1 -\ \ \ / \ \ ^ ~~ ^ \ / ^ S . / ^ \ / \ / X . X \ ' \ / >v -2 A -I ./ \ > / 2 \ . y \ • -i -\ s S / -2" • W / imaginary / / W / -3- r e a l Figure 5-1 DISPERSION R E L A T I O N for the two-stream instability. where "h = wJ/TI,? , (5 -7) is the relativistic longitudinal plasma frequency, and ij is defined by : ^ ( l - v j / c 2 ) - ' / 2 . (5 -8) Chapter 5 TWO STREAM INSTABILITIES 58 5.3 T R I A L R U N S A N D R E S U L T S 5.3.1 Non-relativistic Two stream Instability (Cold Beams) Table V - l displays the input parameters for run no. 121112 (restart no. 181010). This run used two cold electron beams that were travelling at velocities of ±0 .04c . Both beams were given an initial density perturbation in mode 1 (i.e. the perturbation wavelength equalled the system length). Input Parameters for run 121112 Parameter Value Description L 47T System length N G 32 Number of grid points DX .3927 L / N G D T 0.10 Timestep size NT 2500 Number of timesteps K0 0.5 27r/fundamental wavelength N l = N2 512 Number of particles for each species X l l = X21 0.02 Position perturbation V10 = -V20 0.04 Drift velocity WP1 = WP2 0.10 Plasma frequencies WC1 = WC2 0.0 Cyclotron frequencies T E M P I = TEMP2 0.0 Species temperatures T A B L E V - l INPUT P A R A M E T E R S . Run no. 121112. Using these values we may calculate some important system constants as follows: D X 0.3927 liqht velocity, c — — — 3.927 system units D T 0.1 v0 = 0.04c = 0.04 (3.927) = 0.1571 system units Chapter 5 TWO STREAM INSTABILITIES We may now use equation 5-5 to check that the system is unstable. We have (0.10) (4TT) 0.1571 = 1.273 (2TT) , which is greater than 2n/y/l and so we expect growth. To calculate the theoretical growth rate we first determine kv0 p (0.5)(0.1571) oTTo = 0.786 . We now use figure 5-1, (or Appendix A), to determine 0.49 from which the theoretical growth rate, 7^, is: l t h = W i - 0.10(0.49) = 0.049 . Figures 5-2 and 5-3 display the electrostatic energies for modes 1,2, and 3. From Figure 5-2 the measured growth rate is 7 m e a s = 0.049 ± 0.003, which is in excellent agreement with the theoretical result. Using a value for the electric field energy where the linear growth just starts to be modified, we may calculate the bounce frequency, wD, to be: (q/m = —1.0), which is comparable to the linear growth rate. After the electrostatic field energy saturates (at 36.9% of the total energy) it oscillates with u>i, w 0.09, (as measured Chapter 5 TWO STREAM INSTABILITIES on figure 5-2). Using an approximate value for the electric field energy at saturation we calculate W 6 = i / l i l ^ = t / 0 .5 ( 2 x 10~ 4 ) 1 / 2 « 0.08 V m which is in reasonable agreement with the measured value of 0.09. Another point of interest may be observed from figures 5-3. Initially modes two and three are outside the region of growth. However, as the mode 1 energy increases, harmonics are produced via non-linear coupling[4] which causes modes 2 and 3 to grow at twice and three times the growth rate of mode 1. The measured growth rates were 0.0984 and 0.143 for modes two and three respectively (2.01 and 2.92 times the mode one rate). The maximum variation in the total energy was less than 3% from the initial value. This is much less than the field energy variation which went from almost zero to 37% of the total energy. The evolution of the run in phase space is depicted in Figure 5-4. The formation of the vortex, which is indicative of trapping, is clearly evident. Figure 5-5 shows the distribution function, f{vx), at t=0 and at t=250 (after saturation). The thermal spread acquired by the particles is clear even though the small number of particles used (512 per stream) does make the plot "spikey". The total electron kinetic energy and the x-momentum for one beam are displayed in Figure 5-6. The kinetic energy falls off at saturation and then oscillates as the energy of the trapped particles is exchanged with the field. The momentum of the first beam drops off sharply at saturation and then oscillates weakly. Chapter 5 TWO STREAM INSTABILITIES 5.3.2 Non-relativistic Two Stream Instability (Warm Beams) In this section, we look at a run (#92919) which is identical to the previous one (#121112) except that two warm beams were used; T E M P I = TEMP2 =0.0001, where T E M P I and T E M P 2 are given in units of the rest mass energy of species 1 (i.e. in units of 0.511 MeV). Figure 5-7 displays the electrostatic energy for mode 1. The theoretical growth rate for this case is the same as for the previous case, i.e. 7 ^ = 0.049, and the measured growth rate from fig. 5-7 is 7 m e o s = 0.045 ± 0.001. Thus it appears that switching to warm beams has slightly reduced the growth rate. No further trials to quantify the effect of the beam thermal spread was done since these runs require the use of a great many particles and timesteps (i.e. CC$$). Stringer[24] shows that the threshold for growth for the electron-electron two stream instability is thrift > l - 3 v t h e r m a i - In our model system, the temperature of 0.0001 corresponds to a thermal velocity of 0.01c, (v T E M P I = vtfc/c), so that we have .04 > .01 and Stringer's condition for growth is met. However, even though we are above threshold, the ratio of the drift velocity to the thermal velocity is small enough that it causes the growth rate to be slightly decreased. Other differences between the cold and warm beam cases were also noticed. The maximum electrostatic field energy at saturation was ss 7 % of the total energy as compared to ss 37 % for the cold beam case. However, the maximum variation in the total energy from its initial value for the warm beam case also dropped, (to < 0.05 %), so the variation in the electrostatic energy was still very large in comparison. Another difference was in the oscillation amplitude of the mode 1 energy after saturation. It is much lower in warm Chapter 5 TWO STREAM INSTABILITIES beam case than with the cold beams. These results appear reasonable since with a larger spread in velocities the energy exchange between the particles and the wave would be less coherent. Figure 5-8 displays the electrostatic energies for modes 2 and 3. We see that the growth in these two modes is much less pronounced than in the cold beam case. However, the growth rates are still roughly 2 and 3 times the mode one rate for modes two and three respectively. As the two beams interact, large fields are generated (see figures 5-9 and 5-10) which scatter the particles in phase space—forming a vortex where the particles are trapped and increasing the temperature of the beams. In Figure 5-11, the evolution of the warm two stream instability in phase space is presented. These plots clearly show the vortex development. In Figure 5-12, the distribution function, f(vx), is displayed at t=0 and at t=275 (after saturation). The temperature increase in the beams is readily apparent. 5.3.3 Relativistic T w o Stream Instability (Cold Beams) A number of runs were made with different beam velocities and at various values of kv/ujT. The results of these runs, and also the non-relativistic runs from the previous sec-tion are summarized in Table V-2. Excellent agreement between theoretical and measured growth rates were observed in all cases. Without relativistic corrections, the theoretical growth rates differed by as much as 36% from the measured rates. With the relativistic corrections, the rates agree to within a few percent in all cases. Chapter 5 TWO STREAM INSTABILITIES The above runs verify that the simulation code is indeed working properly in both the non-relativistic and relativistic regimes. The measured growth rates and frequencies were both found to be in excellent agreement with the theoretical results. Also, the total energy variation was found to be small in comparison to the change in the electrostatic energy. We are now ready to move on to our final test on ESRl—Landau damping. Chapter 5 TWO STREAM INSTABILITIES <j o co LA a & _ to h 3 CM CM co CM INSTABILITY RUNS Field Energy as % of T.E. at sat'n CO OO INSTABILITY RUNS <3 ^ V o STREAM «. O E r-o> © •V •"5P q V0N-RELATIV1STIC TWO q q V0N-RELATIV1STIC TWO a 3 © © QO © oo t-. V0N-RELATIV1STIC TWO & 3 O o p^  ESULTS — light speed,c 3.9270 3.9270 oi o . . q q Run No. 121112 92919 CM *—< © © © © at a K _ •is § 1 &• to H 3 CO CM LA CM LA ro CM © CM CO CO 00 CM TABILITY RUNS Field Enei as % of T. at sat'n QO CO o CO 00 CO co OO CM CM CO co CO LA CM TABILITY RUNS < E V CM V V V CO CM V LA V CM VI INS «. a oo q I80-© q <s> 00 LA p^  CO CO OO LA CO < w 65 E-CO O E 00 q o QO q CM © © Hr r~ o> —H © LA p^  CM p^  co LA © CO H VISTIC 3 © -V o> oo o> L A o> 1.29 1.03 LA LA 1.22 1.22 O) O © E-- RELA - RELA & 3 o o CM © CM LA CM © LA © LA q © RESULTS RESULTS light speed, c 1.9635 1.9635 tA CO © p-< 1.9635 1.9635 1.9635 3.9270 1.9635 o , . > ^ o «—< o « lA CM LA CM LA CM © LA © LA © lA Run No. 234123 110331 135323 131827 143653 123455 142644 100448 Table V - 2 T W O S T R E A M INSTABILITY RESULTS. Unless otherwise specified, all quantities are in system units. Chapter 5 TWO STREAM INSTABILITIES MODE ENERGY VS TIME MODE ENERGY VS TIME 10 10 10 10 io 1 10"'' 1 0"l io-'j io-4 io-'{ 2*10 MODE NO. RUN TIME DRTC RUN NO. 1 500.00 B60806 181010 260.000 276.316 3SS.263 361.576 TIME 186.611 Figure 5-2 E L E C T R O S T A T I C E N E R G Y - M O D E 1. Run #121112. Non electron-electron two stream instability with cold beams. -relativistic Chapter 5 TWO STREAM INSTABILITIES MODE ENERGY VS TIME MODE ENERGY VS TIME Figure 5-3 E L E C T R O S T A T I C E N E R G Y - MODES 1 and 2. Run #121112. Non-relativistic electron-electron two stream instability with cold beams. Chapter 5 TWO STREAM INSTABILITIES 0.15-, • • *** BOTH SPECIES RUN TIME DATE RUN NO. 500.05 860806 181010 6.0 7.0 X POSITION 10.0 n.o Figure 5-4 E V O L U T I O N in P H A S E SPACE. Run #121112. Non-relativistic electron-electron two stream instability with cold beams. In the upper figure, the dashed lines are at t=0 and the thick lines are at t=200, just before saturation. The lower plot is at t=500, well after saturation. Chapter 5 TWO STREAM INSTABILITIES 2 300.0 I 250.0 F(VX) - RLL PARTICLES -TEMPI : 0.00 TEMP2 : 0.00 RUN TIME s - 0.00 DATE : 860806 - V " '• T 1 " " RUN NO. : 121112 -0.10 -0.08 -0.06 -0.02 0.00 VELOCITY n v x RLL PRRTICLES -0.10 -0.08 -0.06 -0.02 0.00 VELOCITY Figure 5-5 DISTRIBUTION FUNCTION. Run #121112. Non-relativistic electron-electron two stream instability with cold beams. The thermal spread aquired by the particles is clearly evident. Note the change of scale between the two plots. Chapter 5 TWO STREAM INSTABILITIES ELECTRON KINETIC ENERGY 'o - es.oi TIME ELECTRONS: RVG. X-MOMENTUM VS TIME 0.0<5-i TIME Figure 5-6 Electron KINETIC E N E R G Y and M O M E N T U M . Run #121112. Non-relativistic electron-electron two stream instability with cold beams. Note the cutout in the time scale. Chapter 5 TWO STREAM INSTABILITIES • MODE ENERGY VS TIME 0 T 1 1 1 1 1 I 1 1 1 0.000 26.316 52.612 76.947 105.263 131.579 157.695 164.210 210.526 236.642 TIME MODE ENERGY VS TIME 10'• 10 B 10"' 10' 6«10^ MODE NO. RUN TIME DATE 400.00 860801 250.000 265.789 281.579 297.368 313.157 328.947 344.736 360.525 376.314 392.104 TIME Figure 5-7 E L E C T R O S T A T I C E N E R G Y - M O D E 1. Run #92919. Non-relativistic electron-electron two stream instability with warm beams. Chapter 5 TWO STREAM INSTABILITIES 7 1 MODE ENERGY VS TIME MODE ENERGY VS TIME 1 1 1 i 1 1 1 1 1 1.000 26.316 52.632 76.917 IBS.263 131.579 157.695 184.210 210.526 236.642 TIME Figure 5-8 E L E C T R O S T A T I C E N E R G Y - MODES 1 and 2. Run #92919. Non-relativistic electron-electron two stream instability with warm beams. Chapter 5 TWO STREAM INSTABILITIES CHARGE DENSITY X POSITION CHARGE DENSITY i 1 1 1 1 1 i 1 1 1 1 1 1 — — i 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 6.0 9.0 10.0 11.0 12.0 13.0 X POSITION Figure 5-9 C H A R G E DENSITY. Run #92919. Non-relativistic electron-electron two stream instability with warm beams. Note the change in scale between the two plots. Chapter 5 TWO STREAM INSTABILITIES ELECTROSTATIC POTENTIAL 0.0 1.0 2.0 4.0 5.0 6.0 7.0 8.0 X POSITION .0 10.0 11.0 12.0 13.0 ELECTROSTATIC POTENTIAL -0.020' 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 X POSITION 9.0 10.0 11.0 12.0 13.0 Figure 5-10 E L E C T R O S T A T I C P O T E N T I A L . Run #92919. Non-relativistic electron-electron two stream instability with warm beams. Note the change in scale between the two plots. Chapter 5 TWO STREAM INSTABILITIES to X LJ O <r Q_ ID LJ LO • .J'."-;' '5 . . •'•Jij. "•"V ."••-> \vW-"':'.VvVy. , »..V'-*/.. i . ,—-,- •;• v---n , k § s e s e s i E s ° 5 Figure 5-11 E V O L U T I O N in P H A S E SPACE. Run #92919. Non-relativistic electron-electron two stream instability with warm beams. Clockwise from top left the plots are at t=0, t=200 (just before saturation), t=275 (after saturation), and t=300. Chapter 5 TWO STREAM INSTABILITIES n v x ) - FILL PARTICLES . 550.0-SOO.O-<S0.0- / \ 400.0- / \ > z 1 350.0- / \ 2 300.0- / \ Z — 250.0- / \ D r 200.0- / \ r> / \ 5 150.0- / TEMPI \ : 0.00 100.0-/ TEMP2 \ : 0.00 / . RUN TIMEU 0.00 50.0- / DATE \ 86080! - D.OB-0.07 — \ i i i • \ -0.06 -0.05 -0.04 -0.03 -0.02 -0.0! 0.00 0.01 0.02 0.03 O.CH 0.05 0.06 0.07 0.08 VELOCITY FIVX) - ALL PARTICLES 350.0-, VELOCITY Figure 5-12 DISTRIBUTION F U N C T I O N . Run #92919. Non-relativistic electron-electron two stream instability with warm beams. The increase in the temperature of the particles is clearly evident. Note the change of scale between the two plots. Chapter 6 LANDAU DAMPING Chapter 6 L A N D A U DAMPING 6.1 I N T R O D U C T I O N In this chapter we do a final test on ESRl—Landau damping. Landau damping is the collisionless damping of electrostatic plasma waves. It has its origin in the strong interaction between a plasma wave and those particles that have velocities very close to the phase velocity of the wave. Particles moving slower than the wave phase velocity, v^, take energy from the wave while particles moving faster than tend to give energy to it. In a plasma with a Maxwellian distribution of velocities, there are more particles moving slower than the wave phase velocity than there are moving faster. Thus, there will be a net absorption of energy and the wave will be damped. In this chapter we will look at Landau damping of both a non-relativistic plasma and a hot, relativistic plasma. These runs provide another check on the relativistic modifications to the program as well as offering an opportunity to test the quiet start loading technique that was employed. Chapter 6 LANDA U DAMPING The solution of the dispersion relation for non-relativistic and relativistic Maxwellian distributions was presented previously (cf. chapter 3, Tables III—1 and III— 2, respectively), and so will not be repeated here. 6.2 T R I A L R U N S and R E S U L T S 6.2.1 N O N - R E L A T I V I S T I C L A N D A U D A M P I N G The input parameters for run number 101708 are shown in Table VI-1. A quiet start was used. The initial position perturbation was XI1 — 164 which corresponds to approximately a one percent perturbation in the density. Input Parameters Landau Damping run 101708 Parameter Value Description L 47T System length NG 16 Number of grid points D X .7854 L / N G D T 0.025 Timestep size N T 500 Number of timesteps K0 0.5 27r/fundamental wavelength N l 16384 Number of electrons X l l 164 Position perturbation VIO 0.0 Drift velocity WP1 1.0 Plasma frequency WC1 0.0 Cyclotron frequency T E M P I 0.002 Species 1 temperature T A B L E V I - 1 INPUT P A R A M E T E R S . Run no. 101708. Chapter 6 LAND A U DAMPING The initial distribution function and the electrostatic energy for mode 1 are displayed in Figures 6-l(a,b). The initial distribution was a non-relativistic Maxwellian with a temperature of 0.002 (measured in units of the electron rest mass energy, 0.511 Mev). The initial perturbation damps out after only a couple plasma periods. The damping rate, as measured from fig. 6-l(b), is Wj = 0.365. From the same plot we also find the real part of the frequency to be OJT w 1.7. The theoretical values may be obtained from Table III—1 after we have determined k/kp. We first determine vth : v / T E M P l ) C = (0.0447) (31.416) = 1.4043 , where we have used c = D X / D T . We now calculate 1.0 1.4043 = 0.7121 , from which k/kD = (0.5) / (0.7121) = 0.7021 . Referring to Table III—1 we find wT = 1.68 and Ui = 0.395 . Upon comparison with the measured values of u>r — 1.7 and u/j — 0.365 , we find errors of 1.2% and —7.6% for the real and imaginary parts respectively. Chapter 6 LAND A U DAMPING Another run was made that was identical to the previous one except that a random start was used. In this case, (not shown), no damping was observed. A third non-relativistic Landau damping run was made. This case was very similar to the first except that the number of particles was increased to w 65K. The input parameters are shown in Table VI-2. Input Parameters Landau Damping run 124958 Parameter Value Description L 47T System length N G 16 Number of grid points D X .7854 L / N G D T 0.025 Timestep size N T 400 Number of timesteps KO 0.5 27r/fundamental wavelength N l 65536 Number of electrons X l l 655 Position perturbation VIO 0.0 Drift velocity WP1 1.0 Plasma frequency WC1 0.0 Cyclotron frequency T E M P I 0.002 Species 1 temperature T A B L E V I - 2 INPUT P A R A M E T E R S . Run no. 124958. The electrostatic energy for mode 1 is shown in figure 6-2. The measured values from this plot are wr = 1.66 and = 0.409 . Upon comparison with the calculated theoretical values of wr = 1.68 and = 0.395 , Chapter 6 LANDA U DAMPING we find errors of —1.2 % and 3.5 % for the real and imaginary parts respectively. Increasing the number of particles decreases the noise level so this improvement over the previous case is expected. The improvement is very noticeable on the mode 1 energy plot where we find that with 65K particles the damping rate was measureable for almost twice as long as in the case with 16K particles. 6.2.2 R E L A T I V I S T I C L A N D A U D A M P I N G R U N S Table VI-3 displays the input parameters for run number 164028. Input Parameters Landau Damping run 164028 Parameter Value Description L 4w System length NG 32 Number of grid points D X .3927 L / N G D T 0.078 Timestep size N T 200 Number of timesteps K0 0.5 27r/fundamental wavelength N l 32768 Number of electrons X l l 328 Position perturbation VIO 0.0 Drift velocity WP1 1.0 Plasma frequency WC1 0.0 Cyclotron frequency T E M P I 0.04 Electron temperature T A B L E V I - 3 INPUT P A R A M E T E R S . Run no. 164028. The temperature in this run corresponds to u t^/c — 0.20. Figures 6-3(a,b) show the initial distribution function and density perturbation (approximately 1 % of the maximum). Chapter 6 LANDA U DAMPING The mode 1 electrostatic energy is displayed in figures 6-4(a,b). The real and imaginary parts of the frequency as measured from this plot are <jjr = 1.35 and LO{ = 0.0924 . Upon comparison with the calculated theoretical values of OJT - 1.369 and wt = 0.0893 , we find errors of -1.4% and 3.5% for the real and imaginary parts respectively. For all the Landau damping runs considered, the damping rates and frequencies were in very good agreement with theory. Additionally, it was observed that the quiet start technique employed works properly and could be very useful in some cases for reducing the number of simulation particles required. When using it, noise levels were low enough that Landau damping could be observed with as few as 16K particles. Chapter 6 LAND A U DAMPING ELECTRONS: F(VX) - VELOCITY DIST. 550.0-) H I " — i 1 1 1 1 1 1 1 1 1 ' — ' > _ -0.175-0.150 -0.12S -0.100 -0.075 -0.050 -0.025 0.000 0.025 0.050 0.075 0.100 0.125 0.1S0 0.175 VELOCITY MODE ENERGY VS TIME 1 D°i , 0 "i 0.0000 1.3158 2.6316 3.M74 S.2632 6.5789 7.6947 S.2I05 10.5263 11.8421 TIME Figure 6-1 (a,b) DISTRIBUTION F U N C T I O N and M O D E 1 E N E R G Y . Run #101708. Non-relativistic Landau Damping, 16384 particles. Chapter 6 LANDA U DAMPING 83 Figure 6-2 E L E C T R O S T A T I C E N E R G Y — M O D E 1. Run #124958. Non-relativistic Landau Damping, 65536 particles. Chapter 6 LANDA U DAMPING ELECTRONS: F(VX) - VELOCITY DIST Z 4X.0-- 300.0-\TEMPI t 0.04 RUN TIME : 0.00 DW : 860815 RUN NSL : 2028 1 1 — 0.4 0.5 = a — • T o.e -0.7 -0.6 -0.S -0.4 -0.3 -0.2 -0. vrxocm ELECTRON DISTRIBUTION IN SPACE 900.0-800.0-700.0-600.0-500.0-400.0-300.0-200.0- RUN TIME DATE RUN NO. 0.00 860615 2028 5.0 6.0 7.0 8.0 X - POSITION 9.0 10.0 11.0 12.0 13.0 Figure 6-3(a,b) DISTRIBUTION FUNCTION and DENSITY P E R T U R B A T I O N . Run #164028. Relativistic Landau Damping, 32768 particles. Chapter 6 LANDA U DAMPING 85 Figure 6-4(a,b) E L E C T R O S T A T I C E N E R G Y — M O D E 1. Run #164028. Relativistic Landau Damping, 32768 particles. Chapter 7 RESULTS and CONCLUSIONS Chapter 7 RESULTS and CONCLUSIONS The objective of this work was to construct and test a 1-1/2 dimensional electrostatic, relativistic, plasma simulation code. This objective has been met. The simulation model known as E S R l was constructed and implemented on the U B C FPS array processor. Fol-lowing implementation, the code was used to simulate three well-known plasma problems in order to throroughly evaluate it in preparation for use in simulating new phenomena. The first trial runs were on cold plasma oscillations. The variation of frequency with mode number was checked in order to determine if the grid was having the predicted effect on the dispersion relation. The simulation showed clearly the expected variation in frequency. Energy conservation was also checked in this run. Since the code is not energy conserving (it is momentum conserving) we did not expect the total energy to be constant. However, in order for the simulation results to be valid, the change in the total energy should be much less than the variation in the field energy. This is indeed what the simulation showed. Typically, the maximum variation in the total energy was less than 0.7 percent, while the electrostatic energy varied from 0 to 100 percent of the total energy. The cold plasma oscillation runs also provided a simple problem in which the electric field, electric potential and the charge density could be checked for the proper amplitudes and Chapter 7 RESULTS and CONCLUSIONS phases. One run was also made with a large initial perturbation in order to investigate wave breaking. As expected, the mode energies were no longer independent and wave breaking showed up on the phase space plots. The next test for the code was to make various electron-electron two stream instability runs. These runs were made with both cold and warm beams using drift velocities that varied from non-relativistic to highly relativistic. In all the cases studied, excellent agree-ment between the measured growth rates from the trial runs and theoretical growth rates were obtained. These runs provided a very good check on the relativistic modifications to the code since the expected growth rates using non-relativistic theory gave values that were up to 36 percent different from the relativistic theory. Energy variation was also checked in these runs and found to be very good. The third major test for the code was the Landau damping runs. Like the two stream instability runs these were done in both the relativistic and non-relativistic regimes. Damp-ing rates, oscillation frequencies and energy variation were again compared to theoretical results and found to be in very good agreement. The run with 16,384 particles also pro-vided a good check on the quiet start loading technique employed. In a random start using the same number of particles, no damping was observed. In summary, E S R l , a 1-1/2 dimensional electrostatic, relativistic, plasma simulation code has been constructed, implemented on the U B C FPS array processor, and thoroughly tested. It may now be used for research into various electrostatic problems. It could also be modified to make it fully electromagnetic, in which case it would be useful for simulating many additional processes including laser-plasma interactions. References References Boris, J.P., Relativistic plasma simulation-optimization of a hybrid code, Proc. Fourth Conf. Num. Sim. Plasmas, Naval Res. Lab., Wash., D.C. , 3-67, 2-3 November 1970. Buneman, O., Time reversible difference procedures, J. Comput. Phys. 1, 517-535, June 1967. Hockney, R.W., and J.W. Eastwood, Computer Simulation Using Particles, McGraw-Hill, New York, 1981. Birdsall, C .K. , and A . B . Langdon, Plasma Physics via Computer Simulation, McGraw-Hill, New York, 1985. Nicholson, D.R., Plasma Theory, Wiley, 1983. Dawson, J . M . , Particle Simulations of Plasmas, Rev. Mod. Phys. 55, 403-447, April 1983. Langdon, A . B . , Effects of the spatial grid in simulation plasmas, J. Comput. Phys. 6, 247-267, October 1970. Langdon, A .B . , and C K . Birdsall, Theory of plasma simulation using finite-size parti-cles, Phys. Fluids 13, 2115-2122, August 1970. Lindman, E . L . , Dispersion relation for computer-simulated plasmas, J. Comput. Phys. 5, 13-22, February 1970. 0] Boris, J.P., The acceleration calculation from a scalar potential, Plasma Physics Lab-oratory, Princton University MATT-152, March 1970. Dawson, J . M . , Plasma oscillations of a large number of electron beams, Phys. Rev. 118, 381-389, April 1960. References 89 [12] Denavit, J . , and J .M. Walsh, Non-random initializations of particle codes, Comments Plasma Phys. Control. Fusion 6, 209-223, Sept. 1981. [13] Denavit, J . , and W.L. Kruer, Comparison of numerical solutions of the Vlasov equation with particle simulation of collisionless plasmas, Phys. Fluids .14, 1782-1791, August 1971. [14] Jackson, J.D., Classical Electrodynamics, Wiley, New York, 2d. ed., 1975. [15] Buti, B. , Relativistic Effects on Plasma Oscillations and the Two-Stream Instability. I & II, Phys. Fluids 6, 89-107, January 1963. [16] Prentice, A.J.R. , Collective Energy Loss in Relativistic Plasmas, Plasma Physics 9, 433-455, 1967. [17] McKee, C.F . , One-Dimensional Simulation of Relativistic Streaming Instabilities, Phys. Fluids 14, 2164-2176, October 1971. [18] Jackson, J.D., Longitudinal plasma oscillations, J. Nucl. Energy, Part C (Plasma Physics) 1, 171-189, 1960. [19] Freidberg, J.P., Nonlinear Effects in the Two-Stream Instability, Phys. Fluids 8, 1031-1038, June 1965. [20] Thode, L . E . , and R.N. Sudan, Plasma heating by relativistic electron beams. I. Two-Stream Instability, Phys. Fluids 18, 1552-1563, November 1975. [21] Thode, L . E . , Energy lost by a relativistic electron beams due to two-stream instability, Phys. Fluids 19, 305-315, February 1976. [22] O'Neil, T . M . , J .H. Winfrey, and J.H. Malmberg, Nonlinear interaction of a small cold beam and a plasma, Phys. Fluids 11, 1204-1212, June 1971. [23] Chodorow, M . and C. Susskind, Fundamentals of Microwave Electronics, McGraw-Hill, New York, 1964. [24] Stringer, T . E . , Electrostatic instabilities in current-carrying and counterstreaming plas-mas, J. Nucl. Energy, Part C (Plasma Physics) 6, 267-279, 1964. [25] Brown, D.I., S.J. Gitomer, and H.R. Lewis, The two-stream instability studied with four one-dimensional plasma simulation models, J. Comput. Phys. 14, 193-199, Febru-ary 1974. References [26] Dawson, J . M . , One-dimensional plasma model, Phys. Fluids 5, 445-459, April 1962. [27] Denavit, J . , and W.L. Kruer, How to get started in particle simulation, Comments Plasma Phys. Control. Fusion 6, 35-44, April 1980. [28] Denavit, J . , Numerical simulation of plasmas with periodic smoothing in phase-space, J. Comput. Phys. 9, 75-98, February 1972. [29] Gentleman, W . M . , and G . Sande, Fast fourier transforms for fun and profit, Proc. AFIPS, Fall Joint Computer Conf. 29, 563-578, 1966. [30] Krall, N.A. , and A.W. Trivelpiece, Principles of Plasma Physics, McGraw-Hill, New York, 1973. [31] Morales, G.J . , Y . C . Lee, and R.B. White, Non-linear Schrodinger equation model of oscillating-two-stream instability, Phys. Rev. Lett. 32, 457-460, 4 March 1970. [32] Roberts, K . V . and H.L. Berk, Non-linear evolution of a two-stream instability, Phys. Rev. Letters 19, 297-300, August 1967. [33] Morse, R.L. and C.W. Neilson, One-,two-, and three-dimensional numerical simulation of two-beam plasmas, Phys. Rev. Letters 23, 1087-1090, November 1969. Appendix A: TWO-STREAM INSTABILITY+DISPERSION RELATION Appendix A T W O - S T R E A M INSTABILITY DISPERSION RELATION A . l I N T R O D U C T I O N In chapter 5, the dispersion relation for the two-stream instability was presented. It is given by: a; = ± : V + u/J ± u/ p(4fcV + u/J) 1 / 2 1/2 ( A - l ) This equation is quartic in u with four independent solutions. For 0 < kv/u)p < \Jl there are two real and two imaginary roots. For \pl < kv0/u>p there are four real roots. Equation (A-l) was solved numerically and the results are plotted in Figure A - l . From this figure it is clear that growth will occur whenever ^ > ^ - (A-2) The maximum growth rate is Imax — ^ imaginary ~ u>p/2 . (A — 3) Appendix A: TWO-STREAM INSTABILITY DISPERSION RELATION » 2 Q_ 2 0.45 0.25 0.0 / \ / / \ / / / i 0.0 0.5 l.D 1.5 Kv / Wp Figure A - l DISPERSION RELATION for the two-stream instability. Only the positive imaginary root is shown. Figures A-2(a,b) display a listing of the positive imaginary root for b / w p = 0 to kv/u)v = y/2. Figures A-3(a,b) are a listing of the program R O O T E R that was used to solve equation A - l . Appendix A: TWO-STREAM INSTABILITY+ DISPERSION RELATION k»v / Wp Hi / «P k * v / Wp W1 / Wp 0 . ooooooooo 0 . ooooooooo 0 . 7 5 0 0 0 0 0 0 0 0 . 4 9 0 1 7 9 1 8 1 0 . 0 1 2 4 9 9 9 9 9 0 . 0 0 0 0 0 0 0 0 2 0 . 7 6 2 4 9 9 9 8 B 0 . 4 9 2 1 6 1 9 3 0 0 . 0 2 4 9 9 9 9 9 9 0 . 0 2 4 9 8 4 3 9 0 0 . 7 7 4 9 9 9 9 7 6 0 . 4 9 3 9 2 4 7 3 7 0 . 0 3 7 4 9 9 9 9 8 0 . 0 3 7 4 4 7 3 7 4 0 . 7 8 7 4 9 9 9 6 4 0 . 4 9 5 4 6 6 4 7 1 0 . 0 4 S 9 9 9 S 9 7 0 . 0 4 9 8 7 5 4 6 4 0 . 7 9 9 9 9 9 9 5 2 0 . 4 9 6 7 8 5 8 7 9 0 . 0 6 2 5 0 0 0 0 0 0 . 0 6 2 2 5 7 2 7 5 0 . 8 1 2 5 0 0 0 0 0 0 . 4 9 7 8 8 1 4 1 3 0 . 0 7 4 9 9 9 9 8 8 0 . 0 7 4 5 8 1 6 2 3 0 . 8 2 4 9 9 9 9 8 8 0 . 4 9 8 7 5 1 5 2 1 0 . 0 8 7 4 9 9 9 7 6 0 . 0 8 6 8 3 7 5 9 0 0 . 8 3 7 4 9 9 9 7 6 0 . 4 9 9 3 9 4 4 7 6 0 . 0 9 9 9 9 9 9 6 4 0 . 0 9 9 0 1 4 6 4 0 0 . 6 4 9 9 9 9 9 6 4 0 . 4 9 9 8 0 8 2 5 2 0 . . 1 1 2 4 9 9 9 5 2 0 . 1 1 1 1 0 2 4 0 2 0 . 8 6 2 4 9 9 9 5 2 0 . 4 9 9 9 9 0 6 4 2 0 . 1 2 5 0 O 0 O O 0 0 . 1 2 3 0 9 1 0 4 2 0 . 8 7 5 0 0 0 0 0 0 0 . 4 9 9 9 3 9 3 8 2 0 . . 1 3 7 4 9 9 9 8 8 0 . 1 3 4 9 7 0 9 6 3 0 . 8 8 7 4 9 9 9 8 8 0 . 4 9 9 6 5 1 8 4 9 0 . 1 4 9 9 9 9 9 7 6 0 . 1 4 6 7 3 3 2 2 4 0 . 8 9 9 9 9 9 9 7 6 0 . 4 9 9 1 2 5 2 4 2 0 . 1 6 2 4 9 9 9 6 4 0 . 1 5 8 3 6 9 1 2 4 0 . 9 1 2 4 9 9 9 6 4 0 . 4 9 8 3 5 6 4 0 2 0 . 1 7 4 9 9 9 9 5 2 0 . 1 6 9 B 7 0 4 9 6 0 . 9 2 4 9 9 9 9 5 2 0 . 4 9 7 3 4 1 9 9 0 0 . 1 8 7 5 0 O 0 0 0 0 . 1 8 1 2 2 9 7 1 1 0 . 9 3 7 5 0 0 0 0 0 0 . 4 9 6 0 7 8 3 1 2 0 . 1 9 9 9 9 9 9 8 8 0 . 1 9 2 4 3 9 4 9 7 0 . 9 4 9 9 9 9 9 8 8 0 . 4 9 4 5 6 1 4 3 4 0 . 2 1 2 4 9 9 9 7 6 0 . 2 0 3 4 9 3 0 5 9 0 . 9 6 2 4 9 9 9 7 6 0 . 4 9 2 7 8 6 9 4 4 0 . 2 2 4 9 9 9 9 6 4 0 . 2 1 4 3 8 4 1 9 8 0 . 9 7 4 9 9 9 9 6 4 0 . 4 9 0 7 5 0 1 3 4 0 . 2 3 7 4 9 9 9 5 2 0 . 2 2 5 1 0 7 1 3 3 0 . 9 8 7 4 9 9 9 5 2 0 . 4 8 8 4 4 5 7 5 9 0 . 2 5 0 0 O 0 0 0 0 0 . 2 3 5 6 5 6 5 0 0 1.OOOOOOOOO 0 . 4 8 5 8 6 8 2 1 6 0 . 2 6 2 4 9 9 9 8 8 0 . 2 4 6 0 2 7 2 9 1 1 . 0 1 2 4 9 9 8 0 9 0 . 4 8 3 0 1 1 4 2 5 0 . 2 7 4 9 9 9 9 7 6 0 . 2 5 6 2 1 5 1 5 5 1 . 0 2 4 9 9 9 6 1 9 0 . 4 7 9 8 6 8 6 5 0 0 . 2 8 7 4 9 9 9 6 4 0 . 2 6 6 2 1 5 9 8 0 1 . 0 3 7 4 9 9 4 2 8 0 . 4 7 6 4 3 2 5 0 2 0 . 2 9 9 9 9 9 9 S 2 0 . 2 7 6 0 2 6 0 1 1 1 . 0 4 9 9 9 9 2 3 7 0 . 4 7 2 6 9 5 1 1 2 0 . 3 1 2 5 0 0 0 0 0 0 . 2 8 5 6 4 2 0 2 8 1 . 0 6 2 5 0 0 0 0 0 0 . . 4 6 8 6 4 7 5 4 0 0 . 3 2 4 9 9 9 9 8 8 o. 2 9 5 0 6 1 0 5 2 1 . 0 7 4 9 9 9 8 0 9 0 . . 4 6 4 2 8 0 1 8 8 o . 3 3 7 4 9 9 9 7 6 0 . 3 0 4 2 8 0 4 6 0 1 . 0 8 7 4 9 9 6 1 9 0 . . 4 5 9 5 8 2 5 0 8 0 . 3 4 9 9 9 9 9 6 4 0 . 3 1 3 2 9 7 8 6 8 1 . 0 9 9 9 9 9 4 2 8 o. . 4 5 4 5 4 2 8 ) 6 0 . 3 6 2 4 9 9 9 5 2 0 . 3 2 2 1 1 1 2 4 9 1 . 1 1 2 4 9 9 2 3 7 0 . 4 4 9 1 4 8 1 1 8 0 . 3 7 5 0 0 0 0 0 0 0 . 3 3 0 7 1 8 8 7 5 1 . 1 2 5 0 0 O 0 O 0 0 . 4 4 3 3 8 4 0 5 1 0 . 3 8 7 4 9 9 9 8 8 o. 3 3 9 1 1 9 1 9 6 1 . 1 3 7 4 9 9 8 0 9 0 . 4 3 7 2 3 4 7 0 0 0 . 3 9 9 9 9 9 9 7 6 0 . 3 4 7 3 1 0 8 4 1 1 . 1 4 9 9 9 9 6 1 9 0 . 4 3 0 6 8 2 2 4 2 0 . 4 1 2 4 9 9 9 6 4 0 . 3 5 5 2 9 2 7 3 7 1 . 1 6 2 4 9 9 4 2 8 0 . 4 2 3 7 0 6 6 5 1 0 . 4 2 4 9 9 9 9 5 2 0 . 3 6 3 0 6 3 9 9 1 1 . 1 7 4 9 9 9 2 3 7 0 . 4 1 6 2 8 5 3 9 6 0 . 4 3 7 5 0 0 0 0 0 0 . 3 7 0 6 2 3 7 0 8 1 . 1 8 7 5 0 0 0 0 0 0 . 4 0 8 3 9 2 9 0 6 0 . 4 4 9 9 9 9 9 8 8 0 . 3 7 7 9 7 1 4 1 1 1 . 1 9 9 9 9 9 8 0 9 0 . 3 9 9 9 9 9 9 7 6 o . 4 6 2 4 9 9 9 7 6 0 . 3 8 5 1 0 6 5 0 4 1 . 2 1 2 4 9 9 6 1 9 0 . 3 9 1 0 7 3 2 2 7 0 . 4 7 4 9 9 9 9 6 4 0 . 3 9 2 0 2 8 5 7 0 1 . 2 2 4 9 9 9 4 2 8 0 . 3 8 1 5 7 3 9 7 5 0 . 4 8 7 4 9 9 9 5 2 0 . 3 9 8 7 3 7 3 7 1 1 . 2 3 7 4 9 9 2 3 7 0 . 3 7 1 4 5 7 1 0 0 0 . 5 0 0 O O 0 0 O 0 0 . 4 0 5 2 3 2 6 6 8 1 . 2 5 0 0 0 0 0 0 0 0 . 3 6 0 6 6 9 3 7 4 0 . 5 1 2 4 9 9 9 8 8 0 . 4 1 1 5 1 4 3 4 2 1 . 2 6 2 4 9 9 8 0 9 0 . 3 4 9 1 4 7 4 3 9 0 . 5 2 4 9 9 9 9 7 6 0 . 4 1 7 5 8 2 2 7 3 1 . 2 7 4 9 9 9 6 1 9 0 . 3 3 6 8 1 4 7 6 1 0 . 5 3 7 4 9 9 9 6 4 0 . 4 2 3 4 3 6 4 0 3 1 . 2 8 7 4 9 9 4 2 8 0 . 3 2 3 5 7 7 4 0 4 0 . 5 4 9 9 9 9 9 5 2 0 . 4 2 9 0 7 6 7 3 1 1 . 2 9 9 9 9 9 2 3 7 0 . 3 0 9 3 1 8 0 0 6 0 . 5 6 2 5 0 0 0 0 0 0 . 4 3 4 5 0 3 1 9 8 1 . 3 1 2 5 0 0 0 0 0 0 . 2 9 3 8 8 6 6 6 2 0 . 5 7 4 9 9 9 9 8 8 0 . 4 3 9 7 1 5 8 6 2 1 . 3 2 4 9 9 9 8 0 9 0 . 2 7 7 0 8 6 2 5 8 0 . 5 8 7 4 9 9 9 7 6 0 . 4 4 4 7 1 4 6 6 5 1 . 3 3 7 4 9 9 6 1 9 0 . 2 5 8 6 4 8 8 7 2 0 . 5 9 9 9 9 9 9 6 4 0 . 4 4 9 4 9 9 6 0 7 1 . 3 4 9 9 9 9 4 2 8 0 . 2 3 8 1 9 3 2 1 4 0 . 6 1 2 4 9 9 9 5 2 0 . 4 5 4 0 7 0 6 8 7 1 . 3 6 2 4 9 9 2 3 7 0 . 2 1 5 1 4 2 8 4 6 0 . 6 2 5 0 0 0 0 0 0 o. 4 5 8 4 2 7 7 8 7 1 . 3 7 5 0 0 0 0 0 0 0 . 1 8 8 5 4 7 0 1 5 0 . 6 3 7 4 9 9 9 8 8 0 . 4 6 2 5 7 0 8 4 6 1 . 3 8 7 4 9 9 8 0 9 0 . 1 5 6 6 0 7 5 6 8 0 . 6 4 9 9 9 9 9 7 6 0 . 4 6 6 4 9 9 6 2 7 1 . 3 9 9 9 9 9 6 1 9 0 . 1 1 4 9 5 1 0 7 4 0 . 6 6 2 4 9 9 9 6 4 0 . 4 7 0 2 1 4 0 6 9 1 . 4 1 2 4 9 9 4 2 8 0 . 0 4 0 1 6 0 2 2 0 0 . 6 7 4 9 9 9 9 5 2 0 . 4 7 3 7 1 3 7 5 6 1 . 4 2 4 9 9 9 2 3 7 0 . 1 0 1 3 7 7 1 8 9 0 . 6 8 7 5 0 0 0 0 0 0 . 4 7 6 9 9 8 4 4 8 1 . 4 3 7 5 0 0 0 0 0 0 . 1 4 9 8 5 7 7 0 0 0 . 6 9 9 9 9 9 9 8 8 0 . 4 8 0 0 6 7 7 3 0 1 . 4 4 9 9 9 9 8 0 9 0 . 1 8 6 8 8 9 4 1 0 0 . 7 1 2 4 9 9 9 7 6 0 . 4 8 2 9 2 1 0 6 4 1 . 4 6 2 4 9 9 6 1 9 0 . 2 1 8 3 7 7 7 6 9 0 . 7 2 4 9 9 9 9 6 4 0 . 4 8 5 5 5 7 9 1 4 1 . 4 7 4 9 9 9 4 2 8 0 . 2 4 6 4 5 7 6 3 6 0 . 7 3 7 4 9 9 9 5 2 o. 4 8 7 9 7 7 5 0 5 1 . 4 8 7 4 9 9 2 3 7 0 . 2 7 2 1 8 6 8 7 5 Figure A - 2 a DISPERSION R E L A T I O N . Solution of equation A - l for kv/u}p = 0 to kv/ujp — \/2. Only the positive imaginary root is shown. Appendix A: TWO-STREAM INSTABILITY* DISPERSION RELATION k«v / Wp 1 . 5 0 0 0 0 0 0 0 0 1 . 5 1 2 4 9 9 8 0 9 1 . 5 2 4 9 9 9 6 1 9 1 . 5 3 7 4 9 9 4 2 6 1 . 5 4 9 9 9 9 2 3 7 1 . 5 6 2 5 O O O O 0 1 . 5 7 4 9 9 9 8 0 9 1 . 5 8 7 4 9 9 6 1 9 1 . 5 9 9 9 9 9 4 2 8 1 . 6 1 2 4 9 9 2 3 7 1 . 6 2 5 0 0 0 O 0 0 1 . 6 3 7 4 9 9 8 0 9 1 . 6 4 9 9 9 9 6 1 9 1 . 6 6 2 4 9 9 4 2 8 1 . 6 7 4 9 9 9 2 3 7 1 . 6 8 7 5 0 0 0 0 0 1 . 6 9 9 9 9 9 8 0 9 1 . 7 1 2 4 9 9 6 1 9 1 . 7 2 4 9 9 9 4 2 8 1 . 7 3 7 4 9 9 2 3 7 1 . 7 5 0 0 0 0 0 0 0 1 . 7 6 2 4 9 9 8 0 9 1 . 7 7 4 9 9 9 6 1 9 1 . 7 8 7 4 9 9 4 2 8 1 . 7 9 9 9 9 9 2 3 7 1 . 8 1 2 5 0 0 0 0 0 1 . 8 2 4 9 9 9 8 0 9 1 . 8 3 7 4 9 9 6 1 9 1 . 8 4 9 9 9 9 4 2 8 1 . 8 6 2 4 9 9 2 3 7 1 . 8 7 5 0 0 0 0 0 0 1 . 8 8 7 4 9 9 8 0 9 1 . 8 9 9 9 9 9 6 1 9 1 . 9 1 2 4 9 9 4 2 8 1 . 9 2 4 9 9 9 2 3 7 1 . 9 3 7 5 0 0 0 0 0 1 . 9 4 9 9 9 9 8 0 9 1 . 9 6 2 4 9 9 6 1 9 1 . 9 7 4 9 9 9 4 2 8 1 . 9 8 7 4 9 9 2 3 7 0 . 2 9 6 1 7 9 5 3 3 0 . 3 1 B 8 2 8 5 B 3 0 . 3 4 0 4 0 3 0 2 0 0 . 3 6 1 0 9 6 0 2 5 0 . 3 8 1 0 5 1 8 3 8 0 . 4 0 0 3 6 1 0 8 8 0 . 4 1 9 1 7 1 0 9 5 0 . 4 3 7 4 9 1 6 5 5 0 . 4 5 5 3 9 9 8 7 1 0 . 4 7 2 9 4 3 0 0 B 0 . 4 9 0 1 6 0 5 2 5 O . 5 0 7 0 8 6 0 3 9 0 . 5 2 3 7 4 8 0 4 0 0 . 5 4 0 1 7 1 3 8 5 0 . 5 5 6 3 7 7 3 5 1 0 . 5 7 2 3 8 4 7 1 5 0 . 5 8 8 2 0 9 9 2 7 0 . 6 0 3 8 6 7 5 9 0 0 . 6 1 9 3 7 0 6 3 9 0 . 6 3 4 7 3 0 5 1 8 0 . 6 4 9 9 5 7 7 1 6 0 . 6 6 5 0 6 1 4 7 4 0 . 6 8 0 0 5 0 1 9 4 0 . 6 9 4 9 3 1 5 0 7 0 . 7 0 9 7 1 2 3 2 7 0 . 7 2 4 3 9 9 0 3 0 0 . 7 3 8 9 9 7 3 4 0 0 . 7 5 3 5 1 2 5 0 2 0 . 7 6 7 9 4 9 4 6 2 0 . 7 8 2 3 1 2 6 3 2 0 . 7 9 6 6 0 6 1 2 3 0 . 8 1 0 8 3 3 7 5 2 0 . 8 2 4 9 9 9 0 3 4 0 . 8 3 9 1 0 5 3 0 8 0 . 8 5 3 1 5 5 4 9 4 0 . 8 6 7 1 5 2 5 7 2 0 . 8 8 1 0 9 9 0 4 5 0 . 8 9 4 9 9 7 4 1 8 0 . 9 0 8 8 5 0 0 1 4 0 . 9 2 2 6 5 8 9 8 0 Figure A - 2 b Continuation of Fig. A-2a. Solution of the dispersion relation, equation A - l , for kvjwp = 0 to kv/u>p = Only the positive imaginary root is shown. Appendix A: TWO-STREAM INSTABILITY* DISPERSION RELATION 95 C« c c c-c S B B S S S C S I PROGRAM ROOTER C O M P L E X * 1 6 I N T E G E R R E A L ' S R E A L L O G I C A L E X T E R N A L COMMON / P A R A M / WP F N , E 4 . Z ( 1 ) . WP. K , V . VHOLD N R . M A X I T . I N O . I F L A G E l . E 2 . E 3 X ( 3 2 0 ) . Y 1 ( 3 2 0 ) . Y 2 ( 3 2 0 ) , Y 3 ( 3 2 0 ) . Y 4 ( 3 2 0 ) C O N J F N K . V . I F L A G 15 1 0 0 C 1 1 0 2CO / 1 . 0 / / 5 0 0 0 / / ( 3 . 0 D 0 . 0 . 0 D 0 ) / / ( 1 . 0 D - 6 . 1 . 0 D - 6 ) / / . F A L S E . / / 1 . O O O O D - 6 / / 1 . 0 0 0 0 0 - 6 / / 1 . 0 0 0 0 0 - 6 / / 3 2 0 / DATA M A X I T DATA Z DATA E 4 DATA C O N J DATA E1 DATA E 2 DATA E 3 DATA N P T S I F L A G - O C A L L D S P D E V ( ' P L O T ' ) W R I T E ( • , F M T " ' ( ' ' I N P U T WP. K , V R E A D ( * , * ) WP. K . V VHOLD - V W R I T E ( * . F M T " ' ( ' ' W P ( C O M P L E X ) " ) ' ) WRITE(».FMT»'( ' WRITE(».FMT«' ( ' W R I T E ( * . 1 5 ) F 0 R M A T ( / / , 3 X . ' 'K 1 P D 1 9 . 9 . 1 P D 1 7 . 9 ) ' ) WP 1 P D 1 9 . 9 , 1 P D 1 7 . 9 ) ' ) K 1 P D 1 9 . 9 . 1 P D 1 7 . 9 ) ' ) V k * v / W p ' . 3 X , W/Wp ' . / . 3 X , ' ' . 3 X . ' . / ) DO 10O J " 1 , N P T S C A L L D C Z F U N ( F N , N R , M A X I T , Z , I N D . E 1 . E 2 . E 3 , E 4 . C 0 N J ) X ( d ) - (K»V/WP) Y 1 ( 0 ) « A B S ( Z ( 1 ) ) / W P W R I T E ( * , F M T « ' ( 3 X . F 1 3 . 9 . 7 X . F 1 3 . 9 ) ' ) X ( J ) , Y 1 ( J ) V » V + ( 0 . 0 1 2 5 D O . O . O D O ) C O N T I N U E • V - VHOLD Z ( 1 ) • ( . 9 3 6 4 0 0 . 0 . 0 0 0 ) I F L A G - 1 DO 1 1 0 0 - 1 . N P T S C A L L D C Z F U N ( F N . N R . M A X I T , Z . I N D . E 1 . E 2 . E 3 . E 4 , C O N J ) X ( J ) • ( K * V / W P ) Y 2 ( J ) - A B S ( Z ( 1 ) ) / W P W R I T E ( » . F M T - ' ( 3 X . F 1 3 . 9 . 7 X . F 1 3 . 9 ) ' ) X ( J ) , Y 2 ( J ) V - V + ( 0 . 0 1 2 5 D 0 . 0 . 0 D 0 ) C O N T I N U E DO 2 0 0 J«1.NPTS Y 3 ( J ) • - Y 1 ( J ) Y 4 ( J ) • - Y 2 ( J ) C O N T I N U E C A L L P L O T ( X . Y 1 , STOP END Y 2 . Y 3 . Y 4 . N P T S ) Figure A - 3 a P R O G R A M R O O T E R . Appendix A: TWO-STREAM INSTABILITY* DISPERSION RELATION 96 F U N C T I O N F N ( Z ) COMMON / P A R A M / WP. K , V . I F L A G C 0 M P L E X * 1 6 F N . Z . WP. K , V I F ( I F L A G . E O . O ) T H E N FN«-Z«-SQRT( ( (K**2)* (V*»2)+ (WP»»2) ) • WP»SQRT( 4*(K»»2)*(V»»2)+(WP»»2) E L S E F N - - Z - S Q R T ( ( END I F R E T U R N END (K*»2)* (V»*2)+ (WP»*2) ) -WP»SQRT( 4* (K»*2)»(V**2)+(WP»»2) ) ) ) ) S U B R O U T I N E P L O T ( X . Y 1 . V 2 . Y 3 . V 4 . N P T S ) C C C C 5 5 C C C I N T E G E R T I T L E R E A L X ( N P T S ) . Y I ( N P T S ) , Y 2 ( N P T S ) . Y 3 ( N P T S ) . Y 4 ( N P T S ) R E A L X A X I S . Y A X I S . X O R I G , X M A X . Y O R I G . YMAX C A L L P A G E ( 1 1 . 0 . 8 . 5 0 0 ) X A X I S • 9 . 5 Y A X I S « 6 . 0 C A L L Y A X A N G ( O . ) C A L L C R O S S C A L L I N T A X S C A L L A R E A 2 D ( X A X I S . Y A X I S ) K V / W P $ ' . 1 0 0 ) W / W P $ ' . 1 0 0 ) 'TWO S T R E A M I N S T A B I L I T Y $ ' . 1 0 0 . - 1 . 5 , 2 ) ' D I S P E R S I O N R E L A T I O N S ' C A L L XNAME ( C A L L YNAME ( C A L L H E A D I N ( C A L L H E A D I N ( X O R I G - - 1 . 5 XMAX - 1 . 5 Y O R I G - - 0 . 7 5 YMAX « 0 . 7 5 IMARK » O C A L L GRAF ( X O R I G . 1 . 0 , DO 5 5 d»1.NPTS W R I T E ( * . • ) d . X ( d ) . Y 1 ( d ) . Y 2 ( J ) . Y 3 ( d ) , Y 4 ( d ) C A L L C U R V E ( X . Y 1 . N P T S . IMARK ) C A L L G R I D ( 1 0 . 1 0 ) C A L L C U R V E ( X . Y 2 . C A L L C U R V E ( X . Y 3 C A L L C U R V E ( X . Y4 C A L L E N D P L ( O ) 1 0 0 . - 1 . 5 . 2 ) X M A X . Y O R I G , 1 . 0 . YMAX ) N P T S . IMARK ) , N P T S , IMARK ) , N P T S , I M A R K ) R E T U R N END Figure A - 3 b Continuation of P R O G R A M R O O T E R . Appendix B: ESRl USERS GUIDE+and-h PROG RAM LISTING Appendix B E S R l USERS GUIDE and P R O G R A M LISTING B . l Introduction This appendix contains information on accessing and using the program E S R l . The source code for E S R l is in two main files. The first, ESR1.S contains the source code for the "number crunching" part of the program. The second, ESRl .PLT.S , contains the routines for taking the output from ESR1.S and producing plots. ESR1.S must be compiled using a special version of F O R T R A N that will enable it to run on the U B C Floating Point Systems FPS-164 Array Processor. E S R l . P L T . S should be compiled using the normal U B C Fortran VS compiler since it runs on the U B C Amdahl 5860. B.2 Setup Procedure The basic procedure for setting up program E S R l for use is as follows: (i) Create the following files—you may substitute your own file names for those filenames followed by an asterisk: Appendix B: ESRl USERS GUIDE+and+PROGRAM LISTING 98 ESR1.INPUT ESR1 .PRNT ESR1.1NSERT E S R 1 . C L I C H E E S R l . P L T . S * ESR1.S* ESR1.PLT.IN A P O U T * S A V E . A P * A P . B A T * P L T . B A T * E S R l . O L I B * ESR1.LD* E S R l . O L I B . A P * The other filenames may be changed too if you modify the source code, (ii) Copy the following files: RAPS:ESRl.S(1000,21999) to ESR1.S RAPS:ESR1.S(22000,22999) to ESR1.INPUT RAPS:ESR1.S(23000,23999) to E S R l . I N S E R T RAPS:ESR1.PLT.S(1000,8999) to E S R l . P L T . S RAPS:ESR1.PLT.S(23000,23999) to ESR1.PLT.IN RAPS:ESR1.PLT.S(24000,24999) to E S R l . C L I C H E (hi) Compile ESR1.S with the FPS-164 F O R T R A N compiler by using the following state-ment: R U N AP64:APFTN64 SCARDS=ESR1.S(1000,21999) S P U N C H = - A P O B J . . . . . . SPRINT=-SPR PAR=OPT(3) (iv) Put the object modules in an object library: R U N AP64:APLIBR64 P A R = I N P ( E S R l . O L I B . A P ) , I N S E R T ( - A P O B J ) (v) Link the program: R U N AP64:APLINK64 P A R = I N P U T ( E S R l . O L I B . A P ) , F O R C E ( E S R l , E S R l D ) , . . . . . . I M A G E ( E S R l . L D ) Details on the use of the FPS-164 and it's associated software may be found in the manuals located in the Physics department computer terminal room (Rm. 203). Appendix B: ESRl USERS GUIDE+and+PROGRAM LISTING The following run card should be used when replacing modules in the object library (ESRl .OLIB.AP): R U N AP64:APLIBR64 P A R = I N P ( E S R l . O L I B . A P ) , R E P L A C E ( - A P O B J ) After replacing modules in E S R l . O L I B . A P you must re-link the program using AP64:APLINK64 as above. (Be sure to empty ESR1.LD first!). B.3 R U N N I N G E S R l and E S 1 P L T A typical batch file for running E S R l is shown in figure B-l(a) and a typical input file is shown in figure B-l(b). The equivalent files for program E S l P L T are displayed in figures B-2(a,b). Figures B-3 and B-4 show the "insert" and "include" files for E S R l and E S l P L T respectively. Complete program listings for E S R l and E S l P L T are displayed in figures B-5 and B-6. Appendix B: ESRl USERS GUIDE+and+PROGRAM LISTING 100 $SIG RAPS TIME=6 PRIO=N APTIME=599 $$$$$$$ $L0G *MSINK* ON LOGFILE(*L+1) $EMPTY ESR1.PRNT OK $EMPTY APOUT OK $EMPTY HIST.AP OK $RUN AP64:SJE ATTACH/WAIT COPYIN/B 'ESR1.LD', ESR1 ESR1 SHOW/CPU COPYOUT/B HIST, 'HIST.AP' COPYOUT/B APO, 'APOUT' COPYOUT PRNT, 'ESR1.PRNT' SHOW/CPU DETACH QUIT $SIG (a) = RELATIVISTIC TWO STREAM INSTABILITY = &IN1 K0=0.5D0,NT=500,DT=O.10000D0, VLIGHT=1.0000000D0, NG=128, A1=0.00000D0, A2=00000.ODO, EO=O.ODO, WO=O.ODO, IRHO=0000, IRHOS=00, IPHI=000, IE=0000, ISPEC=0000, MPLOT=1,2,3, IXVX=0000,RSTART=.FALSE.,ISAVE=4 99, MODE=1, ITHERM=0000, QSTART=.FALSE., LSMEAR=.FALSE., &END &IN2 N1=2048, WP1 = 3.0000D00, QM1=-1.0000D0, TEMP1=0.00000000000D00, V1 0 = 0.500000D0, XI1= 000.0200000000D00, THETX1=O.00O000D00, WC1=0.000D0, S.END S.IN3 N2=2048, WP2=3.000000D0, QM2=-1.000D0, TEMP2=0.000000D0, V20=-0.500000D0, X21=000.0200D0, THETX2=0.000000000D0, &END (b) Figure B - l INPUT FILES. Program E S R l . (a) Typical batch file to run E S R l . (b) Typical input file (ESRl.INPUT) for E S R l . Appendix B: ESRl USERS GUWE+and+PROGRAM LISTING 101 $SIG RAPS T=20 PRIORITY=normal $$$$$$ $LOG *MSINK* ON LOGFILE(*L+1) $EMPTY ESR1.DISP OK $EMPTY ESR1.PLOT OK $COPY APOUT -APOTJT $RUN ESR1.PLT.OBJ+ESR1.OLIB+*DISSPLA9 2=ESR1.PLT.IN(200,218) 7=ESR1.MNMX 6=ESR1.DISP 9=-PLOTZ $CONTROL *QMS* DELIVERY=PHYS PACKAGE=LOOSE $RUN *QMSPLOT 0=-PLOTZ $REL *QMS* $CONTROL *PRINT* CANCEL $COPY -PLOTZ TO ESR1.PLOT $SIG (a) &IN1 NPTCL1=000, IFVX01=.FALSE IFVX02=.FALSE IFVX0T=.FALSE ITMP01=.FALSE ITMP02*.FALSE IXVX1=000\ IXVX2=0, IXVXT=0000, IRHO0=.FALSE. IRHO1=0000, ISPEC0=.FALSE ITE =.FALSE., IESE=.FALSE., IP1X=.FALSE., LHSTRY=.TRUE. JFLAG=1, XXORIG=0.00D0 YYORIG=-5.0D0 • t • i • i • i • r &END NPTCL2=0, IFVY01=.FALSE., IFVY02=.FALSE., IFVXT=0000f rTMP1=0000, ITMP2=00, IXVY1=000, IXVY2=0, IXVYT=0, IRHOS0=.FALSE., IRHOS1=00, ISPEC1=000, IKE1 = .FALSE. , IESEM=.TRUE., IP1Y=.FALSE. , LFIELD=.FALSE., NPTCLT=000, IFVX1=000, IFVY1=0, IFVX2=00, IFVY2=0, IVXVY1=000, IVXVY2=0, IVXVYT=0, I PHI0=.FALSE. IPHI1=0000, IKE2=.FALSE., IXT=.FALSE., IP2X=.FALSE., LSPACE=.FALSE., IE0=.FALSE., IE1=0000, IELKE=.FALSE. IVXT=.FALSE., IP2Y=.FALSE., XXMAX=6.2831850D0, YYMAX=5.000000D00, (b) Figure B - 2 INPUT FILES. Program E S l P L T . (a) Typical batch file to run E S l P L T . (b) Typical input file (ESR1.PLT.IN) for E S l P L T . Appendix B: ESRl USERS GUIDE+and-hPROGRAM LISTING 102 VARIABLE PLOT LHSTRT i f .TRUE. - make h i s t o r y p l o t s . LFIELD i f .TRUE. - make f i e l d p l o t s . LSPACE i f .TRUE. - make phase space p l o t s . NPTCL1 electrons - dist'bn in'space N P T C L 2 species 2 - dist ' b n i n space NPTCLT a l l species - dist ' b n i n space IFVXOl electrons - x-velc'y d i s t ' b n @ t « 0 . I F V T 0 1 electrons - y-velc'y d i s t ' b n @ t « 0 . I F V X 1 electrons - x-velc'y d i s t ' b n . IFVYl electrons - y-velc'y d i s t ' b n . I F V X 0 2 species 2 - x-velc'y d i s t ' b n § t « 0 . I F V T 0 2 species 2 - y-velc'y dist'bn @ t » 0 . I F V X 2 species 2 - x-velc'y d i s t ' b n . I F V Y 2 species 2 - y-velc'y d i s t ' b n . IFVXOT e l l species - x-velc'y d i s t ' b n § t " 0 . 1 F V X T ' a l l species - x-velc'y d i s t ' b n . ITMP01 electrons - temp p r o f i l e @ t » 0 . ITMP1 electrons - temp p r o f i l e . I T M P 0 2 species 2 - temp p r o f i l e @ t » 0 . I T M P 2 species 2 - temp p r o f i l e . IXVZl electrons - x-vx phase space. 1 X V Y ! electrons - x-vy phase space. IVXVYl - electrons - vx-vy space every. I X V X 2 species 2 - x-vx phase space. 1 X V Y 2 species 2 - x-vy phase space. I V X V T 2 species 2 - vx-vy space. 1 X V X T a l l species - x-vx phase space. IXVYT a l l species - x-vy phase space. IVXVYT a l l species - vx-vy space. IRHOO charge density. } IRHOSO smoothed charge density. } IPHIO e l e c t r i c p o t e n t i a l . } t « 0 . I E 0 e l e c t r i c f i e l d . } ISPECO energy spectrum. } IRH01 charge density. ) IRHOSl smoothed charge density. } I P H I 1 e l e c t r i c p o t e n t i a l . } t > 0 . I E 1 e l e c t r i c f i e l d . } I S P E C 1 energy spectrum. } ITE t o t a l energy. IKEl electrons - thermal energy. I K E 2 species 2 - thermal energy. IELKE electrons - k i n e t i c energy. IESE f i e l d energy. IESEM e l e c t r i c f i e l d mode energies. IXT p a r t i c l e 1 - X p o s i t i o n . IVXT p a r t i c l e 1 - X v e l o c i t y . I P 1 X electrons - avg. X momentum. IPlX electrons - avg. Y momentum. 1 P 1 X species 2 - avg. X momentum. I P 1 X species 2 - avg. T momentum. Scales c o n t r o l i n f i e l d p l o t t i n g routine (PLOTF) : JFLAG < 0 scales set v i a XXORIG, XXMAX, etc. * " 0 c a l c . max & min values for use in PLOTF. " > 0 scales f r e e . ( i e . c a l c ' d by program.) XXORIG X o r i g i n . XXMAX X maximum value. YYORIG Y o r i g i n . YYMAX Y maximum value. Figure B-2(cont.) V A R I A B L E NAMES. Used in ESRl .PLT.IN. Appendix B: ESRl USERS GUIDE+and+PROGRAM LISTING 103 1 0 0 I M P L I C I T D O U B L E P R E C I S I O N ( A - H , 0 - Z ) 1 0 1 I N T E G E R Z E R O . O N E 1 0 2 P A R A M E T E R ( Z E R O = 0 . O N E = 1 ) 1 0 3 P A R A M E T E R ( D Z E R O = O . O D O ) 1 0 4 P A R A M E T E R ( T W O P I = 6 . 2 8 3 1 8 5 3 0 7 1 7 9 5 8 D O ) 1 0 5 D O U B L E P R E C I S I O N L . M 1 . M 2 , K E 1 0 6 C O M M O N / P A R A M / L , D X , D T , I D A T E , I T I M E 2 0 0 P A R A M E T E R ( N G M A X = 2 5 6 ) 2 0 1 P A R A M E T E R ( N G 1 M = N G M A X + 1 ) 2 0 2 C O M M O N / C F I E L D / A E L . C G S H L , R H O O . A 1 , A 2 . 2 0 3 R H 0 ( N G 1 M ) , P H I ( N G 1 M ) . E ( N G 1 M ) , 2 0 4 E O , WO , N G 3 0 0 R E A L Z X . Z V 3 0 1 C O M M O N / P R T C L S / X ( 6 5 5 4 0 ) , V X ( 6 5 5 4 0 ) , V Y ( 6 5 5 4 0 ) , 3 0 2 Z X ( 1 7 6 6 0 ) , Z V ( 1 7 6 6 0 ) 4 0 0 C O M M O N / C N T R L / T I M E , I T , I T H L . I R H O . I R H O S . I P H I , 4 0 1 I E , I X V X , I S P E C 5 0 0 D O U B L E P R E C I S I O N K E 1 , K E 2 , N M 1 , N M 2 5 0 1 P A R A M E T E R ( N T H = 2 5 0 0 . M M A X = 2 0 ) 5 0 2 P A R A M E T E R ( N T H 1 = N T H + 1 . N T H 2 = N T H + 2 ) 5 0 3 C O M M O N / C T I M E / E S E ( N T H 1 ) , K E K N T H 1 ) , K E 2 ( N T H 1 ) , 5 0 4 P 1 X ( N T H 2 ) , P 1 Y ( N T H 2 ) . N M 1 , N M 2 . 5 0 5 P 2 X ( N T H 2 ) , P 2 Y ( N T H 2 ) , T E ( N T H 1 ) . 5 0 6 X T ( N T H 1 ) , V X T ( N T H 1 ) , E L K E ( N T H I ) , 5 0 7 E S E M ( N T H 1 , M M A X ) , M P L O T ( M M A X ) 6 0 0 C O M M O N / T H E R M L / I T H E R M 7 0 0 D O U B L E P R E C I S I O N M 2 C 2 E V 7 0 1 C O M M O N / U N I T S / R N M 1 C 2 , R N M 2 C 2 , R M 1 C 2 I , R M 2 C 2 I , M 2 C 2 E V 8 0 0 P A R A M E T E R ( I M X = 6 5 5 4 0 ) 8 0 1 C O M M O N / R E L / G A M M A ( I M X ) 9 0 0 D O U B L E P R E C I S I O N T H R M X 1 ( N G 1 M ) , T H R M X 2 ( N G 1 M ) , 9 0 1 V X O S C ( N G 1 M ) , V 2 S X ( N G 1 M ) , 9 0 2 V Y O S C ( N G 1 M ) 9 0 3 E Q U I V A L E N C E ( T H R M X 1 . T H R M X 2 , V 2 S X . P H I ) 9 0 4 D I M E N S I O N N ( N G 1 M ) Figure B - 3 ESRl .INSERT listing. Appendix B: ESRl USERS GUWE+and+PROGRAM LISTING 104 1 M P A R A M 1 0 0 2 M F I E L D 2 0 0 3 M P T C L 3 0 0 4 M C N T R L 4 0 0 5 M T I M E 5 0 0 6 M T H E R M 6 0 0 1 0 A J U N K 7 0 0 11 H P L O T B O O 1 2 0 0 0 0 0 0 0 0 1 0 0 I M P L I C I T D O U B L E P R E C I S I O N ( A - H . 0 - Z ) 1 0 1 I N T E G E R Z E R O , O N E , T W O . T H R E E . F O U R , F I V E 1 0 2 I N T E G E R S I X , S E V E N , E I G H T , C E N T 1 0 3 P A R A M E T E R ( Z E R O = 0 , O N E = 1 , TWO = 2 , T H R E E = 3 ) 1 0 4 P A R A M E T E R ( F O U R = 4 , F I V E «= 5 , S I X = 6 . S E V E N = 7 ) 1 0 5 P A R A M E T E R ( E I G H T = 8 , C E N T •= 1 0 0 ) 1 0 6 P A R A M E T E R ( D Z E R O = 0 . 0 0 0 ) 1 0 7 P A R A M E T E R ( T W O P I = 6 . 2 8 3 1 8 5 3 0 7 1 7 9 5 8 D O ) 1 0 8 D O U B L E P R E C I S I O N L , M 1 , M 2 , K E 1 0 9 C O M M O N / P A R A M / L , D X , D T , I D A T E , I T I M E , I I P L O T 1 1 1 $ E N D F I L E 2 0 0 P A R A M E T E R ( N G M A X = 2 5 6 ) 2 0 1 P A R A M E T E R ( N G 1 M = N G M A X + 1 ) 2 0 2 C O M M O N / C F I E L D / A E L , E P S I , R H O O , A 1 , A 2 , 2 0 3 R H 0 ( N G 1 M ) , P H I ( N G 1 M ) , E ( N G 1 M ) , 2 0 4 E K ( N G 1 M ) , E O . W O , N G 2 0 6 S E N D F I L E 3 0 0 R E A L Z X , Z V 3 0 1 C O M M O N / P R T C L S / X ( 6 5 5 4 0 ) , V X ( 6 5 5 4 0 ) , V Y ( 6 5 5 4 0 ) . 3 0 2 Z X ( 1 7 6 6 0 ) . Z V ( 1 7 6 6 0 ) 3 0 3 S E N D F I L E 4 0 0 D O U B L E P R E C I S I O N I T M I N , I T M A X 4 0 1 C O M M O N / C N T R L / C D M I N , C D M A X . S D M I N . S D M A X , 4 0 2 E P M I N , E P M A X , E F M I N . E F M A X , 4 0 3 E T M I N , E T M A X , I T M I N , I T M A X , 4 0 4 T I M E . X X O R I G , X X M A X , Y Y O R I G , Y Y M 4 X . 4 0 5 I T , I T H L , I T T H , I R H O , I R H O S . I P H I , I E 4 0 6 I X V X . I V X V Y , I F X , I S P E C , J F L A G , J S U M P 4 0 8 S E N D F I L E 5 0 0 D O U B L E P R E C I S I O N K E 1 , K E 2 , N M 1 , N M 2 5 0 1 P A R A M E T E R ( N T H •= 2 5 0 0 . MM A X = 2 0 ) 5 0 2 P A R A M E T E R ( N T H 1 = N T H + 1 , N T H 2 ' N T H + 2 ) 5 0 3 C O M M O N / C T I M E / E S E ( N T H 1 ) , K E K N T H 1 ) . K E 2 ( N T H 1 ) , 5 0 4 P 1 X ( N T H 2 ) , P 1 Y ( N T H 2 ) , N M 1 , N M 2 , 5 0 5 P 2 X ( N T H 2 ) , P 2 Y ( N T H 2 ) , T E ( N T H 1 ) , 5 0 6 X T ( N T H 1 ) , V X T ( N T H 1 ) . E L K E ( N T H I ) , 5 0 7 E S E M ( N T H 1 . M M A X ) . M P L 0 T ( M M A X i 5 0 8 S E N D F I L E 6 0 0 C O M M O N / T H E R M L / I T H E R M 6 0 1 S E N D F I L E 7 0 0 D O U B L E P R E C I S I O N T H R M X 1 ( N G 1 M ) . T H R M X 2 ( N G 1 M ) , 7 0 1 V X O S C ( N G 1 M ) . V 2 S X ( N G 1 M ) . 7 0 2 V Y O S C ( N G 1 M ) 7 0 3 E Q U I V A L E N C E ( T H R M X 1 , T H R M X 2 , V 2 S X , P H I ) 7 0 4 D I M E N S I O N N ( N G 1 M ) 7 0 5 S E N D F I L E 8 0 0 C O M M O N / H P L O T S / I T E , I K E 1 . I K E 2 , I E S E . I E S E M , E L K E , 8 0 1 1 P 1 X . I P 1 Y , I P 2 X . I P 2 Y , I X T , : V X T 8 0 2 L O G I C A L I F V X 0 1 , I F V Y 0 1 , I F V X 0 2 , I F V Y 0 2 , I F V X O T , 8 0 3 I R H O O , I R H O S O , I P H I O , I E O . I T M P 0 1 . 1 T M P 0 2 . 8 0 4 I E S E M , I E S E , I P 1 X , I P 1 Y , I P 2 X , l ? 2 Y , 8 0 5 I X T , I V X T , I T E . I K E 1 , I K E 2 . I E L K E . 8 0 6 L H S T R Y . L F I E L D , L S P A C E . I S P E C O 6 0 7 S E N D F I L E Figure B - 4 E S R l . C L I C H E listing. PROGRAM ESRl - LISTING 105 P R O G R A M E S R l — LISTING 1 0 0 1 c c 1 G 0 2 C E S R 1 - A 1 - D E L E C T R O S T A T I C P L A S M A S I M U L A T I O N C O D E C 1 0 0 3 C C 1 0 0 4 c=============================================================C 1 0 0 5 C R e l a t i v i s t i c v e r s i o n . A d a p t e d b y r . d . p a r a c h o n i a k ( 8 5 - 1 1 ) C 1 0 0 6 C f r o m E S 1 w r i t t e n b y A . B . L a n g d o n 1 9 7 2 . T h i s v e r s i o n I s C 1 0 0 7 C s e t u p t o r u n o n t h e U B C - F P S 1 6 4 a r r a y p r o c e s s o r . C 1 0 0 8 C r C 1 0 0 9 P R O G R A M E S R 1 1 0 1 0 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 . 9 9 9 ) ' 1 0 1 1 D O U B L E P R E C I S I O N M 1 C 2 , M 2 C 2 , K O 1 0 1 2 L O G I C A L R S T A R T . O S T A R T . L S M E A R 1 0 1 3 C H A R A C T E R * 1 3 1 A T I T L E 1 0 1 4 C H A R A C T E R * 2 0 D A T E R 1 0 1 5 N A M E L I S T / I N 1 / K O , N T , D T , N G , A 1 , A 2 , V L I G H T , 1 0 1 6 E O , WO, I R H O . I R H O S , I P H I , I E , M P L O T , 1 0 1 7 I X V X , I T H E R M , R S T A R T , I S A V E , I S P E C , M O D E , 1 0 1 8 O S T A R T , L S M E A R 1 0 1 9 N A M E L I S T / I N 2 / N 1 , W P 1 . Q M 1 . T E M P 1 , V 1 0 . X I I , T H E T X 1 , W C 1 1 0 2 0 N A M E L I S T / I N 3 / N 2 , W P 2 , Q M 2 , T E M P 2 , V 2 0 , X 2 1 , T H E T X 2 1 0 2 1 C 1 0 2 2 C D e f a u l t i n p u t p a r a m e t e r s : 1 0 2 3 C 1 0 2 4 D A T A W P 1 , W P 2 , W C 1 , W C 2 / 2 * 1 . O D O , 2 * 0 . O D O / 1 0 2 5 D A T A Q M 1 , Q M 2 / - 1 . 0 D 0 . - 1 . O D O / 1 0 2 6 D A T A V 1 0 , V 2 0 / O . O D O , O . O D O / 1 0 2 7 D A T A N 1 , N 2 / 1 2 8 , 1 2 8 / 1 0 2 8 D A T A T E M P I , T E M P 2 / O . O D O , O . O D O / 1 0 2 9 D A T A X I I , X 2 1 . M O D E / 2 * 0 . O D O , 1 / 1 0 3 0 D A T A T H E T X 1 , T H E T X 2 / O . O D O , 0 . 0 0 0 / 1 0 3 1 D A T A V L I G H T / 1 . 0 D 0 / 1 0 3 2 C 1 0 3 3 O P E N ( 2 , F I L E = ' : H O S T C H A R : E S R 1 . I N P U T ' , S T A T U S = ' O L D ' ) 1 0 3 4 O P E N ( 7 , F I L E = ' P R N T ' ) 1 0 3 5 O P E N ( 1 2 , F I L E = ' A P 0 ' , F O R M = ' U N F O R M A T T E D ' ) 1 0 3 6 O P E N ( 1 1 , F I L E = ' H I S T ' , F O R M = ' U N F O R M A T T E D ' ) 1 0 3 7 O P E N ( 3 , F I L E = ' : R A P S ( R O N ) : S A V E ' , F O R M = ' U N F O R M A T T E D ' ) 1 0 3 8 C 1 0 3 9 C A L L S Y S S G E T D A T E ( D A T E R ) 1 0 4 0 C A L L D A T E M E ( D A T E R , I D A T E , I T I M E ) 1 0 4 1 N T = 1 5 0 1 0 4 2 I T H = O 1 0 4 3 C 1 0 4 4 C R e a d t i t l e a n d n a m e l i s t i n p u t . 1 0 4 5 C 1 0 4 6 R E A D ( 2 , 9 7 5 ) A T I T L E 1 0 4 7 R E A D ( 2 . I N 1 ) 1 0 4 8 R E A D ( 2 . I N 2 ) 1 0 4 9 R E A D ( 2 . I N 3 ) 1 0 5 0 C 1 0 5 1 C A t T = 0 , z e r o a r r a y s . 1 0 5 2 C 1 0 5 3 C A L L Z E R O S 1 0 5 4 C 1 0 5 5 L = T W O P I / K O 1 0 5 6 D X = L / N G 1 0 5 7 H D X = 0 . 5 D 0 * D X 1 0 5 8 T 1 = W C 1 * D T / 2 . O D O 1 0 5 9 N P = N 1 + N 2 1 0 6 0 0 1 = W P 1 * W P 1 / ( N 1 * Q M 1 ) 1 0 6 1 M1 = 0 1 / 0 M 1 1 0 6 2 N M 1 = N 1 * M1 1 0 6 3 0 2 = D Z E R O 1 0 6 4 I F ( N 2 . N E . 0 ) 0 2 = W P 2 * W P 2 / ( N 2 * Q M 2 ) 1 0 6 5 M 2 = 0 2 / 0 M 2 1 0 6 6 T 2 = D Z E R O 1 0 6 7 I F ( M 2 . G T . D Z E R O ) T 2 = M 1 * T 1 / M 2 1 0 6 8 N M 2 = N 2 * M 2 1 0 6 9 N 1 1 = N 1 + 1 1 0 7 0 N G 1 = N G + 1 io7 1 0 7 1 1 0 7 2 1 0 7 3 1 0 7 4 1 0 7 5 1 0 7 6 1 0 7 7 1 0 7 8 1 0 7 9 1 0 8 0 1 0 8 1 1 0 8 2 1 0 8 3 1 0 8 4 1 0 8 5 1 0 8 6 1 0 8 7 1 0 8 8 1 0 8 9 1 0 9 0 1 0 9 1 1 0 9 2 1 0 9 3 1 0 9 4 1 0 9 5 1 0 9 6 1 0 9 7 1 0 9 8 1 0 9 9 1 1 0 0 1 1 0 1 1 1 0 2 1 1 0 3 1 1 0 4 1 1 0 5 1 1 0 G 1 1 0 7 1 1 0 8 1 1 0 9 1 1 1 0 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5 1 1 1 6 1 1 1 7 1 1 1 8 1 1 1 9 1 1 2 0 1 1 2 1 1 1 2 2 1 1 2 3 1 1 2 4 1 1 2 5 1 1 2 6 1 1 2 7 1 1 2 8 1 1 2 9 1 1 3 0 1 1 3 1 1 1 3 2 1 1 3 3 1 1 3 4 1 1 3 5 1 1 3 6 1 1 3 7 1 1 3 8 1 1 3 9 1 1 4 0 G N = F L O A T ( N G ) R H O O = - ( N 1 * Q 1 I F M T = 5 0 C G S H L = L + N 2 * 0 2 ) / L S c a l i n g 1 n u n i t s o f r e s t m a s s e n e r g y d e n s i t y . M 1 C 2 E V = 0 . 5 1 1 0 0 4 1 D 0 6 e l e c t r o n v o l t s . M 2 C 2 E V M 1 C 2 M 2 C 2 R M 1 C 2 I R N M 1 C 2 R M 2 C 2 I R N M 2 C 2 I F ( N 2 . N E . 0 ) I F ( N 2 . N E . 0 ) ( M 2 / M 1 ) * 0 . 5 1 1 0 0 4 1 D 0 6 M 1 * ( D X / D T ) * * 2 M 2 * ( D X / D T ) * * 2 1 . 0 D 0 / M 1 C 2 1 . 0 D 0 / ( N 1 * M 1 C 2 ) D Z E R O D Z E R O R M 2 C 2 I R N M 2 C 2 1 . O D O / M 2 C 2 1 . O D O / ( N 2 * M 2 C 2 ) I R D A T E = Z E R O I R T I M E = Z E R O N R E C S = N P / 1 0 2 4 I F ( M 0 D ( N P , 1 O 2 4 ) . G T . I R S = 0 I F ( R S T A R T ) I R S = 1 0 ) N R E C S = N R E C S + 1 I F ( . N O T . R S T A R T ) GO T O 3 0 I f r e s t a r t i n g , t h e n r e s t o r e s a v e d q u a n t i t i e s . : C A L L R E S T O R ( I R D A T E . I R T I M E , I T H , M 1 , M 2 , K O . 0 1 , 0 2 . T 1 , T 2 , N 1 1 , N P , V L I G H T ) C A L L R I T E R 1 ( N T H , M M A X , R S T A R T , I R D A T E , I R T I M E , M O D E , A T I T L E , N T , N P , V L I G H T , K O ) C A L L R I T E R 2 ( M 1 , 0 1 , W P 1 , W C 1 . 0 M 1 , T 1 , V 1 0 , X 1 1 , T H E T X 1 . N 1 , T E M P 1 , M 2 , 0 2 , W P 2 , W C 2 , Q M 2 , T 2 , V 2 0 , X 2 1 , T H E T X 2 , N 2 , T E M P 2 ) S a v e m i s c 1 1 1 a n e o u s v a r i a b l e s f o r u s e i n p l o t t i n g r o u t i n e s . R E W I N D 11 W R I T E ( 1 1 ) W R I T E ( 11 ) R E W I N D 1 2 W R I T E ( 1 2 ) W R I T E ( 1 2 ) G O T O 1 4 0 I T , I T H , I T H L , N P , N G , I D A T E , I T I M E , I R D A T E , I R T I M E , N 1 1 , I E , I P H I , I R H O , I R H O S , I T H E R M , I X V X . N 1 , N 2 , N T , I R S , I S P E C , M P L O T D T , D X , L . T I M E , T 1 , T E M P 1 , T E M P 2 I T , I T H , I T H L , N P , N G , I D A T E , I T I M E , I R D A T E , I R T I M E , N i l , I E , I P H I , I R H O , I R H O S , I T H E R M , I X V X , N 1 , N 2 , N T , I R S , I S P E C . M P L O T D T , D X , L . T I M E , T 1 , T E M P I , T E M P 2 3 0 C A L L R I T E R 1 ( N T H , M M A X , R S T A R T , I R D A T E , I R T I M E , M O D E , A T I T L E , N T , N P , V L I G H T , K O ) C A L L R I T E R 2 ( M 1 , 0 1 . W P 1 , W C 1 , O M 1 , T 1 , V 1 0 , X 1 1 , T H E T X 1 , N 1 , T E M P 1 , M 2 , Q 2 . W P 2 , W C 2 . Q M 2 , T 2 , V 2 0 , X 2 1 , T H E T X 2 , N 2 , T E M P 2 ) X 1 1 = X 1 1 * L / N P I F ( N 2 . N E . 0 ) X 2 1 = X 2 1 * L / N P C V L I G H T = V L I G H T * D X / D T c  C P o s i t i o n a n d v e l o c i t y l o a d i n g . c  C E l e c t r o n s . c  D D X 1 = L / N 1 4 0 DO 4 0 I X ( I ) V X ( I ) V Y ( I ) 1 , N 1 ( I - . 5 D 0 ) * D D X 1 V 1 0 D Z E R O C A L L C R E A T R ( V 1 0 , O N E , I S E E D = 5 6 4 3 7 N 1 , T E M P I , O S T A R T ) 1 1 4 1 C | O f f 1 1 4 2 I F ( L S M E A R ) C A L L S M E A R ( X , O N E , N 1 . I S E E D ) 1 1 4 3 C 1 1 4 4 C F o r o r d e r e d v e l o c i t i e s , s c r a m b l e p o s i t i o n s t o r e d u c e 1 1 4 5 C c o r r e l a t i o n s . S c r a m b l i n g 1 s d o n e b y b i t - r e v e r s e d c o u n t e r . 1 1 4 6 C C o m p a r e s o r t e r I n C P F T . 1 1 4 7 C X S = . 0 0 0 , . 1 0 0 , . 0 1 0 , . 1 1 0 , . 0 0 1 , . 1 0 1 , . 0 1 1 , . 1 1 1 . 1 1 4 8 C ( b i n a r y f r a c t i o n s ) . 1 1 4 9 C 1 1 5 0 I F ( O S T A R T ) T H E N 1 1 5 1 X S = D Z E R O 1 1 5 2 C 1 1 5 3 D O 6 0 I = 1 , N 1 1 1 5 4 X ( I ) = X S * L + 0 . 5 D 0 * D D X 1 1 1 5 5 X S I = 1 . 0 D 0 1 1 5 6 5 0 X S I = 0 . 5 D 0 * X S I 1 1 5 7 X S = X S - X S I 1 1 5 8 I F ( X S . G E . D Z E R O ) GO T O 5 0 1 1 5 9 X S = X S + 2 . 0 D 0 * X S I 1 1 6 0 6 0 C O N T I N U E 1 1 6 1 E N D I F 1 1 6 2 C 1 1 6 3 C A d d p e r t u r b a t i o n . 1 1 6 4 C L o a d i n g X ( T = 0 ) . s o n o D T / 2 c o r r e c t i o n . 1 1 6 5 C 1 1 6 6 D O 7 0 I = 1 , N 1 1 1 6 7 T H E T A = T W O P I * M O D E * X ( I ) / L 1 1 6 8 X ( I ) = X ( I ) + X 1 1 * C O S ( T H E T A + T H E T X 1 ) 1 1 6 9 7 0 C O N T I N U E 1 1 7 0 C 1 1 7 1 C P o s i t i o n a n d v e l o c i t y l o a d i n g . 1 1 7 2 C - -1 1 7 3 C S p e c i e s 2 . 1 1 7 4 C 1 1 7 5 I F ( N 1 1 . L E . N P ) T H E N 1 1 7 6 D D X 2 = L / N 2 1 1 7 7 C 1 1 7 8 DO 8 0 I = N 1 1 , N P 1 1 7 9 X ( I ) = ( I - . 5 D 0 - N 1 ) * D D X 2 1 1 8 0 V Y ( I ) = D Z E R O 1 1 8 1 V X ( I ) = V 2 0 1 1 8 2 8 0 C O N T I N U E 1 1 8 3 C 1 1 8 4 C A L L C R E A T R ( V 2 0 . N 1 1 , N P , T E M P 2 . O S T A R T ) 1 1 8 5 I S E E D = 3 9 2 8 4 1 1 8 6 I F ( L S M E A R ) C A L L S M E A R ( X . N i l . N P , I S E E D ) 1 1 8 7 C 1 1 8 8 C F o r o r d e r e d v e l o c i t i e s , s c r a m b l e p o s i t i o n s 1 1 8 9 C t o r e d u c e c o r r e l a t i o n s . 1 1 9 0 C 1 1 9 1 I F ( O S T A R T ) T H E N 1 1 9 2 X S = D Z E R O 1 1 9 3 C 1 1 9 4 DO 1 0 0 I = N 1 1 , N P 1 1 9 5 ^ X ( I ) = X S * L + 0 . 5 D 0 * D D X 2 1 1 9 6 X S I = 1 . 0 D 0 1 1 9 7 9 0 X S I = 0 . 5 D 0 * X S I 1 1 9 8 X S = X S - X S I 1 1 9 9 I F ( X S . G E . D Z E R O ) G O T O 9 0 1 2 0 0 X S = X S + 2 . 0 D 0 * X S I 1 2 0 1 1 0 0 C O N T I N U E 1 2 0 2 E N D I F 1 2 0 3 C 1 2 0 4 C A d d p e r t u r b a t i o n . 1 2 0 5 C 1 2 0 6 DO 1 1 0 I = N 1 1 , N P 1 2 0 7 T H E T A = T W O P I * M O D E * X ( I ) / L 1 2 0 8 X ( I ) = X ( I ) + X 2 1 * C O S ( T H E T A + T H E T X 2 ) 1 2 0 9 1 1 0 C O N T I N U E 1 2 1 0 E N D I F 1 2 1 1 C - — — - — j 0 2 > 1 2 1 2 C S a v e m i s c 1 1 1 a n e o u s v a r i a b l e s f o r u s e i n p l o t t i n g r o u t i n e s . 1 2 1 3 C 1 2 1 4 R E W I N D 11 1 2 1 5 W R I T E ( 1 1 ) I T . I T H , I T H L . N P , N G . I D A T E , I T I M E , I R D A T E , 1 2 1 6 I R T I M E , N 1 1 , I E , I P H I . I R H O . I R H O S , I T H E R M . 1 2 1 7 I X V X , N 1 , N 2 , N T , I R S , I S P E C , M P L O T 1 2 1 8 W R I T E ( I I ) D T . D X . L , T I M E , T 1 . T E M P I , T E M P 2 1 2 1 9 R E W I N D 1 2 1 2 2 0 W R I T E ( 1 2 ) I T . I T H , I T H L , N P , N G , I D A T E , I T I M E , I R D A T E , 1 2 2 1 I R T I M E , N 1 1 , I E , I P H I , I R H O , I R H O S , I T H E R M , 1 2 2 2 I X V X , N 1 , N 2 . N T . I R S . I S P E C , M P L O T -1 2 2 3 W R I T E ( 1 2 ) D T . D X , L , T I M E . T 1 , T E M P I , T E M P 2 1 2 2 4 C 1 2 2 5 C S a v e X , V X a n d V Y a t T = 0 . 1 2 2 6 C - - - -1 2 2 7 J S = 1 1 2 2 8 J E = M I N ( 1 0 2 4 , N P ) 1 2 2 9 DO 1 2 0 I = 1 . N R E C S 1 2 3 0 W R I T E M 2 ) ( X ( d ) , J = J S , J E ) 1 2 3 1 O S = J E + 1 1 2 3 2 J E = J E + 1 0 2 4 1 2 3 3 J E = M I N ( J E . N P ) 1 2 3 4 1 2 0 C O N T I N U E 1 2 3 5 C 1 2 3 6 J S = 1 1 2 3 7 J E = M I N ( 1 0 2 4 . N P ) 1 2 3 8 DO 1 2 1 I = 1 , N R E C S 1 2 3 9 W R I T E ( 1 2 ) ( V X ( J ) , J = J S . J E ) 1 2 4 0 J S = J E + 1 1 2 4 1 J E = J E + 1 0 2 4 1 2 4 2 J E = M I N ( J E . N P ) 1 2 4 3 1 2 1 C O N T I N U E 1 2 4 4 C 1 2 4 5 J S = 1 1 2 4 6 J E = M I N ( 1 0 2 4 , N P ) 1 2 4 7 DO 1 2 2 I = 1 , N R E C S 1 2 4 8 W R I T E ( 1 2 ) ( V Y ( J ) , J = J S , J E ) 1 2 4 9 J S = J E + 1 1 2 5 0 J E = J E + 1 0 2 4 1 2 5 1 J E = M I N ( J E . N P ) 1 2 5 2 1 2 2 C O N T I N U E 1 2 5 3 C 1 2 5 4 C A L L S E T R H O ( O N E , N 1 , 0 1 ) 1 2 5 5 C A L L S E T R H O ( N 1 1 , N P , 0 2 ) 1 2 5 6 C A L L F I E L D S ( Z E R O ) 1 2 5 7 C A L L S E T V ( O N E , N 1 , 0 1 , M 1 , T 1 , P 1 X ( 1 ) , P 1 Y ( 1 ) , V L I G H T ) 1 2 5 8 C A L L S E T V ( N 1 1 , N P , 0 2 , M 2 , T 2 . P 2 X ( 1 ) , P 2 Y ( 1 ) , V L I G H T ) 1 2 5 9 C 1 2 6 0 I F ( N T . E O . 0 ) S T O P 1 2 6 1 C 1 2 6 2 X T ( 1 ) = X ( 1 ) 1 2 6 3 V X T ( 1 ) = V X ( 1 ) 1 2 6 4 c============================================================= 1 2 6 5 C B e g i n t i m e s t e p l o o p . 1 2 6 6 C P a r t i c l e X i s a t t i m e 0 ; V X & V Y a r e a t - D T / 2 . 1 2 6 7 C 1 2 6 8 1 3 0 C O N T I N U E 1 2 6 9 C 1 2 7 0 C I f m a k i n g a r e s t a r t f i l e , h e r e i s w h e r e y o u s a v e e v e r y t h i n g . : 1 2 7 1 C 1 2 7 2 I F ( ( I T / I S A V E ) * I S A V E . N E . I T ) GO T O 1 4 0 1 2 7 3 C 1 2 7 4 C A L L S A V E I T ( I T H , M 1 , M 2 , 0 1 , 0 2 , T 1 . T 2 . N 1 1 , N P , V L I G H T ) 1 2 7 5 1 4 0 C O N T I N U E 1 2 7 6 C 1 2 7 7 C A d v a n c e v e l o c i t i e s f r o m I T - . 5 t o I T + . 5 . 1 2 7 8 C -1 2 7 9 C A L L A C C E L ( O N E , N 1 , 0 1 , M 1 . T 1 , P 1 X U T H + 2 ) . P 1 Y ( I T H + 2 ) , 1 2 8 0 K E 1 ( I T H + 1 ) , K E , V L I G H T ) 1 2 8 1 E L K E ( I T H + 1 ) = K E / N M 1 l l ° 1 2 8 2 C A L L A C C E L ( N 1 1 . N P , 0 2 . M 2 . T 2 , P 2 X ( I T H + 2 ) , P 2 Y ( I T H + 2 ) , 1 2 8 3 K E 2 ( I T H + 1 ) , K E , V L I G H T ) 1 2 8 4 C 1 2 8 5 P = P 1 X U T H + 2 ) + P 2 X ( I T H + 2 ) 1 2 8 6 K E = K E / N M 1 1 2 8 7 T E U T H + 1 ) = K E + E S E ( I T H + 1 ) 1 2 8 8 I F ( I T . E 0 . O ) T H E N 1 2 8 9 W R I T E ( 7 , 8 5 0 ) 1 2 9 0 G O T O 1 2 9 1 2 9 1 E N D I F 1 2 9 2 I F ( I T . E Q . 1 ) G O T O 1 2 9 1 2 9 3 I F ( ( I T - 1 ) / I F M T * I F M T . E Q . ( I T - 1 ) ) T H E N 1 2 9 4 W R I T E ( 7 , 8 2 5 ) 1 2 9 5 W R I T E ( 7 , 8 5 0 ) 1 2 9 6 E N D I F 1 2 9 7 1 2 9 C O N T I N U E 1 2 9 8 T E D E V = ( ( T E ( 1 ) - T E ( I T H + 1 ) ) / T E ( 1 ) ) * 1 0 0 . O D O 1 2 9 9 F E P E R = E S E ( I T H + 1 ) / T E ( I T H + 1 ) * 1 0 0 . O D O 1 3 0 0 W R I T E ( 7 , 9 5 0 ) T I M E , T E ( I T H + 1 ) , E S E ( I T H + 1 ) . K E , P . 1 3 0 1 E L K E ( I T H + 1 ) , P 1 X ( I T H + 2 ) , T E D E V , F E P E R 1 3 0 2 C 1 3 0 3 I F ( I X V X . N E . Z E R O ) T H E N 1 3 0 4 I F ( ( I T / I X V X ) * I X V X . E Q . I T ) T H E N 1 3 0 5 C 1 3 0 6 C S a v e : X @ t = I T , V X . V Y e t = I T + . 5 1 3 0 7 C 1 3 0 8 J S = 1 1 3 0 9 J E = M I N ( 1 0 2 4 , N P ) 1 3 1 0 DO 1 5 0 I = 1 , N R E C S 1 3 1 1 W R I T E ( 1 2 ) ( X ( J ) , J = J S . J E ) 1 3 1 2 J S = J E + 1 1 3 1 3 J E = J E + 1 0 2 4 1 3 1 4 J E = M I N ( J E . N P ) 1 3 1 5 1 5 0 C O N T I N U E 1 3 1 6 C 1 3 1 7 J S = 1 1 3 1 8 J E = M I N ( 1 0 2 4 , N P ) 1 3 1 9 DO 1 5 1 I = 1 , N R E C S 1 3 2 0 W R I T E U 2 ) ( V X ( J ) , J = J S , J E ) 1 3 2 1 J S = J E + 1 1 3 2 2 J E = J E + 1 0 2 4 1 3 2 3 J E = M I N ( J E . N P ) 1 3 2 4 1 5 1 C O N T I N U E 1 3 2 5 C 1 3 2 6 I F ( T 1 . N E . D Z E R O ) T H E N 1 3 2 7 J S = 1 1 3 2 8 J E = M I N ( 1 0 2 4 , N P ) 1 3 2 9 DO 1 5 2 I = 1 , N R E C S 1 3 3 0 W R I T E ( 1 2 ) ( V Y ( J ) , J = J S , J E ) 1 3 3 1 J S = J E + 1 1 3 3 2 J E = J E + 1 0 2 4 1 3 3 3 J E = M I N ( J E . N P ) 1 3 3 4 1 5 2 C O N T I N U E 1 3 3 5 E N D I F 1 3 3 6 E N D I F 1 3 3 7 E N D I F 1 3 3 8 C 1 3 3 9 I F ( I T . G E . N T ) G O T O 2 1 0 1 3 4 0 I F ( I T H . E Q . N T H ) T H E N 1 3 4 1 C 1 3 4 2 C W r i t e h i s t o r y a r r a y s t o f i l e . 1 3 4 3 C 1 3 4 4 T L = I T H L * D T 1 3 4 5 M T H = I T - I T H L + 1 1 3 4 6 M T H 1 = M T H + 1 1 3 4 7 C A L L P E A K S ( M T H ) 1 3 4 8 C 1 3 4 9 N R E C 2 = M T H / 1 0 2 4 1 3 5 0 I F ( M O D ( M T H , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 3 5 1 C 1 3 5 2 DO 1 7 0 K M = 1 , M M A X 1 3 5 3 J S T A R = 1 1 3 5 4 J E N D = M I N ( 1 0 2 4 , M T H ) 1 3 5 5 K K = M P L O T ( K M ) 1 3 5 6 I F ( K K . N E . 0 ) T H E N 1 3 5 7 DO 1 6 9 J d = 1 . N R E C 2 1 3 5 8 W R I T E ( 1 1 ) ( E S E M ( d . K M ) . d = J 5 T A R , d E N D ) 1 3 5 9 d S T A R = d E N D + 1 1 3 6 0 d E N D = d E N D + 1 0 2 4 1 3 6 1 d E N D = M I N ( d E N D , M T H ) 1 3 6 2 1 6 9 C O N T I N U E 1 3 6 3 E N D I F 1 3 6 4 1 7 0 C O N T I N U E 1 3 6 5 C 1 3 6 6 N R E C 2 = M T H 1 / 1 0 2 4 1 3 6 7 I F ( M 0 D ( M T H 1 , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 3 6 8 d S T A R = 1 1 3 6 9 d E N D = M I N ( 1 0 2 4 , M T H ) 1 3 7 0 d E N D 1 = d E N D + 1 1 3 7 1 I F ( d E N D 1 . G T . 1 0 2 4 ) d E N D 1 = 1 0 2 4 1 3 7 2 C 1 3 7 3 DO 1 7 9 d d = 1 , N R E C 2 1 3 7 4 I F ( N R E C 2 . N E . 1 ) T H E N 1 3 7 5 I F ( d d . E Q . N R E C 2 ) T H E N 1 3 7 6 I F ( d S T A R . E Q . d E N D ) G O T O 1 7 5 1 3 7 7 E N D I F 1 3 7 8 E N D I F 1 3 7 9 W R I T E ( 1 1 ) ( K E 1 ( d ) , d = d S T A R , d E N D )-1 3 8 0 W R I T E ( 1 1 ) ( K E 2 ( d ) . d = d S T A R , d E N D ) 1 3 8 1 W R I T E ( 1 1 ) ( T E ( d ) , d = d S T A R , J E N D ) 1 3 8 2 W R I T E ( 1 1 ) ( E S E ( d ) , d = d S T A R , J E N D ) 1 3 8 3 W R I T E ( 1 1 ) ( E L K E ( d ) , d = d S T A R , d E N D ) 1 3 8 4 1 7 5 W R I T E ( 1 1 ) ( X T ( d ) , d = d S T A R , d E N D 1 ) 1 3 8 5 W R I T E ( 1 1 ) ( V X T ( d ) , d = d S T A R , d E N D 1 ) 1 3 8 6 W R I T E ( 1 1 ) ( P 1 X ( d ) , d = d S T A R , d E N D 1 ) 1 3 8 7 W R I T E ( 1 1 ) ( P 2 X ( d ) , d = d S T A R , d E N D 1 ) 1 3 8 8 W R I T E ( 1 1 ) ( P 1 Y ( d ) . d = J S T A R , d E N D 1 ) . 1 3 8 9 W R I T E ( 1 1 ) ( P 2 Y ( d ) , d = d S T A R , d E N D 1 ) 1 3 9 0 d S T A R = d E N D + 1 1 3 9 1 d E N D = d E N D + 1 0 2 4 1 3 9 2 d E N D = M I N ( d E N D , M T H ) 1 3 9 3 I F ( ( d E N D - d S T A R ) . L T . 1 0 2 3 ) T H E N 1 3 9 4 d E N D 1 = d E N D + 1 1 3 9 5 E L S E 1 3 9 6 d E N D 1 = d E N D 1 3 9 7 E N D I F 1 3 9 8 1 7 9 C O N T I N U E 1 3 9 9 C 1 4 0 0 I T H L = I T 1 4 0 1 1 4 0 2 C L a s t v a l u e s a r e n o w f i r s t v a l u e s f o r n e x t t i m e i n t e r v a l . 1 4 0 3 1 4 0 4 I T H L = I T 1 4 0 5 P 1 X ( 1 ) = P 1 X L 1 4 0 6 P 1 Y ( 1 ) = P 1 Y L 1 4 0 7 P 1 X ( 2 ) = P 1 X ( M T H + 1 ) 1 4 0 8 P 1 Y ( 2 ) = P 1 Y ( M T H + 1 ) 1 4 0 9 C 1 4 1 0 I F ( N M 2 . N E . D Z E R O ) T H E N 1 4 1 1 P 2 X ( 1 ) = P 2 X L 1 4 1 2 P 2 Y ( 1 ) = P 2 Y L 1 4 1 3 P 2 X ( 2 ) = P 2 X ( M T H + 1 ) 1 4 1 4 P 2 Y ( 2 ) = P 2 Y ( M T H + 1 ) 14 1 5 E N D I F 1 4 1 6 C 1 4 1 7 T E ( 1 ) = T E ( M T H ) 1 4 1 8 E S E ( 1 ) = E S E ( M T H ) 1 4 1 9 X T ( 1 ) = X T ( M T H ) 1 4 2 0 V X T ( 1 ) = V X T ( M T H ) III 1 4 2 1 ' E L K E ( I ) = E L K E ( M T H ) 1 4 2 2 C j l Z 1 4 2 3 DO 1 9 0 1 = 2 , M T H 1 4 2 4 P 1 X ( 1 + 1 ) = D Z E R O 1 4 2 5 P 1 Y ( 1 + 1 ) = D Z E R O 1 4 2 6 P 2 Y ( I + 1 ) = D Z E R O 1 4 2 7 P 2 X ( I + 1 ) = D Z E R O 1 4 2 8 T E ( I ) = D Z E R O 1 4 2 9 E S E ( I ) = D Z E R O 1 4 3 0 E L K E ( I ) = D Z E R O 1 4 3 1 1 9 0 C O N T I N U E 1 4 3 2 C 1 4 3 3 D O 2 0 0 K M = 1 , M M A X 1 4 3 4 E S E M O . K M ) = E S E M ( M T H . K M ) 1 4 3 5 DO 2 0 0 I = 2 , M T H 1 4 3 6 2 0 0 E S E M ( I . K M ) = D Z E R O 1 4 3 7 E N D I F 1 4 3 8 C 1 4 3 9 I T = I T + 1 1 4 4 0 T I M E = I T * D T 1 4 4 1 I T H = I T - I T H L 1 4 4 2 C 1 4 4 3 C S a v e t i m e v a r i a b l e s . 1 4 4 4 C 1 4 4 5 W R I T E ( 1 2 ) I T , I T H 1 4 4 6 C 1 4 4 7 C A d v a n c e p o s i t i o n s f r o m I T t o I T + 1 . 1 4 4 8 C 1 4 4 9 C A L L M O V E ( O N E , N 1 , 0 1 ) 1 4 5 0 C A L L M O V E ( N 1 1 , N P , 0 2 ) 1 4 5 1 X T ( I T H + 1 ) = X ( 1 ) 1 4 5 2 V X T ( I T H + 1 ) = V X ( 1 ) 1 4 5 3 C 1 4 5 4 C G e t f i e l d s a t t i m e s t e p I T . 1 4 5 5 C 1 4 5 6 C A L L F I E L D S ( I T H ) 1 4 5 7 C 1 4 5 8 G O T O 1 3 0 1 4 5 9 c===========================================================" 1 4 6 0 C E N D O F R U N . 1 4 6 1 c===========================================================" 1 4 6 2 C P a r t i c l e X 1 s a t t i m e N T * D T , V X 8. V Y a t ( N T - . 5 ) * D T . 1 4 6 3 C 1 4 6 4 2 1 0 C O N T I N U E 1 4 6 5 C 1 4 6 6 C W r i t e h i s t o r y a r r a y s t o f i l e . 1 4 6 7 C 1 4 6 8 M T H = I T - I T H L + 1 1 4 6 9 M T H 1 = M T H + 1 1 4 7 0 C A L L P E A K S ( M T H ) 1 4 7 1 C 1 4 7 2 N R E C 2 = M T H / 1 0 2 4 1 4 7 3 I F ( M O D ( M T H . 1 0 2 4 ) . G T . O ) N R E C 2 = N R E C 2 + 1 1 4 7 4 C 1 4 7 5 DO 2 3 0 K M = 1 , M M A X 1 4 7 6 J S T A R = 1 1 4 7 7 d E N D = M I N ( 1 0 2 4 , M T H ) 1 4 7 8 K K = M P L O T ( K M ) 1 4 7 9 I F ( K K . N E . 0 ) T H E N 1 4 8 0 DO 2 2 9 J d = 1 , N R E C 2 1 4 8 1 W R I T E ( 1 1 ) ( E S E M ( d . K M ) , d = d S T A R , J E N D ) 1 4 8 2 d S T A R = d E N D + 1 1 4 8 3 d E N D = d E N D + 1 0 2 4 1 4 8 4 d E N D = M I N ( d E N D , M T H ) 1 4 8 5 2 2 9 C O N T I N U E 1 4 8 6 E N D I F 1 4 8 7 2 3 0 C O N T I N U E 1 4 8 8 C 1 4 8 9 N R E C 2 = M T H 1 / 1 0 2 4 1 4 9 0 I F ( M 0 D ( M T H 1 , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 4 9 1 J S T A R = 1 / / 3 1 4 9 2 J E N D = M I N ( 1 0 2 4 , M T H ) 1 4 9 3 J E N D 1 = J E N D + 1 1 4 9 4 I F ( J E N D 1 . G T . 1 0 2 4 ) J E N D 1 = 1 0 2 4 1 4 9 5 C 1 4 9 6 DO 2 3 9 J J = 1 , N R E C 2 1 4 9 7 I F ( N R E C 2 . N E . 1 ) T H E N 1 4 9 8 I F ( J J . E O . N R E C 2 ) T H E N 1 4 9 9 I F ( J S T A R . E O . J E N D ) GO T O 2 3 5 1 5 0 0 E N D I F 1 5 0 1 E N D I F 1 5 0 2 W R I T E ( 1 1 ) ( K E 1 ( J ) . J = J S T A R , J E N D ) 1 5 0 3 W R I T E ( I I ) ( K E 2 ( J ) . J = J S T A R , J E N D ) 1 5 0 4 W R I T E ( 1 1 ) ( T E ( J ) . J = J S T A R , J E N D ) 1 5 0 5 W R I T E ( 1 1 ) ( E S E ( J ) , J = J S T A R , J E N D ) 1 5 0 6 W R I T E ( 1 1 ) ( E L K E ( J ) , J = J S T A R , J E N D ) 1 5 0 7 2 3 5 W R I T E ( 1 1 ) ( X T ( J ) , J = J S T A R , J E N D 1 ) 1 5 0 8 W R I T E ( 1 1 ) ( V X T ( J ) , J = J S T A R , J E N D 1 ) 1 5 0 9 W R I T E ( 1 1 ) ( P 1 X ( J ) , J = J S T A R , J E N D 1 ) 1 5 1 0 W R I T E ( 1 1 ) ( P 2 X ( J ) , J = J S T A R , J E N D 1 ) 1 5 1 1 W R I T E ( 1 1 ) ( P 1 Y ( J ) , J = J S T A R , J E N D 1 ) 1 5 1 2 W R I T E ( 1 1 ) ( P 2 Y ( J ) , J = J S T A R , J E N D 1 ) 1 5 1 3 J S T A R = J E N D + 1 1 5 1 4 J E N D = J E N D + 1 0 2 4 1 5 1 5 J E N D = M I N ( J E N D , M T H ) 1 5 1 6 I F ( ( J E N D - J S T A R ) . L T . 1 0 2 3 ) T H E N 1 5 1 7 J E N D 1 = J E N D + 1 1 5 1 8 E L S E 1 5 1 9 J E N D 1 = J E N D 1 5 2 0 E N D I F 1 5 2 1 2 3 9 C O N T I N U E 1 5 2 2 C 1 5 2 3 I T H L = I T 1 5 2 4 S T O P 1 5 2 5 C 1 5 2 6 8 2 5 F 0 R M A T ( / / , 4 1 X , ' E N E R G I E S A R E I N U N I T S O F ( N 1 * M 1 ' , 1 5 2 7 ' * C * * 2 ) . ' , / , 4 1 X , ' M O M E N T A A R E I N ' , 1 5 2 8 ' U N I T S O F C . ' ) 1 5 2 9 8 5 0 F O R M A T ( 1 H 1 , 1 0 2 X , 1 5 3 0 '% D E V I A T I O N F I E L D E N E R G Y ' , / , 4 6 X , 1 5 3 1 ' T O T A L T O T A L K I N E T I C E N E R G Y ' , 1 5 3 2 ' E L E C T R O N F R O M I N I T I A L A S % O F ' , / . 1 5 3 3 ' T I M E T O T A L E N E R G Y F I E L D E N E R G Y K I ' , 1 5 3 4 ' N E T I C E N E R G Y M O M E N T U M E L E C T R O N S 1 5 3 5 ' M O M E N T U M T O T A L E N E R G Y T O T A L E N E R G Y ' , / . 1 5 3 6 . '========== ============== ============== 1 5 3 7 . '============== ============== ============== ' , 1 5 3 8 <============== ============== = = = = = = = = = = = = = = ' , / ) 1 5 3 9 9 5 0 F O R M A T ( 1 X . F 1 0 . 3 , 1 X , 1 P D 1 4 . 5 , 1 X , 1 P D 1 4 . 5 , 1 X , 1 P D 1 4 . 5 , 1 5 4 0 1 X , 1 P D 1 4 . 5 , 1 X , 1 P D 1 4 . 5 , 1 X , 1 P D 1 4 . 5 , 2 X , - 1 P , F 1 0 . 3 , 1 5 4 1 5 X . F 1 0 . 5 ) 1 5 4 2 9 7 5 F O R M A T ( A 1 3 1 ) 1 5 4 3 C 1 5 4 4 E N D 1 5 4 5 c============================================================= 1 5 4 6 B L O C K D A T A E S R 1 D 1 5 4 7 c============================================================= 1 5 4 8 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 9 9 9 ) ' 1 5 4 9 D A T A R H O O / O . O D O / 1 5 5 0 D A T A I T , T I M E , I T H L / O , O . O D O , 0 / 1 5 5 1 D A T A K O , D T , C G S H L / 0 . 5 D 0 . 0 . 0 2 D 0 , 1 2 . 5 6 6 3 7 0 6 1 4 3 5 9 1 7 2 7 D 0 / 1 5 5 2 D A T A N G , A 1 , A 2 / 3 2 , O . O D O , O . O D O / 1 5 5 3 D A T A E O . WO / O . O D O , O . O D O / 1 5 5 4 D A T A I R H O , I R H O S , I P H I , I E , I X V X / 5 * 0 / 1 5 5 5 D A T A M P L O T / M M A X * 0 / 1 5 5 6 E N D 2 0 0 0 c============================================================! 2 0 0 1 C 2 0 0 2 S U B R O U T I N E C R E A T R ( V O . I L P , I U P , T E M P , O S T A R T ) 2 0 0 3 C 2 0 0 4 c============================================================: 2 0 0 5 C T h e V X a r r a y i s u s e d a s a d u m m y a r r a y f o r t h e t o t a l 2 0 0 6 C m o m e n t u m , P , a n d t h e t o t a l v e l o c i t y , V . 2 0 0 7 C 2 0 0 8 C N S T E P S 1 s t h e a v e r a g e n u m b e r o f I n t e g r a t i o n s t e p s 2 0 0 9 C p e r p a r t i c l e . 2 0 1 0 C 2 0 1 1 S I N S E R T ' : E S R 1 . I N S E R T ( 1 0 0 . 1 9 9 ) ' 2 0 1 2 $ I N S E R T ' : E S R 1 . I N S E R T ( 3 0 0 , 3 9 9 ) ' 2 0 1 3 L O G I C A L O S T A R T 2 0 1 4 C 2 0 1 5 C S t a t e m e n t f u n c t i o n d e f i n i t i o n s . 2 0 1 6 C - - - -2 0 1 7 F ( X d ) = C * D P 2 * E X P ( - S 0 R T ( 1 . 0 + D P 2 * X d * X J ) / T ) 2 0 1 8 G ( X J ) = C * D P 2 * E X P ( - O . 5 D 0 * D P 2 * X d * X d / T ) 2 0 1 9 C 2 0 2 0 I L = I L P 2 0 2 1 I U = I U P 2 0 2 2 I F ( I L . G E . I U . O R . T E M P . E Q . D Z E R O ) R E T U R N 2 0 2 3 T = T E M P 2 0 2 4 N F O U R = ( I U - I L + D / 4 2 0 2 5 N F O U R = N F 0 U R * 4 2 0 2 6 N = I U - I L + 1 2 0 2 7 N S T P M X = 1 0 0 0 0 0 0 2 0 2 8 N S T E P S = M I N ( 2 0 0 , N S T P M X / N ) 2 0 2 9 I F ( N S T E P S . L T . 2 ) N S T E P S = 2 2 0 3 0 C 2 0 3 1 C V e l o c i t i e s a r e I n u n i t s o f C a n d m o m e n t a I n u n i t s o f M C . 2 0 3 2 C 2 0 3 3 P M A X = 4 . O D O * S Q R T ( T + 4 . 0 * T * * 2 ) 2 0 3 4 D P = P M A X / ( N * N S T E P S ) 2 0 3 5 D P 2 = D P * * 2 2 0 3 6 P I = 0 . 5 D O * T W O P I 2 0 3 7 X J = 1 . 0 D 0 2 0 3 8 I = O N E 2 0 3 9 A I N T = D Z E R O 2 0 4 0 C 2 0 4 1 I F ( T . G T . 0 . 0 0 2 ) T H E N 2 0 4 2 C = 0 . 2 5 D 0 * N * E X P ( 1 . 0 D 0 / T ) / ( T + T * T ) 2 0 4 3 E L S E 2 0 4 4 C = 0 . 2 5 D 0 * N / ( T + T * T ) 2 0 4 5 E N D I F 2 0 4 6 C 2 0 4 7 I F ( T . G T . 0 . 0 0 2 ) T H E N 2 0 4 8 5 0 A I N T = A I N T + X d * F ( X d ) 2 0 4 9 1 4 = 4 * I + I L - 4 2 0 5 0 I F ( A I N T . G T . I ) V X ( I 4 ) = X d * D P 2 0 5 1 I F ( A I N T . G T . I ) 1 = 1 + 1 2 0 5 2 I F ( 4 * 1 . G T . N F O U R . O R . X d * D P . G T . P M A X ) GO T O 1 0 0 2 0 5 3 X d = X d + 1 . O D O 2 0 5 4 GO T O 5 0 2 0 5 5 E L S E 2 0 5 6 5 1 A I N T = A I N T + X d * G ( X d ) 2 0 5 7 1 4 = 4 * I + I L - 4 2 0 5 8 I F ( A I N T . G T . I ) V X ( I 4 ) = X d * D P 2 0 5 9 I F ( A I N T . G T . I ) 1 = 1 + 1 2 0 6 0 I F ( 4 * 1 . G T . N F O U R . O R . X d * D P . G T . P M A X ) GO T O 1 0 0 2 0 6 1 X d = X J + 1 . O D O 2 0 6 2 G O T O 5 1 2 0 6 3 E N D I F 2 0 6 4 C 2 0 6 5 1 0 0 C O N T I N U E 2 0 6 6 I F ( 4 * 1 . G T . N ) G O T O 1 7 0 2 0 6 7 I 4 = 4 * I + I L - 4 2 0 6 8 C 2 0 6 9 DO 1 5 0 K = I 4 , I U 2 0 7 0 1 5 0 V X ( K ) = D Z E R O IIS 2 0 7 1 2 0 7 2 2 0 7 3 2 0 7 4 2 0 7 5 2 0 7 6 2 0 7 7 2 0 7 8 2 0 7 9 2 0 8 0 2 0 8 1 2 0 B 2 2 0 8 3 2 0 8 4 2 0 8 5 2 0 8 6 2 0 8 7 2 0 8 8 2 0 8 9 2 0 9 0 2 0 9 1 2 0 9 2 2 0 9 3 2 0 9 4 2 0 9 5 2 0 9 6 2 0 9 7 2 0 9 8 2 0 9 9 2 1 0 0 2 1 0 1 2 1 0 2 2 1 0 3 2 1 0 4 2 1 0 5 2 1 0 6 2 1 0 7 2 1 0 8 2 1 0 9 2 1 1 0 2 1 1 1 2 1 1 2 2 1 1 3 2 1 1 4 2 1 1 5 2 1 1 6 2 1 1 7 2 1 1 8 2 1 1 9 2 1 2 0 2 1 2 1 2 1 2 2 2 1 2 3 2 1 2 4 2 1 2 5 2 1 2 6 2 1 2 7 2 1 2 8 2 1 2 9 2 1 3 0 2 1 3 1 2 1 3 2 2 1 3 3 2 1 3 4 2 1 3 5 2 1 3 6 2 1 3 7 2 1 3 8 2 1 3 9 2 1 4 0 1 7 0 1 8 0 2 0 0 2 0 1 3 0 0 3 0 1 3 0 2 4 0 0 C O N T I N U E I S D = 2 1 4 7 4 8 3 D O 1 8 0 I = I L , I U V X ( I ) = V X ( I ) / S O R T ( 1 . 0 D 0 + V X ( I ) * * 2 ) N F L = N F O U R - 4 I F ( O S T A R T DO 2 0 0 d = I T H E T A P X V X ( I ) V Y ( I ) V X ( 1 + 1 ) V Y ( 1 + 1 ) V X ( 1 + 2 ) V Y ( 1 + 2 ) V Y ( 1 + 3 ) V X ( 1 + 3 ) C O N T I N U E ) T H E N 1 , N F L , 4 = J - 1 + I L = R A D R E V ( d , 3 ) * T W 0 P I = V X ( I ) = P X * C O S ( T H E T A ) = P X * S I N ( T H E T A ) = - V X ( I ) = - V Y ( I ) = - V Y ( I ) = V X ( I ) = - V X ( I ) = V Y ( I ) I F ( N F O U R . E Q . N I L N F = I L + N F O U R DO 2 0 1 J = I L N F , I U V X ( J ) = D Z E R O V Y ( J ) = D Z E R O C O N T I N U E ) G O T O 3 0 2 E L S E ( 1 f n o t a q u i e t s t a r t . ) D O 3 0 O d = 1 , N F L , 4 T H E T A P X V X ( I ) V Y ( I ) V X ( 1 + 1 ) V Y ( 1 + 1 ) V X ( 1 + 2 ) V Y ( I + 2 ) V Y ( 1 + 3 ) V X ( I + 3 ) C O N T I N U E 0 - 1 + I L R A N ( I S D ) * 0 . 5 D 0 * P I V X ( I ) P X * C O S ( T H E T A ) P X * S I N ( T H E T A ) - V X ( I ) - V Y ( I ) - V Y ( I ) V X ( I ) - V X ( I ) V Y ( I ) GO T O 3 0 2 I F ( N F O U R . E Q . N ) I L N F . = I L + N F O U R DO 3 0 1 <J = I L N F , I U V X ( J ) = D Z E R O V Y ( J ) = D Z E R O C O N T I N U E E N D I F C O N T I N U E V Y M A X = P M A X / S Q R T ( 1 . 0 D 0 + P M A X * * 2 ) V X M A X = ( V O + V Y M A X ) / ( 1 . O D O - V O * V Y M A X ) G M = S O R T ( 1 . 0 D 0 - V O * V O ) V Y M A X = G M * V Y M A X / ( 1 . 0 D 0 - V O * V Y M A X ) DO 4 0 0 I = I L , I U V Y ( I ) = G M * V Y ( I ) / ( 1 . 0 D 0 + V 0 * V X ( I ) ) V X ( I ) = ( V X ( I ) + V O ) / ( 1 . 0 D 0 + V O * V X ( I ) ) C O N T I N U E R E T U R N E N D 3 0 0 1 C 3 0 0 2 S U B R O U T I N E S E T R H O ( I L . I U . 0 ) 3 0 0 3 C 3 0 0 4 C============================================================= 3 0 0 5 C A c c u m u l a t e s c h a r g e d e n s i t y . 3 0 0 6 C 3 0 0 7 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 . 3 9 9 ) ' 3 0 0 8 C 3 0 0 9 I F ( I L . G T . I U ) R E T U R N 3 0 1 0 C 3 0 1 1 Q D X = 0 / D X 3 0 1 2 D X I = 1 . O D O / D X 3 0 1 3 X N = N G 3 0 1 4 C 3 0 1 5 C I f I t I s t h e f i r s t g r o u p o f p a r t i c l e s t h e n c l e a r R H O . 3 0 1 6 C «-3 0 1 7 I F ( I L . E O . 1 ) T H E N 3 0 1 8 DO 1 J = 1 . N G 3 0 1 9 1 R H O ( J ) = R H O O 3 0 2 0 R H 0 ( N G + 1 ) = D Z E R O 3 0 2 1 E N D I F 3 0 2 2 C - -3 0 2 3 C L i n e a r . 3 0 2 4 C 3 0 2 5 DO 1 0 I = I L , I U 3 0 2 6 X ( I ) = X ( I ) » D X I 3 0 2 7 C 3 0 2 8 I F ( X ( I ) . L T . D Z E R O ) X ( I ) « X ( I ) + X N 3 0 2 9 I F ( X ( I ) . G E . X N ) X ( I ) = X ( I ) - X N 3 0 3 0 C 3 0 3 1 J = X ( I ) 3 0 3 2 D R H O = Q D X * ( X ( I ) - J ) 3 0 3 3 R H 0 ( J + 1 ) = R H 0 ( d + 1 ) - D R H O + Q D X 3 0 3 4 R H 0 ( J + 2 ) = R H 0 ( J + 2 ) + D R H O 3 0 3 5 1 0 C O N T I N U E 3 0 3 6 C 3 0 3 7 R E T U R N 3 0 3 8 E N D 4 0 0 0 c========= =============================================== 4 0 0 1 C 4 0 0 2 S U B R O U T I N E F I E L D S ( I T H ) 4 0 0 3 C 4 0 0 4 c============================================================= 4 0 0 5 C S o l v e s f o r P H I a n d E , c o m p u t e s f i e l d e n e r g y , e t c . 4 0 0 6 C 4 0 0 7 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 . 2 9 9 ) ' 4 0 0 8 $ I N S E R T ' E S R 1 . I N S E R T ( 4 0 0 , 5 9 9 ) ' 4 0 0 9 S I N S E R T ' E S R 1 . I N S E R T ( 7 0 0 . 7 9 9 ) ' 4 0 1 0 D O U B L E P R E C I S I O N R H 0 K ( 1 ) , P H I K ( 1 ) . S C R A C H ( 1 ) , E K ( 2 5 7 ) 4 0 1 1 E Q U I V A L E N C E ( R H O , R H O K ) , ( P H I . P H I K ) . ( E , S C R A C H ) 4 0 1 2 P A R A M E T E R ( N G 2 M = N G M A X / 2 ) 4 0 1 3 D O U B L E P R E C I S I O N K D X 2 . K S Q I ( N G 2 M ) , L I , S M ( N G 2 M ) 4 0 1 4 . P I = 4 . 0 * A T A N ( 1 . 0 ) 4 0 1 5 H D X = 0 . 5 D 0 * D X 4 0 1 6 H D X I = 0 . 5 D 0 / D X 4 0 1 7 L I = 1 . O D O / L 4 0 1 8 N G 1 = N G + 1 4 0 1 9 C 4 0 2 0 C F i r s t t i m e s t e p d u t i e s . 4 0 2 1 C 4 0 2 2 D A T A N G 2 / O / 4 0 2 3 I F ( N G 2 . E Q . O ) T H E N 4 0 2 4 N G 2 = N G / 2 4 0 2 5 C -4 0 2 6 C S e t u p r a t i o P H I K / R H O K . 4 0 2 7 C A 2 > O g i v e s a s h o r t - w a v e l e n g t h c u t o f f ( s m o o t h i n g ) . 4 0 2 8 C A 1 > 0 g i v e s a m i d - r a n g e b o o s t t o c o m p e n s a t e f o r 4 0 2 9 C s l i g h t a t t e n u a t i o n I n f o r c e c a l c u l a t i o n . 4 0 3 0 C 4 0 3 1 DO 1 K = 1 . N G 2 4 0 3 2 K D X 2 = ( P I / N G ) * K 4 0 3 3 S M ( K ) = E X P ( A 1 * S I N ( K D X 2 ) * * 2 - A 2 * T A N ( K D X 2 ) * * 4 ) 4 0 3 4 K S O I ( K ) = + C G S H L / ( ( 2 . 0 * S I N ( K D X 2 ) / D X ) * * 2 ) * S M ( K ) * * 2 4 0 3 5 1 C O N T I N U E 4 0 3 6 E N D I F 4 0 3 7 C 4 0 3 8 C T r a n s f o r m c h a r g e d e n s i t y . 4 0 3 9 C 4 0 4 0 R H 0 ( 1 ) = R H O ( 1 ) + R H O ( N G 1 ) 4 0 4 1 R H 0 ( N G 1 ) = R H O ( 1 ) 4 0 4 2 C 4 0 4 3 C S a v e c h a r g e d e n s i t y v a l u e s . 4 0 4 4 C . 4 0 4 5 I F ( I R H O . N E . Z E R O ) T H E N 4 0 4 6 I F ( ( I T H / I R H O ) * I R H O . E Q . I T H ) T H E N 4 0 4 7 W R I T E H 2 ) ( R H O ( J ) , J = 1 . N G 1 ) 4 0 4 8 E N D I F 4 0 4 9 E N D I F 4 0 5 0 C 4 0 5 1 DO 1 0 J = 1 . N G 4 0 5 2 R H O K ( J ) = R H O ( J ) * H D X 4 0 5 3 S C R A C H ( d ) = D Z E R O 4 0 5 4 1 0 C O N T I N U E 4 0 5 5 C 4 0 5 6 C A L L C P F T ( R H O K , S C R A C H , N G , O N E , O N E ) 4 0 5 7 C A L L R P F T 2 ( R H O K , S C R A C H , N G , O N E ) 4 0 5 8 R H D K ( 1 ) = D Z E R O 4 0 5 9 C - -4 0 6 0 C C a l c u l a t e P H I K a n d f i e l d e n e r g y . 4 0 6 1 C " 4 0 6 2 E S E S = D Z E R O 4 0 6 3 P H I K ( 1 ) = D Z E R O 4 0 6 4 C 4 0 6 5 DO 2 0 K = 2 . N G 2 4 0 6 6 K K = N G + 2 - K 4 0 6 7 P H I K ( K ) = K S Q K K - 1 ) * R H O K ( K ) 4 0 6 8 P H I K ( K K ) «= K S Q K K - 1 ) * R H O K ( K K ) 4 0 6 9 E K ( K ) = R H O K ( K ) * P H I K ( K ) + R H O K ( K K ) * P H I K ( K K ) 4 0 7 0 E S E S = E S E S + E K ( K ) 4 0 7 1 E K ( K ) = E K ( K ) * R N M 1 C 2 / L 4 0 7 2 R H O K ( K ) = S M ( K - 1 ) * R H O K ( K ) 4 0 7 3 R H O K ( K K ) = S M ( K - 1 ) * R H O K ( K K ) 4 0 7 4 2 0 C O N T I N U E 4 0 7 5 C 4 0 7 6 P H I K ( N G 2 + 1 ) = K S Q I ( N G 2 ) * R H 0 K ( N G 2 + 1 ) 4 0 7 7 E S E ( I T H + 1 ) = ( 2 . 0 D 0 * E S E S + R H O K ( N G 2 + 1 ) * P H I K ( N G 2 + 1 ) ) 4 0 7 8 / ( 2 . 0 D 0 * L ) * R N M 1 C 2 4 0 7 9 E K ( N G 2 + 1 ) = R H O K ( N G 2 + 1 ) * P H I K ( N G 2 + 1 ) * R N M 1 C 2 / ( 2 . O D O * L ) 4 0 8 0 E K ( 1 ) = O . O D O 4 0 8 1 R H O K ( N G 2 + 1 ) = S M ( N G 2 ) * R H 0 K ( N G 2 + 1 ) 4 0 8 2 C 4 0 8 3 C S a v e s p e c i f i e d m o d e e n e r g i e s . 4 0 8 4 C 4 0 8 5 DO 2 1 K M = 1 , M M A X 4 0 8 6 K = M P L 0 T ( K M ) + 1 4 0 8 7 I F ( K . E Q . 1 ) GO T O 2 2 4 0 8 8 K K = N G + 2 - K 4 0 8 9 E S E M ( I T H + 1 , K M ) = ( R H O K ( K ) * P H I K ( K ) + 4 0 9 0 R H O K ( K K ) * P H I K ( K K ) ) * R N M 1 C 2 / L 4 0 9 1 I F ( K . E Q . K K ) E S E M ( I T H + 1 , K M ) = 0 . 2 5 * E S E M ( I T H + 1 , K M ) 4 0 9 2 2 1 C O N T I N U E 4 0 9 3 2 2 C O N T I N U E 4 0 9 4 C 4 0 9 5 C I n v e r s e t r a n s f o r m P H I . 4 0 9 6 C 4 0 9 7 DO 3 0 K = 1 , N G 4 0 9 8 R H O ( K ) = R H O K ( K ) * L I 4 0 9 9 P H I ( K ) = P H I K ( K ) * L I 4 1 0 0 3 0 C O N T I N U E 4 1 0 1 C 4 1 0 2 C A L L R P F T I 2 ( P H I , R H O , N G , O N E ) 4 1 0 3 C A L L C P F T ( P H I . R H O , N G , O N E . - O N E ) 4 1 0 4 P H I ( N G 1 ) = P H I ( 1 ) 4 1 0 5 R H 0 ( N G 1 ) = R H O ( 1 ) 4 1 0 6 C 4 1 0 7 C S a v e s m o o t h e d c h a r g e d e n s i t y a n d e l e c t r i c p o t e n t i a l . 4 1 0 8 C 4 1 0 9 I F ( I R H O S . N E . Z E R O ) T H E N 4 1 1 0 I F ( ( I T H / I R H O S ) * I R H O S . E O . I T H ) T H E N 4 1 1 1 W R I T E C 1 2 ) ( R H O ( J ) , J = 1 . N G 1 ) 4 1 1 2 E N D I F 4 1 1 3 E N D I F 4 1 1 4 C 4 1 1 5 I F ( I P H I . N E . Z E R O ) T H E N 4 1 1 6 I F ( ( I T H / I P H I ) * I P H I . E O . I T H ) T H E N 4 1 1 7 W R I T E ( 1 2 ) ( P H I ( J ) , J = 1 . N G 1 ) 4 1 1 8 E N D I F 4 1 1 9 E N D I F 4 1 2 0 C 4 1 2 1 C U n i f o r m f i e l d . 4 1 2 2 C 4 1 2 3 E O T = E O * C 0 S ( W O * T I M E ) 4 1 2 4 C 4 1 2 5 C C e n t e r e d d i f f e r e n c e a c r o s s 2 c e l l s . 4 1 2 6 C 4 1 2 7 DO 1 0 1 J = 2 , N G 4 1 2 8 E ( J ) = ( P H I ( d - 1 ) - P H I ( J + 1 ) ) * H D X I + E O T 4 1 2 9 1 0 1 C O N T I N U E 4 1 3 0 E ( 1 ) = ( P H I ( N G ) - P H I ( 2 ) ) * H D X I + E O T 4 1 3 1 E ( N G 1 ) = E ( 1 ) 4 1 3 2 C 4 1 3 3 C S a v e e l e c t r i c f i e l d v a l u e s . 4 1 3 4 C 4 1 3 5 I F ( I E . N E . Z E R O ) T H E N 4 1 3 6 I F ( ( I T H / I E ) * I E . E O . I T H ) T H E N 4 1 3 7 W R I T E ( 1 2 ) ( E ( d ) , 0 = 1 . N G 1 ) 4 1 3 8 E N D I F 4 1 3 9 E N D I F 4 1 4 0 C - - - - -4 1 4 1 C S a v e e l e c t r o s t a t i c e n e r g y s p e c t r u m k - s p a c e m o d e s . 4 1 4 2 C - - - -4 1 4 3 I F ( I S P E C . N E . Z E R O ) T H E N 4 1 4 4 I F ( ( I T H / I S P E C ) * I S P E C . E O . I T H ) T H E N 4 1 4 5 N G 2 P = N G 2 + 1 4 1 4 6 W R I T E ( 1 2 ) ( E K ( J ) , J = 1 . N G 2 P ) 4 1 4 7 E N D I F 4 1 4 8 E N D I F 4 1 4 9 C 4 1 5 0 C E l e c t r i c f i e l d h a s n o t b e e n n o r m a l i z e d y e t . 4 1 5 1 C 4 1 5 2 A E L = 1 . O D O 4 1 5 3 C 4 1 5 4 R E T U R N 4 1 5 5 E N D I If 5 0 0 0 c========================================================= 5 0 0 1 C 5 0 0 2 S U B R O U T I N E S E T V ( I L , I U , 0 , M . T T , P X , P Y , V L I G H T ) 5 0 0 3 C 5 0 0 4 c========================================================= 5 0 0 5 C C o n v e r t s p a r t i c l e v e l o c i t i e s a t t = 0 t o t = - D T / 2 . 5 0 0 6 C - - -5 0 0 7 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 3 9 9 ) ' 5 0 0 8 $ I N S E R T ' E S R 1 . I N S E R T ( 8 0 0 , 8 9 9 ) ' 5 0 0 9 D O U B L E P R E C I S I O N M 5 0 1 0 I F ( I L . G T . I U ) R E T U R N 5 0 1 1 T = T T 5 0 1 2 C D T D X = D T / D X 5 0 1 3 C 5 0 1 4 C R o t a t e V t h r u a n g l e + 0 . 5 * W C * D T ( n o n - r e l ) a n d n o r m a l i z e 5 0 1 5 C V Y . I f T = 0 , t h e r e 1 s n o m a g n e t i c f i e l d . T h e 5 0 1 6 C r o t a t i o n 1 s o m i t t e d a n d n o r e f e r e n c e s a r e m a d e 5 0 1 7 C t o V Y . 5 0 1 8 C 5 0 1 9 I F ( T . N E . D Z E R O ) T H E N 5 0 2 0 T = T A N ( T ) 5 0 2 1 C = 1 . 0 D 0 / S Q R T ( 1 . 0 D 0 + T * T ) 5 0 2 2 S = C * T 5 0 2 3 C 5 0 2 4 DO 1 I = I L , I U 5 0 2 5 V X X = V X ( I ) 5 0 2 6 V X ( I ) = C * V X X - S * V Y ( I ) 5 0 2 7 V Y ( I ) = S * V X X + C * V Y ( I ) 5 0 2 8 1 C O N T I N U E 5 0 2 9 E N D I F 5 0 3 0 C 5 0 3 1 C O n l y e l e c t r o n s a r e t r e a t e d r e l a t 1 v 1 s t 1 c a l 1 y . 5 0 3 2 C 5 0 3 3 I F ( A B S ( 0 / M ) . G E . 0 . 2 D 0 ) T H E N 5 0 3 4 DO 9 9 I = I L . I U 5 0 3 5 V 2 = V X ( I ) * V X ( I ) + V Y ( I ) * V Y ( I ) 5 0 3 6 C V X ( I ) = V X ( I ) * V L I G H T * D T D X 5 0 3 7 C V Y ( I ) = V Y ( I ) * V L I G H T * D T D X 5 0 3 8 G A M M A ( I ) = 1 . O D O / S O R T ( 1 . O D O - V 2 ) 5 0 3 9 9 9 C O N T I N U E 5 0 4 0 E N D I F 5 0 4 1 C 5 0 4 2 C E l e c t r i c i m p u l s e t o g o b a c k 1 / 2 t i m e s t e p . 5 0 4 3 C 5 0 4 4 D A T A D U M 1 , D U M 2 . D U M 3 / O . O D O , O . O D O , O . O D O / 5 0 4 5 0 0 0 = - 0 . 5 D 0 * 0 5 0 4 6 C A L L A C C E L ( I L . I U , 0 0 0 , M , D U M 1 , P X , P Y , D U M 2 , D U M 3 , V L I G H T ) 5 0 4 7 C 5 0 4 8 R E T U R N 5 0 4 9 E N D 6 0 0 0 C = 6 0 0 1 C 6 0 0 2 S U B R O U T I N E A C C E L ( I L P , I U P , 0 , M . T T , P X , P Y , T H E R M T , K E , V L I G H T ) 6 0 0 3 C 6 0 0 4 -6 0 0 5 c A d v a n c e s v e l o c i t y o n e t i m e s t e p , c o m p u t e s m o m e n t u m a n d 6 0 0 6 c k i n e t i c e n e r g y . 6 0 0 7 6 0 0 8 S I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 4 9 9 ) ' 6 0 0 9 S I N S E R T ' E S R 1 . I N S E R T ( 6 0 0 , 9 9 9 ) ' 6 0 1 0 D O U B L E P R E C I S I O N M , M C 2 , N R K E , N O N R E L 6 0 1 1 D O U B L E P R E C I S I O N A ( N G 1 M ) 6 0 1 2 E Q U I V A L E N C E ( A . E ) 6 0 1 3 C V L I T E 2 = ( V L I G H T * V L I G H T ) 6 0 1 4 C 6 0 1 5 I L = I L P 6 0 1 6 I U = I U P 6 0 1 7 N G 1 = N G + 1 6 0 1 8 I F ( I L . G T . I U ) R E T U R N 6 0 1 9 C 6 0 2 0 DO 1 0 0 «J = 1 . N G 1 6 0 2 1 T H R M X 1 ( J ) = D Z E R O 6 0 2 2 N ( d ) = 0 6 0 2 3 V X O S C ( J ) = D Z E R O 6 0 2 4 V Y O S C ( J ) = D Z E R O 6 0 2 5 1 0 0 C O N T I N U E 6 0 2 6 6 0 2 7 C R e n o r m a l i z e a c c e l e r a t i o n i f n e e d b e . 6 0 2 8 6 0 2 9 D X D T •= D X / D T 6 0 3 0 A E = 0 . 5 D 0 * ( Q / M ) * ( D T / D X D T ) 6 0 3 1 I F ( A E . N E . A E L ) T H E N 6 0 3 2 T E M = A E / A E L 6 0 3 3 DO 1 J = 1 , N G 1 6 0 3 4 A ( J ) = A ( d ) * T E M 6 0 3 5 1 C O N T I N U E 6 0 3 6 A E L = A E 6 0 3 7 E N D I F 6 0 3 8 C 6 0 3 9 I F ( I L . E Q . 1 ) K E = D Z E R O 6 0 4 0 I F ( A B S ( Q / M ) . L T . 0 . 1 D 0 ) GO T O 5 6 0 4 1 6 0 4 2 C L i n e a r , m o m e n t u m c o n s e r v i n g . I n c l u d e s m a g n e t i c f i e l d 6 0 4 3 C a n d r e l a t i v i s t i c e l e c t r o n s . 6 0 4 4 c-6 0 4 5 RELKE<= D Z E R O 6 0 4 6 N R K E = D Z E R O 6 0 4 7 6 0 4 8 C H a l f a c c e l t w o - s t e p r o t ' n m e t h o d w i t h q u i c k r o t ' n s c h e m e . 6 0 4 9 _ 6 0 5 0 DO 2 5 0 I = I L , I U 6 0 5 1 d = X ( I ) 6 0 5 2 X X = X ( I ) - d 6 0 5 3 T = T T 6 0 5 4 A A = A ( d + 1 ) + X X * ( A ( d + 2 ) - A ( J + 1 ) ) 6 0 5 5 G V X X = V X ( I ) * G A M M A ( I ) + A A 6 0 5 6 G V Y Y = V Y ( I ) * G A M M A ( I ) 6 0 5 7 G V 2 = G V X X * G V X X + G V Y Y * G V Y Y 6 0 5 8 G A M M A 2 = 1 . O D O + G V 2 6 0 5 9 G A M M A 1 = S O R T ( G A M M A 2 ) 6 0 6 0 T = T A N ( T / G A M M A 1 ) 6 0 6 1 S = ( T + T ) / ( 1 . O D O + T * T ) 6 0 6 2 R E L K E = R E L K E + ( G A M M A 1 - 1 . O D O ) * M 6 0 6 3 N R K E = N R K E + 0 . 5 D O * M * G V 2 / G A M M A 2 6 0 6 4 G V X X = G V X X + T * G V Y Y 6 0 6 5 G V Y Y = G V Y Y - S * G V X X 6 0 6 6 G V X = G V X X + T * G V Y Y + A A 6 0 6 7 G V Y = G V Y Y 6 0 6 8 G V 2 = G V X * G V X + G V Y ' G V Y 6 0 6 9 G A M M A ( I ) = S Q R T ( 1 . 0 D 0 + G V 2 ) 6 0 7 0 V X ( I ) = G V X / G A M M A ( I ) 6 0 7 1 V Y ( I ) = G V Y / G A M M A ( I ) 6 0 7 2 P Y = P Y + G V Y 6 0 7 3 P X = P X + G V X 6 0 7 4 K = X ( I ) + 0 . 5 D 0 6 0 7 5 N ( K + 1 ) = N ( K + 1 ) + 1 6 0 7 6 V X 0 S C ( K + 1 ) = V X 0 S C ( K + 1 ) + V X ( I ) 6 0 7 7 V Y 0 S C ( K + 1 ) = V Y 0 S C ( K + 1 ) + V Y ( I ) 6 0 7 8 2 5 0 C O N T I N U E 6 0 7 9 C 6 0 8 0 N ( N G 1 ) = N ( 1 ) + N ( N G 1 ) 6 0 8 1 N ( 1 ) = N ( N G 1 ) 6 0 8 2 V X O S C ( N G I ) = V X 0 S C ( 1 ) + V X 0 S C ( N G 1 ) 6 0 8 3 V X 0 S C ( 1 ) = V X O S C ( N G I ) 6 0 8 4 V Y O S C ( N G I ) = V Y 0 S C ( 1 ) + V Y 0 S C ( N G 1 ) 6 0 8 5 V Y 0 5 C ( 1 ) = V Y O S C ( N G I ) 6 0 8 6 K E = K E + M A X ( R E L K E , N R K E ) 6 0 8 7 C 6 0 8 8 C D r i f t m o m e n t u m p e r u n i t m a s s i n u n i t s o f C . 6 0 8 9 C 6 0 9 0 P Y = P Y / ( I U - I L + 1 ) 6 0 9 1 P X = P X / U U - I L + 1 ) 6 0 9 2 I F ( I T H E R M . L E . O ) GO T O 3 6 0 9 3 I F ( ( I T / I T H E R M ) * I T H E R M . N E . I T ) GO T O 3 6 0 9 4 V P L A S = D Z E R O 6 0 9 5 C 6 0 9 6 DO 3 0 0 J = 1 , N G 1 6 0 9 7 I F ( N ( J ) . E Q . 0 ) G O T O 3 0 0 6 0 9 8 V X O S C ( J ) = V X O S C ( J ) / N ( J ) 6 0 9 9 V Y O S C ( O ) = V Y O S C ( d ) / N ( J ) 6 1 0 0 C V P L A S = V P L A S + V X O S C ( J ) / N G 1 6 1 0 1 3 0 0 C O N T I N U E 6 1 0 2 C 6 1 0 3 D O 3 5 0 I = I L . I U 6 1 0 4 K = X ( I ) + 0 . 5 D 0 6 1 0 5 C V X 0 S C ( K + 1 ) = V X 0 S C ( K + 1 ) - V P L A S 6 1 0 6 G G = 1 . 0 D 0 / S O R T ( 1 . 0 D 0 - ( V X O S C ( K + 1 ) * V X O S C ( K + 1 ) ) 6 1 0 7 - ( V Y 0 S C ( K + 1 ) * V Y 0 S C ( K + 1 ) ) ) 6 1 0 8 C -6 1 0 9 C R e l a t i v i s t i c c a l c u l a t i o n . N o n - r e l a t 1 v 1 s t i c a l 1 y c o r r e c t . 6 1 1 0 C 6 1 1 1 P Y T H R M = V Y ( I ) * G A M M A ( I ) 6 1 1 2 P X T H R M = V X ( I ) * G A M M A ( I ) 6 1 1 3 P X S Q = G G * V X 0 S C ( K + 1 ) * G G * V X 0 S C ( K + 1 ) 6 1 1 4 P Y S Q = G G * V Y 0 S C ( K + 1 ) * G G * V Y 0 S C ( K + 1 ) 6 1 1 5 C 6 1 1 6 C R e l . K E d e f i n e d a s K E ( a v g . m o t i o n + j i g g l e ) - K E ( a v g . m o t i o n ) : 6 1 1 7 C 6 1 1 8 R E L T = S O R T ( 1 . 0 D 0 + P X T H R M * P X T H R M 6 1 1 9 + P Y T H R M * P Y T H R M ) 6 1 2 0 - S O R T ( 1 . 0 D 0 + P X S O + P Y S O ) 6 1 2 1 R E L T = . 5 1 1 0 0 4 1 D 0 6 * R E L T 6 1 2 2 C -6 1 2 3 C N o n - r e l a t i v i s t i c c a l c u l a t i o n . 6 1 2 4 C 6 1 2 5 V X T H R M = V X ( I ) - V X 0 S C ( K + 1 ) 6 1 2 6 V Y T H R M = V Y ( I ) - V Y 0 S C ( K + 1 ) 6 1 2 7 N O N R E L = . 5 D 0 * . 5 1 1 0 0 4 1 D 0 6 * ( V X T H R M * V X T H R M + V Y T H R M * V Y T H R M ) 6 1 2 8 T E M P P = M A X ( R E L T , N O N R E L ) 6 1 2 9 T H E R M T = T H E R M T + T E M P P / ( I U - I L + 1 ) 6 1 3 0 T H R M X 1 ( K + 1 ) = T H R M X 1 ( K + 1 ) + T E M P P / N ( K + 1 ) 6 1 3 1 3 5 0 C O N T I N U E 6 1 3 2 T H R M X 1 ( N G 1 ) = T H R M X 1 ( 1 ) + T H R M X 1 ( N G 1 ) 6 1 3 3 T H R M X 1 ( 1 ) = T H R M X 1 ( N G 1 ) 6 1 3 4 C 6 1 3 5 C S a v e e l e c t r o n t e m p e r a t u r e p r o f i l e . 6 1 3 6 C 6 1 3 7 W R I T E ( 1 2 ) ( T H R M X 1 ( J ) , J = 1 , N G 1 ) 6 1 3 8 G O T O 3 6 1 3 9 C 6 1 4 0 5 C O N T I N U E Ill 6 1 4 1 C -6 1 4 2 C I O N S : 6 1 4 3 C L i n e a r , m o m e n t u m c o n s e r v i n g . I n c l u d e s m a g n e t i c f i e l d . 6 1 4 4 C N o n - r e l a t 1 v i s t 1 c . 6 1 4 5 6 1 4 6 V 1 X S = D Z E R O 6 1 4 7 V 1 Y S = D Z E R O 6 1 4 8 V 2 S = D Z E R O 6 1 4 9 6 1 5 0 c H a l f a c c e l t w o - s t e p r o t a t i o n s c h e m e w i t h q u i c k ( B u n e m a n ) 6 1 5 1 c r o t a t i o n . 6 1 5 2 6 1 5 3 D O 2 5 1 I = I L . I U 6 1 5 4 0 = X ( I ) 6 1 5 5 X X = X ( I ) - d 6 1 5 6 T = T A N ( T T ) 6 1 5 7 S = ( T + T ) / ( 1 . O D O + T * T ) 6 1 5 8 A A = A ( d + 1 ) + X X * ( A ( d + 2 ) - A ( d + 1 ) ) 6 1 5 9 V X X = V X ( I ) + A A 6 1 6 0 V Y Y = V Y ( I ) 6 1 6 1 V 2 S = V 2 S + V X X * V X X + V Y Y * V Y Y 6 1 6 2 V X X = V X X + T * V Y Y 6 1 6 3 V Y Y = V Y Y - S * V X X 6 1 6 4 V X ( I ) = V X X + T * V Y Y + A A 6 1 6 5 V Y ( I ) = V Y Y 6 1 . 6 6 K = X ( I ) + 0 . 5 D 0 6 1 6 7 N ( K + 1 ) = N ( K + 1 ) + 1 6 1 6 8 V X 0 S C ( K + 1 ) = V X O S C ( K - M ) + V X ( I ) 6 1 6 9 V Y 0 S C ( K + 1 ) = V Y 0 S C ( K + 1 ) + V Y ( I ) 6 1 7 0 V 2 S X ( K + 1 ) = V 2 S X ( K + 1 ) + V X ( I ) * V X ( I ) + V Y ( I ) * V Y ( I ) 6 1 7 1 V 1 X S = V 1 X S + V X ( I ) 6 1 7 2 V 1 Y S = V 1 Y S + V Y ( I ) 6 1 7 3 2 5 1 C O N T I N U E 6 1 7 4 c 6 1 7 5 N ( N G 1 ) = N ( 1 ) + N ( N G 1 ) 6 1 7 6 N ( 1 ) = N ( N G 1 ) 6 1 7 7 V X O S C ( N G I ) = V X O S C O ) + V X O S C ( N G I ) 6 1 7 8 V X 0 S C ( 1 ) = V X O S C ( N G I ) 6 1 7 9 V Y O S C ( N G I ) = V Y 0 S C ( 1 ) + V Y O S C ( N G I ) 6 1 8 0 V Y O S C ( 1 ) = V Y 0 S C ( N G 1 ) 6 1 8 1 V 2 S X ( N G 1 ) = V 2 S X ( 1 ) + V 2 S X ( N G 1 ) 6 1 8 2 V 2 S X ( 1 ) = V 2 S X ( N G 1 ) 6 1 8 3 c 6 1 8 4 I F ( I T H E R M . L E . 0 ) GO T O 4 6 1 8 5 I F ( ( I T / I T H E R M ) * I T H E R M . N E . I T ) GO T O 4 6 1 8 6 T H E R M T = D Z E R O 6 1 8 7 c 6 1 8 8 DO 4 0 0 0 = 1 . N G 6 1 8 9 I F ( N(«J) . E O . 0 ) G O T O 4 0 0 6 1 9 0 V 2 S 0 S C = ( V X O S C ( d ) * V X O S C ( J ) + V Y O S C ( d ) * V Y O S C ( d ) ) / N ( d ) 6 1 9 1 T H R M X 2 ( J ) = 0 . 5 D 0 * M 2 C 2 E V * ( V 2 S X ( d ) - V 2 S 0 S C ) 6 1 9 2 T H E R M T = T H E R M T + T H R M X 2 ( d ) / ( I U - I L + 1 ) 6 1 9 3 T H R M X 2 ( d ) = T H R M X 2 ( d ) / N ( J ) 6 1 9 4 4 0 0 C O N T I N U E 6 1 9 5 T H R M X 2 ( N G 1 ) = T H R M X 2 ( 1 ) 6 1 9 6 c-6 1 9 7 c S a v e s p e c i e s 2 t e m p e r a t u r e p r o f i l e . 6 1 9 8 c-6 1 9 9 W R I T E ( 1 2 ) ( T H R M X 2 ( d ) , d = 1 . N G 1 ) 6 2 0 0 c 6 2 0 1 4 C O N T I N U E 6 2 0 2 K E = K E + 0 . 5 D 0 * M * V 2 S 6 2 0 3 c-6 2 0 4 c D r i f t m o m e n t u m p e r u n i t m a s s 1 n u n i t s o f C . 6 2 0 5 6 2 0 6 P X = V 1 X S / ( I U - I L + 1 ) 6 2 0 7 P Y = V 1 Y S / ( I U - I L + 1 ) 6 2 0 8 3 C O N T I N U E 6 2 0 9 c 6 2 1 0 R E T U R N 6 2 1 1 E N D I 7 0 0 0 7 0 0 1 7 0 0 2 7 0 0 3 7 0 0 4 7 0 0 5 7 0 0 6 7 0 0 7 7 0 0 8 7 0 0 9 7 0 1 0 7 0 1 1 7 0 1 2 7 0 1 3 7 0 1 4 7 0 1 5 7 0 1 6 7 0 1 7 7 0 1 8 7 0 1 9 7 0 2 0 7 0 2 1 7 0 2 2 7 0 2 3 7 0 2 4 7 0 2 5 7 0 2 6 7 0 2 7 7 0 2 8 7 0 2 9 7 0 3 0 7 0 3 1 7 0 3 2 7 0 3 3 7 0 3 4 7 0 3 5 7 0 3 6 7 0 3 7 7 0 3 8 7 0 3 9 7 0 4 0 7 0 4 1 7 0 4 2 7 0 4 3 7 0 4 4 8 0 0 0 8 0 0 1 8 0 0 2 8 0 0 3 8 0 0 4 8 0 0 5 8 0 0 6 8 0 0 7 8 0 0 8 8 0 0 9 8 0 1 0 8 0 1 1 8 0 1 2 8 0 1 3 8 0 1 4 8 0 1 5 8 0 1 6 8 0 1 7 8 0 1 8 8 0 1 9 8 0 2 0 8 0 2 1 8 0 2 2 8 0 2 3 8 0 2 4 8 0 2 5 S U B R O U T I N E M O V E ( I L P , I U P , 0 ) A d v a n c e s p o s i t i o n o n e t 1 m e s t e p a n d a c c u m u l a t e s c h a r g e d e n s i t y . c c c c c c c S I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 3 9 9 ) ' S I N S E R T ' E S R 1 . I N S E R T ( 8 0 0 , 8 9 9 ) ' C I L = I L P I U = I U P I F ( I L . G T . I U ) R E T U R N O D X = O / D X X N = N G N G 1 = N G + 1 113 I f 1 t 1 s t h e f i r s t g r o u p o f p a r t i c l e s t h e n c l e a r R H O . I F ( I L . E O . 1 ) T H E N DO 1 J = 1 , N G R H O ( J ) = R H O O 1 C O N T I N U E R H 0 ( N G + 1 ) = D Z E R O E N D I F DO 2 I = I L , I U L i n e a r w e i g h t i n g u s i n g o l d p o s i t i o n s . X ( I ) = X ( I ) + V X ( I ) I F ( X ( I ) . L T . D Z E R O ) X ( I ) = X ( I ) + X N I F ( X ( I ) . G E . X N ) X ( I ) = X ( I ) - X N L i n e a r w e i g h t i n g u s i n g n e w p o s 1 1 i o n s . J = X ( I ) D R H O = O D X * ( X ( I ) - J ) R H 0 ( d + 1 ) = R H 0 ( d + 1 ) - D R H O + O D X R H 0 ( d + 2 ) = R H 0 ( J + 2 ) + D R H O 2 C O N T I N U E R E T U R N E N D S U B R O U T I N E R I T E R 1 ( N T H , M M A X , R S T A R T , I R D A T E , I R T I M E , M O D E , A T I T L E , N T , N P , V L I G H T , K O ) I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 2 9 9 ) ' I N S E R T ' E S R 1 . I N S E R T ( 4 0 0 , 4 9 9 ) ' I N S E R T ' E S R 1 . I N S E R T ( 6 0 0 , 7 9 9 ) ' D O U B L E P R E C I S I O N K O L O G I C A L R S T A R T C H A R A C T E R * 1 3 1 A T I T L E W R I T E ( 7 , 1 1 0 ) W R I T E ( 7 , 1 2 0 ) W R I T E ( 7 , 4 4 0 ) A T I T L E W R I T E ( 7 , 1 0 0 ) I F ( R S T A R T ) T H E N W R I T E ( 7 , 1 3 0 ) I R T I M E , E N D I F I R D A T E W R I T E ( 7 , 1 6 0 ) I T I M E , R M 1 C 2 I W R I T E ( 7 , 1 5 0 ) I D A T E , R N M 1 C 2 W R I T E ( 7 , 2 0 0 ) L . R M 2 C 2 I W R I T E ( 7 , 2 1 0 ) N T , R N M 2 C 2 W R I T E ( 7 , 2 2 0 ) D T , M 2 C 2 E V 8 0 2 6 8 0 2 7 8 0 2 8 8 0 2 9 8 0 3 0 8 0 3 1 8 0 3 2 8 0 3 3 8 0 3 4 8 0 3 5 8 0 3 6 8 0 3 7 8 0 3 8 8 0 3 9 8 0 4 0 8 0 4 1 8 0 4 2 8 0 4 3 8 0 4 4 8 0 4 5 8 0 4 6 8 0 4 7 8 0 4 8 8 0 4 9 8 0 5 0 8 0 5 1 8 0 5 2 8 0 5 3 8 0 5 4 8 0 5 5 8 0 5 6 8 0 5 7 8 0 5 8 8 0 5 9 8 0 6 0 8 0 6 1 8 0 6 2 8 0 6 3 8 0 6 4 8 0 6 5 8 0 6 6 8 0 6 7 8 0 6 8 8 0 6 9 8 0 7 0 8 0 7 1 8 0 7 2 8 0 7 3 8 0 7 4 8 0 7 5 8 0 7 6 8 0 7 7 . 8 0 7 8 8 0 7 9 8 0 8 0 8 0 8 1 8 0 8 2 8 0 8 3 8 0 8 4 8 0 8 5 8 0 8 6 8 0 8 7 8 0 8 8 8 0 8 9 8 0 9 0 8 0 9 1 8 0 9 2 8 0 9 3 8 0 9 4 8 0 9 5 8 0 9 6 W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , 2 2 2 ) 2 2 4 ) 4 5 0 ) 2 3 0 ) 2 4 0 ) 2 5 0 ) 2 6 0 ) 2 7 0 ) 2 8 0 ) 4 7 0 ) 4 8 0 ) D X , M M A X N P , M O D E V L I G H T , N T H C G S H L , I X V X N G , I T H E R M I R H O I R H O S I P H I I E I S P E C A 1 A 2 E O WO K O R H O O 1 0 0 F O R M A T ( 1 X , , 1 2 9 X , ' = ' , / . 1 X , 1 1 0 1 2 0 1 3 0 1 5 0 1 6 0 2 0 0 2 1 0 2 2 0 2 2 2 2 2 4 2 3 0 2 4 0 2 5 0 ./) F O R M A T ( / , / , / , 1 X , / , 1 X , ' = ' . 1 2 9 X , ' = ' , / , 1 X , ' = ' , 3 6 X , E S R 1 - A 1 - D E L E C T R O S T A T I C P L A S M A S I M U ' ' L A T I O N C O D E ' , 3 6 X , ' = ' , / , 1 X , ' = ' , 1 2 9 X , ' = ' , / , 1 X . , = = = = = = = = = = = = = = „ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = „ = = ) F O R M A T ( 1 X , ' = ' , 5 2 X , ' R E L A T I V I S T I C V E R S I O N ' , 5 7 X , ' = ' , / , 1 X , ' = ' , 2 8 X , ' A d a p t e d b y r . d . p a r a c h o M a k 1 9 8 5 / 8 6 ' f r o m E S 1 , w r i t t e n b y A . B . L a n g d o n . ' , 2 9 X , ' = ' , / , 1 X , ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' , , / . 1 X , ' = , 1 6 , d a t e d 1 2 9 X , ' = ' ) F 0 R M A T ( 4 X , ' R e s t a r t o f r u n N o . 1 6 . ' . ' ) F O R M A T ( 1 X , ' R u n d a t e D A T E ' , 1 8 . 9 X , ' R N M 1 C 2 ( 1 / ( N 1 * M 1 * ( D X / D T ) * * 2 ) ) . ' R N M 1 C 2 = ' , 1 P D 1 2 . 5 ) F O R M A T ( 1 X , ' R u n N o ' R U N N o . ' , 1 8 . 9 X , ' R M 1 C 2 I ( 1 / ( M 1 * ( D X / D T ) * * 2 ) ) . . ' R M 1 C 2 I = ' , 1 P D 1 2 . 5 ) F O R M A T ( 1 X , ' L e n g t h o f s y s t e m ' . . . L = ' , 1 P D 1 2 . 5 , 5 X , ' R M 2 C 2 I ( 1 / ( M 2 * ( D X / D T ) * * 2 ) ) . . ' R M 2 C 2 I = ' , 1 P D 1 2 . 5 ) F O R M A T ( 1 X , ' N o . o f t i m e s t e p s t o r u n ' . . N T = ' , 1 5 , 1 2 X , ' R N M 2 C 2 ( 1 / ( N 2 * M 2 * ( D X / D T ) * * 2 ) ) . ' R N M 2 C 2 = ' , 1 P D 1 2 . 5 ) F O R M A T ( 1 X , ' T i m e s t e p l e n g t h ' . . D T = ' , 1 P D 1 2 . 5 , 5 X , ' M 2 C 2 E V ( M 2 / M 1 * . 5 1 1 0 0 4 1 D 0 6 ) . . ' M 2 C 2 E V = ' , 1 P D 1 2 . 5 ) F O R M A T ( 1 X , ' L e n g t h I n t e r v a l ' . . D X = ' , 1 P D 1 2 . 5 , 5 X , ' M a x . n o . o f f o u r i e r m o d e s t o p l o t . M M A X = ' , 1 4 ) F O R M A T ( 1 X , ' T o t a l N o . o f p a r t i c l e s ' . . N P = ' , 1 7 , 1 0 X , ' P e r t u r b e d m o d e M O D E = ' , 1 4 ) F O R M A T ( 1 X , ' M u l t 1 p l 1 e r I n P o l s s o n E q n . . . . ' . C G S H L = ' , 1 P D 1 2 . 5 , 5 X , ' W r i t e I n t e r v a l f o r X , V X , V Y . . . I X V X = ' , 1 4 ) F O R M A T ( 1 X , ' N o . o f s p a c i a l c e l l s ' . . N G = ' , 1 4 , 1 3 X , ' W r i t e i n t e r v a l f o r t e m p , p r o f i l e s . ' . I T H E R M = ' , 1 4 ) F O R M A T ( 1 X , ' F i e l d s m o o t h i n g 8 0 9 7 8 0 9 8 8 0 9 9 8 1 0 0 8 1 0 1 8 1 0 2 8 1 0 3 8 1 0 4 8 1 0 5 8 1 0 6 8 1 0 7 8 1 0 8 8 1 0 9 8 1 1 0 8 1 1 1 8 1 1 2 8 1 1 3 8 1 1 4 8 1 1 5 8 1 1 6 8 1 1 7 8 1 1 8 8 1 1 9 8 1 2 0 8 1 2 1 8 1 2 2 8 1 2 3 8 1 2 4 8 1 2 5 8 1 2 6 8 1 2 7 9 0 0 0 9 0 0 1 9 0 0 2 9 0 0 3 9 0 0 4 9 0 0 5 9 0 0 6 9 0 0 7 9 0 0 8 9 0 0 9 9 0 1 0 9 0 1 1 9 0 1 2 9 0 1 3 9 0 1 4 9 0 1 5 9 0 1 6 9 0 1 7 9 0 1 8 9 0 1 9 9 0 2 0 9 0 2 1 9 0 2 2 9 0 2 3 9 0 2 4 9 0 2 5 9 0 2 6 9 0 2 7 9 0 2 8 9 0 2 9 9 0 3 0 9 0 3 1 9 0 3 2 9 0 3 3 9 0 3 4 9 0 3 5 9 0 3 6 9 0 3 7 9 0 3 8 9 0 3 9 2 6 0 2 7 0 2 8 0 5 X , F O R M A T ( 1 X , 5 X , F O R M A T ( 1 X . 5 X , F O R M A T ( 1 X , 5 X , 4 4 0 F O R M A T ( 1 X 4 5 0 F O R M A T ( 1 X 4 7 0 4 8 0 5 X F O R M A T ( 1X 5 X F 0 R M A T ( 1 X 1 7 X R E T U R N E N D A 1 = ' , 1 P D 1 2 . 5 , ' W r i t e i n t e r v a l f o r c h a r g e d e n s i t y . . I R H O = ' , 1 4 ) ' M i d - r a n g e b o o s t A 2 = ' . 1 P D 1 2 . 5 , ' W r i t e I n t e r v a l f o r s m o o t h e d d e n s i t y . I R H O S = ' , 1 4 ) ' E O - a d d u n i f o r m f i e l d E O * C 0 S ( W O * T I M E ) E O = ' . 1 P D 1 2 . 5 , ' W r i t e i n t e r v a l f o r p o t e n t i a l . . . . I P H I = ' , 1 4 ) ' W O - a d d u n i f o r m f i e l d E O * C 0 S ( W O * T I M E ) WO = ' , 1 P D 1 2 . 5 , ' W r i t e i n t e r v a l f o r e l e c t r i c f i e l d I E = ' . 1 4 ) A 1 3 1 ) ' L i g h t v e l o c i t y i n t e r m s o f D X / D T V L I G H T = ' , 1 P D 1 2 . 5 , ' N o . t i m e s t e p s b e t w e e n h i s t o r y w r i t e s N T H = ' , 1 5 ) ' S y s t e m f u n d a m e n t a l w a v e n u m b e r . . . . . K O = ' . 1 P D 1 2 . 5 , ' W r i t e I n t e r v a l f o r e n e r g y s p e c t r u m I S P E C = ' , 1 5 ) ' U n i f o r m b a c k g r o u n d c h a r g e d e n s i t y . R H O O = ' . 1 P D 1 2 . 5 ) US S U B R O U T I N E R I T E R 2 ( M 1 , 0 1 , W P 1 . W C 1 , O M 1 , T 1 , V 1 0 , X 1 1 . T H E T X 1 , N 1 , T E M P I , M 2 , 0 2 , W P 2 , W C 2 , 0 M 2 . T 2 . V 2 0 . X 2 1 , T H E T X 2 , N 2 . T E M P 2 ) S I N S E R T ' E S R 1 . S I N S E R T ' E S R 1 . W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 . W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 , W R I T E ( 7 . W R I T E ( 7 . W R I T E ( 7 , W R I T E ( 7 , 1 0 0 F O R M A T ( / I N S E R T ( 1 0 0 , 1 9 9 ) ' I N S E R T ( 5 0 0 , 6 9 9 ) ' 1 0 0 ) 2 0 0 ) N 1 . N 2 2 0 2 ) M 1 . M 2 2 0 4 ) N M 1 . N M 2 2 1 0 ) W P 1 . W P 2 2 2 0 ) W C 1 . W C 2 2 2 2 ) T 1 . T 2 2 2 4 ) 0 1 , 0 2 2 3 0 ) Q M 1 , Q M 2 2 4 0 ) T E M P I . T E M P 2 2 8 0 ) V 1 0 . V 2 0 2 9 5 ) X 1 1 . X 2 1 3 1 0 ) T H E T X 1 , T H E T X 2 1 1 0 ) , 1 X , ' 1 1 0 2 0 0 1 X , ' = ' , 2 8 X , ' E L E C T R O N S ' , 5 8 X , ' S P E C I E S # 2 ' , 2 4 X , 1 X , ' , , / . F O R M A T ( 1 X , , 1 2 9 X , ' = ' , / , 1 X , ./) " . / ) F O R M A T ( 1 X , ' N o . o f e l e c t r o n s ' . . N 1 = ' , 1 7 , 1 0 X , ' N o . o f p a r t i c l e s f o r s p e c i e s HI • . . N 2 = ' , 1 7 ) 2 0 2 F O R M A T ( 1 X . ' E l e c t r o n m a s s ' . . M1 = ' , 1 P D 1 2 . 5 , 9 0 4 0 5 X , ' P a r t i c l e m a s s 9 0 4 1 ' . . M 2 = ' . 1 P D 1 2 . 5 ) 9 0 4 2 2 0 4 F O R M A T ( 1 X , ' T o t a l e l e c t r o n m a s s 9 0 4 3 ' . . N M 1 = ' , 1 P D 1 2 . 5 , 9 0 4 4 5 X , ' T o t a l p a r t i c l e m a s s f o r s p e c i e s #2 9 0 4 5 ' N M 2 = ' , 1 P D 1 2 . 5 ) 9 0 4 6 2 1 0 F 0 R M A T ( 1 X , ' E l e c t r o n p l a s m a f r e q u e n c y . . . 9 0 4 7 ' . . W P 1 = ' , 1 P D 1 2 . 5 , 9 0 4 8 5 X , ' P l a s m a f r e q u e n c y 9 0 4 9 ' . . W P 2 = ' , 1 P D 1 2 . 5 ) 9 0 5 0 2 2 0 F 0 R M A T ( 1 X , ' E l e c t r o n c y c l o t r o n f r e q u e n c y . . 9 0 5 1 ' . . WC1 = ' , 1 P D 1 2 . 5 , 9 0 5 2 5 X , ' C y c l o t r o n f r e q u e n c y 9 0 5 3 ' . . W C 2 = ' . 1 P D 1 2 . 5 ) 9 0 5 4 2 2 2 F O R M A T ( 1 X , ' T 1 9 0 5 5 ' . . T 1 = ' . 1 P D 1 2 . 5 , 9 0 5 6 5 X , ' T 2 9 0 5 7 ' . . T 2 = ' , 1 P D 1 2 . 5 ) 9 0 5 8 2 2 4 F 0 R M A T ( 1 X , ' E l e c t r o n c h a r g e 9 0 5 9 ' . . 0 1 = ' , 1 P D 1 2 . 5 , 9 0 6 0 5 X , ' P a r t i c l e c h a r g e 9 0 6 1 ' . . 0 2 = ' , 1 P D 1 2 . 5 ) 9 0 6 2 2 3 0 F 0 R M A T ( 1 X , ' E l e c t r o n c h a r g e : m a s s r a t i o . . . 9 0 6 3 ' . . QM1 = ' , 1 P D 1 2 . 5 , 9 0 6 4 5 X , ' C h a r g e : m a s s r a t i o 9 0 6 5 ' . . Q M 2 = ' , 1 P D 1 2 . 5 ) 9 0 6 6 2 4 0 F 0 R M A T ( 1 X . ' E l e c t r o n t e m p e r a t u r e 9 0 6 7 ' . T E M P I = ' , 1 P D 1 2 . 5 , 9 0 6 8 5 X , ' T e m p e r a t u r e 9 0 6 9 ' . T E M P 2 = ' , 1 P D 1 2 . 5 ) 9 0 7 0 2 8 0 F 0 R M A T ( 1 X , ' E l e c t r o n d r i f t v e l o c i t y 9 0 7 1 ' . . V 1 0 = ' , 1 P D 1 2 . 5 , 9 0 7 2 5 X . ' D r i f t v e l o c i t y 9 0 7 3 ' . . V 2 0 = ' , 1 P D 1 2 . 5 ) 9 0 7 4 2 9 5 F 0 R M A T ( 1 X , ' P o s i t i o n p e r t u r b a t i o n 9 0 7 5 ' . . X 1 1 = ' . 1 P D 1 2 . 5 , 9 0 7 6 5 X , ' P o s i t i o n p e r t u r b a t i o n 9 0 7 7 ' . . X 2 1 = ' , 1 P D 1 2 . 5 ) 9 0 7 8 3 1 0 F 0 R M A T ( 1 X , ' P h a s e a n g l e p e r t u r b a t i o n . . . . 9 0 7 9 ' T H E T X 1 = ' , 1 P D 1 2 . 5 . 9 0 8 0 5 X , ' P h a s e a n g l e p e r t u r b a t i o n . . . . 9 0 8 1 ' T H E T X 2 = ' , 1 P D 1 2 . 5 , / / ) 9 0 8 2 C 9 0 8 3 R E T U R N 9 0 8 4 E N D 1 0 0 0 0 c================================================== 1 0 0 0 1 C 1 0 0 0 2 S U B R O U T I N E C P F T ( R , I . N , I N C P , S I G N P ) 1 0 0 0 3 C 1 0 0 0 4 c================================================== 1 0 0 0 5 I M P L I C I T D O U B L E P R E C I S I O N ( A - H , 0 - Z ) 1 0 0 0 6 D O U B L E P R E C I S I O N R ( 1 ) , 1 ( 1 ) 1 0 0 0 7 I N T E G E R S I G N P , S P A N . R C 1 0 0 0 8 D O U B L E P R E C I S I O N 1 0 , 1 1 1 0 0 0 9 D O U B L E P R E C I S I O N S I N E S ( 1 5 ) 1 0 0 1 0 C 1 0 0 1 1 C T a b l e o f s i n e s . 1 0 0 1 2 C 1 0 0 1 3 D A T A S I N E S ( 1 ) / O . O D O / 1 0 0 1 4 I F ( S I N E S ( 1 ) . E Q . 1 . 0 D 0 ) G O T O 1 1 0 0 1 5 S I N E S O ) = 1 . 0 D 0 1 0 0 1 6 T = D A T A N ( 1 . O D O ) 1 0 0 1 7 C 1 0 0 1 8 DO 2 I S = 2 , 1 5 1 0 0 1 9 S I N E S ( I S ) = S I N ( T ) 1 0 0 2 0 2 T = T / 2 . O D O 1 0 0 2 1 1 C O N T I N U E 1 0 0 2 2 C 1 0 0 2 3 I F ( N . E Q . 1 ) R E T U R N 1 0 0 2 4 C 1 0 0 2 5 C S e t u p v a r i o u s I n d i c e s . 1 0 0 2 6 C 1 0 0 2 7 I N C = I N C P 1 0 0 2 8 S G N = S I G N P 1 0 0 2 9 N I N C = N * I N C 1 0 0 3 0 S P A N * N I N C 1 0 0 3 1 I T = N / 2 1 0 0 3 2 C 1 0 0 3 3 DO 3 1 5 = 1 , 1 5 1 0 0 3 4 I F ( I T . E O . 1 ) G O T O 1 2 1 0 0 3 5 3 I T = I T / 2 1 0 0 3 6 C 1 0 0 3 7 1 0 T = S + ( S O * C - C O * S ) 1 0 0 3 8 C = C - ( C O * C + S O * S ) 1 0 0 3 9 1 0 0 4 0 S = T 1 0 0 4 1 1 0 0 4 2 C R e p l i c a t i o n l o o p . 1 0 0 4 3 11 K 1 = K O + S P A N 1 0 0 4 4 R O = R ( K 0 + 1 ) 1 0 0 4 5 R 1 = R ( K 1 + 1 ) 1 0 0 4 6 1 0 = K K O + 1 ) 1 0 0 4 7 1 1 = K K 1 + 1 ) 1 0 0 4 8 R ( K 0 + 1 ) = R O + R 1 1 0 0 4 9 K K O + 1 ) = 1 0 + 1 1 1 0 0 5 0 R O = R O - R 1 1 0 0 5 1 1 0 = 1 0 - 1 1 1 0 0 5 2 R ( K 1 + 1 ) = C * R O - S * I O 1 0 0 5 3 K K 1 + 1 ) = S * R O + C * I O 1 0 0 5 4 K O = K 1 + S P A N 1 0 0 5 5 C 1 0 0 5 6 I F ( K O . L T . N I N C ) GO T O 11 1 0 0 5 7 C 1 0 0 5 8 K 1 = K O - N I N C 1 0 0 5 9 C = -c 1 0 0 6 0 K O = S P A N - K 1 1 0 0 6 1 C 1 0 0 6 2 I F ( K 1 . L T . K O ) GO T O 11 1 0 0 6 3 C 1 0 0 6 4 K O = K O + I N C 1 0 0 6 5 C 1 0 0 6 6 I F ( K O . L T . K 1 ) G O T O 1 0 1 0 0 6 7 c-1 0 0 6 8 c R e c u r s i o n t o n e x t l e v e l . 1 0 0 6 9 c-1 0 0 7 0 1 2 C O N T I N U E 1 0 0 7 1 S P A N = S P A N / 2 1 0 0 7 2 K O = 0 1 0 0 7 3 r* 1 0 0 7 4 c A n g l e = 0 1 o o p . 1 0 0 7 5 /•* 1 0 0 7 6 1 3 K 1 = K O + S P A N 1 0 0 7 7 R O : = R ( K 0 + 1 ) 1 0 0 7 8 R 1 = R ( K 1 + 1 ) 1 0 0 7 9 1 0 = K K O + 1 ) 1 0 0 8 O 1 1 = I ( K 1 + 1 ) 1 0 0 8 1 R ( K 0 + 1 ) = R O + R 1 1 0 0 8 2 I ( K 0 + 1 ) = 1 0 + I 1 1 0 0 8 3 R ( K 1 + 1 ) = R O - R 1 1 0 0 8 4 K K 1 + 1 ) = 1 0 - 1 1 1 0 0 8 5 K O = K 1 + S P A N 1 0 0 8 6 c 1 0 0 8 7 I F ( K O . L T . N I N C ) G O T O 1 3 1 0 0 8 8 c-1 0 0 8 9 c A r e w e f i n i s h e d ? 1 0 0 9 0 c-1 0 0 9 1 I F ( S P A N . E O . I N C ) G O T O 2 0 1 0 0 9 2 c-1 0 0 9 3 c I f n o - p r e p a r e n o n - z e r o a n g l e s . 1 0 0 9 4 c-1 0 0 9 5 C O = 2 . O D O * S I N E S ( I S ) * * 2 1 0 0 9 6 I S = I S - 1 1 0 0 9 7 S = S I G N ( S I N E S ( I S ) . S G N ) 1 0 0 9 8 S O = S 1 0 0 9 9 C = 1 . O D O - C O 1 0 1 0 0 K O = I N C 1 0 1 0 1 G O T O 1 1 1 0 1 0 2 C 1 0 1 0 3 2 0 N 1 = N I N C - I N C 1 0 1 0 4 N 2 = N I N C / 2 1 0 1 0 5 R C = 0 1 0 1 0 6 I J = 0 1 0 1 0 7 J I = 0 1 0 1 0 8 C 1 0 1 0 9 I F ( N 2 . E O . I N C ) R E T U R N 1 0 1 1 0 C 1 0 1 1 1 1 0 1 1 2 G O T O 2 2 1 0 1 1 3 1 0 1 1 4 C E v e n : C -1 0 1 1 5 2 1 I J = N 1 - I J 1 0 1 1 6 0 1 = N 1 - J I 1 0 1 1 7 T R ( I J + 1 ) 1 0 1 1 8 R ( I 0 + 1 ) = R ( J I + 1 ) 1 0 1 1 9 R ( J I + 1 ) = T 1 0 1 2 0 T = KU+D 1 0 1 2 1 1 ( 1 0 + 1 ) = I ( J I + 1 ) 1 0 1 2 2 1 ( 0 1 + 1 ) = T 1 0 1 2 3 c 1 0 1 2 4 I F ( I J . G T . N 2 ) G O T O 2 1 1 0 1 2 5 c-1 0 1 2 6 c O d d 1 0 1 2 7 c-1 0 1 2 8 2 2 I J = I J + I N C 1 0 1 2 9 J I J I + N 2 1 0 1 3 0 T = R ( I J + 1 ) 1 0 1 3 1 R ( I J + 1 ) = R ( J I + 1 ) 1 0 1 3 2 R ( J I + 1 ) = T 1 0 1 3 3 T = K U + 1 ) 1 0 1 3 4 K I d + 1 ) = K J i + 1 ) 1 0 1 3 5 K J I + D = T 1 0 1 3 6 I T = N 2 1 0 1 3 7 c-1 0 1 3 8 c I n c r e m e n t r e v e r s e d c o u n t e r . 1 0 1 3 9 c-1 0 1 4 0 2 3 I T = I T / 2 1 0 1 4 1 R C = R C - I T 1 0 1 4 2 c 1 0 1 4 3 I F ( R C . G E . 0 ) GO T O 2 3 1 0 1 4 4 R C = R C + 2 * I T 1 0 1 4 5 J I = R C 1 0 1 4 6 I J = I J + I N C 1 0 1 4 7 c 1 0 1 4 8 I F ( U • L T . J I ) GO T O 2 1 1 0 1 4 9 I F ( I J . L T . N 2 ) GO T O 2 2 1 0 1 5 0 c 1 0 1 5 1 R E T U R N 1 0 1 5 2 E N D /19 11000 1 1001 C 11002 SUBROUTINE RPFT2 ( A, B. N, INCP ) 1 1003 11004 C 1 1005 C 1 1006 IMPLICIT DOUBLE PRECISION ( A-H, 0-Z ) 1 1007 DOUBLE PRECISION A(1), B(1) 1 1008 DOUBLE PRECISION IP. IM 1 1009 INC = INCP 11010 NINC = N*INC 11011 A(1) = A(1) + A(1) 11012 B(1) = B(1) + B(1) 1 1013 LP INC 1 1014 LM NINC - LP 1 1015 C 11016 IF ( LP .GE. LM ) GO TO 2 1 1017 C 1 1018 1 RP = A(LP+1) 1 1019 RM = A(LM+1) 1 1020 IP = B(LP+1) 1 1021 IM = B(LM+1) 1 1022 A(LP+1) = RM + RP 11023 B(LM+1) = RM - RP 1 1024 B(LP+1) = IP + IM 1 1025 A(LM+1) = IP - IM 11026 LP = LP + INC 1 1027 LM = NINC - LP 1 1028 C 1 1029 IF ( LP .LT. LM ) GO TO 1 1 1030 2 IF ( LP .GT. NINC ) RETURN 1 1031 C 1 1032 A(LP+1) = A(LP+1 ) + A(LP+1 ) 1 1033 B(LP+1) = B(LP+1) + B(LP+1) 1 1034 C 1 1035 RETURN 1 1036 12000 END 120O1 C 12002 SUBROUTINE RPFTI2( A, B, N, INCP ) 12003 12004 C 12005 c 12006 IMPLICIT DOUBLE PRECISION ( A-H, 0-Z ) 12007 DOUBLE PRECISION A(1), B(1) 12008 INC = INCP 12009 NINC = N*INC 12010 LP INC 1201 1 LM NINC - LP 12012 c 12013 IF ( LP .GE. LM ) RETURN 12014 c 12015 3 CA = A(LP+1 ) 12016 SB = BUM+1) 12017 CB = B(LP+1) 12018 SA = A(LM+1) 12019 A(LP+1) = CA - SB 12020 A(LM+1) = CA + SB 12021 B(LP+1) = CB + SA 12022 B(LM+1) = CB - SA 12023 LP = LP + INC 12024 LM = NINC - LP 12025 c 12026 IF ( LP .LT. LM ) GO TO 3 12027 c 12028 RETURN 12029 END 130 1 3 0 0 0 1 3 0 0 1 C 1 3 0 0 2 S U B R O U T I N E S A V E I T ( I T H , M 1 . M 2 . 0 1 . 0 2 . T 1 , T 2 . N 1 1 . N P . V L I G H T ) 1 3 0 0 3 1 3 0 0 4 C 1 3 0 0 5 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 5 9 9 ) ' 1 3 0 0 6 S I N S E R T ' E S R 1 . I N S E R T ( 7 0 0 . 8 9 9 ) ' 1 3 0 0 7 C 1 3 0 0 8 R E A L K O 1 3 0 0 9 R E W I N D 3 1 3 0 1 0 C 1 3 0 1 1 M T H = I T - I T H L + 1 1 3 0 1 2 N G 1 = N G + 1 1 3 0 1 3 M T H 1 = M T H + 1 1 3 0 1 4 K O = T W O P I / L 1 3 0 1 5 C 1 3 0 1 6 W R I T E ( 3 ) A 1 . A 2 . A E L , D T . D X , C G S H L , E O , L . V L I G H T , 1 3 0 1 7 T I M E , R H O O , WO, M 1 , M 2 , 0 1 , 0 2 , K O , 1 3 0 1 8 T 1 , T 2 , N M 1 , N M 2 , I T , I T H , I T H L , 1 3 0 1 9 N G , I D A T E , I T I M E . N 1 1 . N P 1 3 0 2 0 C 1 3 0 2 1 W R I T E ( 3 ) ( R H O ( I ) , I = 1 . N G 1 ) 1 3 0 2 2 W R I T E ( 3 ) ( P H I ( I ) , I = 1 . N G 1 ) 1 3 0 2 3 W R I T E O ) ( E ( I ) , I = 1 . N G 1 ) 1 3 0 2 4 C 1 3 0 2 5 N R E C 2 = M T H / 1 0 2 4 1 3 0 2 6 I F ( M O D ( M T H , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 3 0 2 7 C 1 3 0 2 8 D O 2 0 K M = 1 , M M A X 1 3 0 2 9 J S T A R = 1 1 3 0 3 0 J E N D = M I N ( 1 0 2 4 , M T H ) 1 3 0 3 1 DO 1 9 J J = 1 . N R E C 2 1 3 0 3 2 W R I T E O ) ( E S E M ( J . K M ) , J = J S T A R , J E N D ) 1 3 0 3 3 J S T A R = J E N D + 1 1 3 0 3 4 J E N D = J E N D + 1 0 2 4 1 3 0 3 5 J E N D = M I N ( J E N D , M T H ) 1 3 0 3 6 1 9 C O N T I N U E 1 3 0 3 7 2 0 C O N T I N U E 1 3 0 3 8 C 1 3 0 3 9 N R E C 2 = M T H 1 / 1 0 2 4 1 3 0 4 0 I F ( M 0 D ( M T H 1 , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 3 0 4 1 J S T A R = 1 1 3 0 4 2 J E N D = M I N ( 1 0 2 4 , M T H ) 1 3 0 4 3 J E N D 1 = J E N D + 1 1 3 0 4 4 I F ( J E N D 1 . G T . 1 0 2 4 ) J E N D 1 = 1 0 2 4 1 3 0 4 5 C 1 3 0 4 6 DO 2 9 J J = 1 . N R E C 2 1 3 0 4 7 W R I T E O ) ( K E 1 ( J ) , J = J S T A R , J E N D ) 1 3 0 4 8 W R I T E O ) ( K E 2 ( J ) , J = J S T A R , J E N D ) 1 3 0 4 9 W R I T E O ) ( T E ( J ) . J = J S T A R , J E N D ) 1 3 0 5 0 W R I T E O ) ( E S E ( J ) , J = J S T A R , J E N D ) 1 3 0 5 1 W R I T E O ) ( X T ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 2 W R I T E O ) ( V X T ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 3 W R I T E O ) ( P 1 X ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 4 W R I T E O ) ( P 2 X ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 5 W R I T E O ) ( P 1 Y ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 6 W R I T E O ) ( P 2 Y ( J ) , J = J S T A R , J E N D 1 ) 1 3 0 5 7 J S T A R = J E N D + 1 1 3 0 5 8 J E N D = J E N D + 1 0 2 4 1 3 0 5 9 J E N D = M I N ( J E N D , M T H ) 1 3 0 6 0 I F ( ( J E N D - J S T A R ) . L T . 1 0 2 3 ) T H E N 1 3 0 6 1 J E N D 1 = J E N D + 1 1 3 0 6 2 E L S E 1 3 0 6 3 J E N D 1 = J E N D 1 3 0 6 4 E N D I F 1 3 0 6 5 2 9 C O N T I N U E 1 3 0 6 6 C 1 3 0 6 7 N R E C S = N P / 1 0 2 4 1 3 0 6 8 I F ( M 0 D ( N P , 1 O 2 4 ) . G T . 0 ) N R E C S = N R E C S + 1 1 3 0 6 9 C 1 3 0 7 0 J S = 1 1 3 0 7 1 1 3 0 7 2 1 3 0 7 3 1 3 0 7 4 1 3 0 7 5 1 3 0 7 6 1 3 0 7 7 1 3 0 7 8 1 3 0 7 9 1 3 0 8 0 1 3 0 8 1 1 3 0 8 2 1 3 0 8 3 1 3 0 8 4 1 3 0 8 5 1 3 0 8 6 1 3 0 8 7 1 3 0 8 8 1 3 0 8 9 1 3 0 9 0 1 3 0 9 1 1 3 0 9 2 1 3 0 9 3 1 3 0 9 4 1 3 0 9 5 1 3 0 9 6 1 3 0 9 7 1 3 0 9 8 1 3 0 9 9 1 3 1 0 0 1 3 1 0 1 1 3 1 0 2 1 3 1 0 3 1 3 1 0 4 1 3 1 0 5 1 3 1 0 6 1 3 1 0 7 1 3 1 0 8 1 3 1 0 9 1 4 0 0 0 1 4 0 0 1 1 4 0 0 2 1 4 0 0 3 1 4 0 0 4 1 4 0 0 5 1 4 0 0 6 1 4 0 0 7 1 4 0 0 8 1 4 0 0 9 1 4 0 1 0 1 4 0 1 1 1 4 0 1 2 1 4 0 1 3 1 4 0 1 4 1 4 0 1 5 1 4 0 1 6 1 4 0 1 7 1 4 0 1 8 1 4 0 1 9 1 4 0 2 0 1 4 0 2 1 1 4 0 2 2 1 4 0 2 3 1 4 0 2 4 1 4 0 2 5 1 4 0 2 6 1 4 0 2 7 1 4 0 2 8 1 4 0 2 9 1 4 0 3 0 J E = M I N ( N P , 1 0 2 4 ) D O 3 0 I = 1 , N R E C S W R I T E O ) ( X ( d ) , d = d S . d E ) d S = d E + 1 d E = d E + 1 0 2 4 d E = M I N ( d E . N P ) 3 0 C O N T I N U E d S = 1 d E = M I N ( N P , 1 0 2 4 ) DO 4 0 I = 1 , N R E C S W R I T E O ) ( V X ( d ) . d = d S , d E ) d S = d E + 1 d E = d E + 1 0 2 4 d E = M I N ( d E . N P ) 4 0 C O N T I N U E d S = 1 d E = M I N ( N P , 1 0 2 4 ) D O 5 0 I = 1 . N R E C S W R I T E O ) ( V Y ( d ) , d = d S , d E ) d S = d E + 1 d E = d E + 1 0 2 4 d E = M I N ( d E . N P ) 5 0 C O N T I N U E d S = 1 d E = M I N ( N P , 1 0 2 4 ) DO 6 0 I = 1 , N R E C S W R I T E O ) ( G A M M A ( d ) , d S = d E + 1 d E = d E + 1 0 2 4 d E = M I N ( d E . N P ) 6 0 C O N T I N U E 151 d = d S , d E ) W R I T E O ) R N M 1 C 2 , R N M 2 C 2 , R M 1 C 2 I , R M 2 C 2 I , M 2 C 2 E V R E T U R N E N D S U B R O U T I N E R E S T O R ( I R D A T E , I R T I M E , I T H . M 1 , M 2 , K O , Q 1 . 0 2 , T 1 , T 2 , N 1 1 , N P . V L I G H T ) $ I N S E R T S I N S E R T C ' E S R 1 . I N S E R T ( 1 0 0 , 5 9 9 ) ' ' E S R 1 . I N S E R T ( 7 0 0 . 8 9 9 ) R E A L K O R E W I N D 3 R E A D ( 3 ) A 1 , A 2 , A E L , T I M E , R H O O , T 1 , T 2 , N M 1 , N G , I R D A T E , D T , D X , C G S H L , WO, M 1 , M 2 , 0 1 , N M 2 , I T , I T H , I R T I M E , N 1 1 , N P E O , 0 2 . I T H L L , V L I G H T , K O , M T H N G 1 G N I T - I T H L + 1 N G + 1 F L O A T ( N G ) M T H 1 = M T H + 1 R E A D ( 3 ) ( R E A D ( 3 ) ( R E A D ( 3 ) ( R H O P H I E ( I ) ( I ) ( I ) 1 , N G 1 1 , N G 1 1 , N G 1 N R E C 2 = M T H / 1 0 2 4 I F ( M O D ( M T H , 1 0 2 4 ) DO 2 0 K M = 1 , M M A X d S T A R = 1 . G T . O ) N R E C 2 = N R E C 2 + 1 /3* 1 4 0 3 1 J E N D = M I N ( 1 0 2 4 , M T H ) 1 4 0 3 2 DO 1 9 J J = 1 , N R E C 2 1 4 0 3 3 R E A D ( 3 ) ( E S E M ( J . K M ) , J = J S T A R , J E N D ) 1 4 0 3 4 J S T A R = J E N D + 1 1 4 0 3 5 J E N D = J E N D + 1 0 2 4 1 4 0 3 6 J E N D = M I N ( J E N D , M T H ) 1 4 0 3 7 1 9 C O N T I N U E 1 4 0 3 8 2 0 C O N T I N U E 1 4 0 3 9 C 1 4 0 4 0 N R E C 2 = M T H 1 / 1 0 2 4 1 4 0 4 1 I F ( M 0 D ( M T H 1 , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 + 1 1 4 0 4 2 J S T A R = 1 1 4 0 4 3 J E N D = M I N ( 1 0 2 4 , M T H ) 1 4 0 4 4 J E N D 1 = J E N D + 1 1 4 0 4 5 I F ( J E N D 1 . G T . 1 0 2 4 ) J E N D 1 = 1 0 2 4 1 4 0 4 6 C 1 4 0 4 7 DO 2 9 J J = 1 , N R E C 2 1 4 0 4 8 R E A D ( 3 ) ( K E 1 ( J ) , J = J S T A R . J E N D ) 1 4 0 4 9 R E A D ( 3 ) ( K E 2 ( J ) . J = J S T A R , J E N D ) 1 4 0 5 0 R E A D ( 3 ) ( T E ( J ) , J = J S T A R , J E N D ) 1 4 0 5 1 R E A D ( 3 ) ( E S E ( J ) , J = J S T A R , J E N D ) 1 4 0 5 2 R E A D ( 3 ) ( X T ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 3 R E A D ( 3 ) ( V X T ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 4 R E A D ( 3 ) ( P 1 X ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 5 R E A D ( 3 ) ( P 2 X ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 6 R E A D ( 3 ) ( P 1 Y ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 7 R E A D ( 3 ) ( P 2 Y ( J ) , J = J S T A R , J E N D 1 ) 1 4 0 5 8 J S T A R = J E N D + 1 1 4 0 5 9 J E N D = J E N D + 1 0 2 4 1 4 0 6 0 J E N D = M I N ( J E N D , M T H ) 1 4 0 6 1 I F ( ( J E N D - J S T A R ) . L T . 1 0 2 3 ) T H E N 1 4 0 6 2 J E N D 1 = J E N D + 1 1 4 0 6 3 E L S E 1 4 0 6 4 J E N D 1 = J E N D 1 4 0 6 5 E N D I F 1 4 0 6 6 2 9 C O N T I N U E 1 4 0 6 7 C 1 4 0 6 8 N R E C S = N P / 1 0 2 4 1 4 0 6 9 I F ( M 0 D ( N P , 1 O 2 4 ) . G T . O ) N R E C S = N R E C S + 1 1 4 0 7 0 C 1 4 0 7 1 J S = 1 1 4 0 7 2 J E = M I N ( N P . 1 0 2 4 ) 1 4 0 7 3 DO 3 0 I = 1 , N R E C S 1 4 0 7 4 R E A D ( 3 ) ( X ( J ) , J = J S , J E ) 1 4 0 7 5 J S = J E + 1 1 4 0 7 6 J E = J E + 1 0 2 4 1 4 0 7 7 J E = M I N ( J E . N P ) 1 4 0 7 8 3 0 C O N T I N U E 1 4 0 7 9 C 1 4 0 8 0 J S = 1 1 4 0 8 1 J E » M I N ( N P . 1 0 2 4 ) 1 4 0 8 2 DO 4 0 I = 1 . N R E C S 1 4 0 8 3 R E A D O ) ( V X ( J ) , J = J S , J E ) 1 4 0 8 4 J S = J E + 1 1 4 0 8 5 J E = J E + 1 0 2 4 1 4 0 8 6 J E = M I N ( J E . N P ) 1 4 0 8 7 4 0 C O N T I N U E 1 4 0 8 8 C 1 4 0 8 9 J S = 1 1 4 0 9 0 J E = M I N ( N P . 1 0 2 4 ) 1 4 0 9 1 DO 5 0 I = 1 . N R E C S 1 4 0 9 2 R E A D O ) ( V Y ( J ) , J = J S , J E ) 1 4 0 9 3 J S = J E + 1 1 4 0 9 4 J E = J E + 1 0 2 4 1 4 0 9 5 J E = M I N ( J E . N P ) 1 4 0 9 6 5 0 C O N T I N U E 1 4 0 9 7 C 1 4 0 9 8 J S = 1 1 4 0 9 9 J E = MI_N.( N P . 1 0 2 4 \ 1 4 1 0 0 1 4 1 0 1 1 4 1 0 2 1 4 1 0 3 1 4 1 0 4 1 4 1 0 5 1 4 1 0 6 C 1 4 1 0 7 1 4 1 0 8 C 1 4 1 0 9 1 4 1 1 0 1 5 0 0 0 C< 1 5 0 0 1 C 1 5 0 0 2 1 5 0 0 3 C 1 5 0 0 4 1 5 0 0 5 c 1 5 0 0 6 c 1 5 0 0 7 c 1 5 0 0 8 1 5 0 0 9 1 5 0 1 0 1 5 0 1 1 1 5 0 1 2 c 1 5 0 1 3 1 5 0 1 4 1 5 0 1 5 1 5 0 1 6 1 5 0 1 7 1 5 0 1 8 1 5 0 1 9 c 1 5 0 2 0 1 5 0 2 1 1 6 0 0 0 c 1 6 0 0 1 c 1 6 0 0 2 1 6 0 0 3 c 1 6 0 0 4 c 1 6 0 0 5 c 1 6 0 0 6 c 1 6 0 0 7 c 1 6 0 0 8 c 1 6 0 0 9 1 6 0 1 0 1 6 0 1 1 1 6 0 1 2 c 1 6 0 1 3 1 6 0 1 4 1 6 0 1 5 1 6 0 1 6 1 6 0 1 7 1 6 0 1 8 1 6 0 1 9 1 6 0 2 0 1 6 0 2 1 c 1 6 0 2 2 1 6 0 2 3 D D 6 0 I = 1 . N R E C S R E A D ( 3 ) ( G A M M A ( J ) , J S = J E + 1 J E = J E + 1 0 2 4 J E = M I N ( J E . N P ) 6 0 C O N T I N U E /£5 J = J S . J E ) R E A D ( 3 ) R N M 1 C 2 , R N M 2 C 2 , R M 1 C 2 I , R M 2 C 2 I , M 2 C 2 E V R E T U R N E N D S U B R O U T I N E S M E A R ( X , I L , I U , I S E E D ) T h i s s u b r o u t i n e r a n d o m i z e s a v e c t o r a r r a y b y r a n d o m p a i r e x c h a n g e . I M P L I C I T D O U B L E P R E C I S I O N ( A - H , 0 - Z ) D I M E N S I O N X ( 1 ) N U M = I U - I L + 1 I S D = I S E E D DO 7 0 I = I L , I U I I = N U M * R A N ( I S D ) + I L X X = X ( I ) X ( I ) = X ( I I ) X ( I I ) = X X 7 0 C O N T I N U E R E T U R N E N D F U N C T I O N R A D R E V ( I , I B ) G e n e r a t e s a n u m b e r b e t w e e n 0 a n d 1 f o r P I C q u i e t s t a r t b y m i x e d - r a d i x d i g i t r e v e r s a l I B = a r 1 t h m e t 1 c b a s e I = i n d e x t o b e r e v e r s e d . I M P L I C I T D O U B L E P R E C I S I O N ( A - H , 0 - Z ) I I = I * I B R A D R E V = D Z E R O DO 1 0 N = 1 7 , 1 , - 1 I B N = I B * * N ; I X = I I / I B N I F (. I X . N E . 0 ) T H E N R A D R E V = R A D R E V + F L O A T ( I X ) / F L O A T ( I B N ) I I = I I - I X » I B N E N D I F 1 0 C O N T I N U E R E T U R N E N D 1 7 0 0 0 1 7 0 0 1 C 1 7 0 0 2 S U B R O U T I N E 2 E R 0 S 1 7 0 0 3 C 1 7 0 0 4 1 7 0 0 5 C A t T = 0 , z e r o a r r a y s . 1 7 0 0 6 1 7 0 0 7 $ I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 . 1 9 9 ) ' 1 7 0 0 8 $ I N S E R T ' E S R 1 . I N S E R T ( 3 0 0 , 3 9 9 ) ' 1 7 0 0 9 S I N S E R T ' E S R 1 . I N S E R T ( 5 0 0 , 5 9 9 ) ' 1 7 0 1 0 C 1 7 0 1 1 M T H = N T H + 1 1 7 0 1 2 C 1 7 0 1 3 DO 1 0 1 = 1 , M T H 1 7 0 1 4 K E 1 ( I ) = D Z E R O 1 7 0 1 5 K E 2 ( I ) = D Z E R O 1 7 0 1 6 P 1 X ( I + 1 ) = D Z E R O 1 7 0 1 7 P 1 Y ( I + 1 ) = D Z E R O 1 7 0 1 8 P 2 X ( I + 1 ) = D Z E R O 1 7 0 1 9 P 2 Y ( I + 1 ) = D Z E R O 1 7 0 2 0 T E ( I ) = D Z E R O 1 7 0 2 1 E S E ( I ) = D Z E R O 1 7 0 2 2 X T ( I ) = D Z E R O 1 7 0 2 3 V X T U + 1 ) = D Z E R O 1 7 0 2 4 1 0 C O N T I N U E 1 7 0 2 5 C 1 7 0 2 6 P 1 X ( 1 ) = D Z E R O 1 7 0 2 7 . P 1 Y ( 1 ) = D Z E R O 1 7 0 2 8 P 2 X ( 1 ) = D Z E R O 1 7 0 2 9 P 2 Y ( 1 ) = D Z E R O 1 7 0 3 0 V X T ( 1 ) = D Z E R O 1 7 0 3 1 C 1 7 0 3 2 D O 2 0 K M = 1 , M M A X 1 7 0 3 3 DO 1 9 1 = 1 . M T H 1 7 0 3 4 E S E M ( I . K M ) = D Z E R O 1 7 0 3 5 1 9 C O N T I N U E 1 7 0 3 6 2 0 C O N T I N U E 1 7 0 3 7 C 1 7 0 3 8 R E T U R N 1 7 0 3 9 E N D 1 8 0 0 0 1 8 0 0 1 C 1 8 0 0 2 S U B R O U T I N E D A T E M E ( D A T E R S , I D A T E , I T I M E ) 1 8 0 0 3 C 1 8 0 0 4 1 8 0 0 5 C C o n v e r t s c h a r a c t e r d a t e & t i m e a s o u t p u t b y t h e a r r a y 1 8 0 0 6 C p r o c e s s o r r o u t i n e S Y S $ G E T D A T E t o I n t e g e r d a t a . 1 8 0 0 7 1 8 0 0 8 C H A R A C T E R * 2 0 D A T E R , D A T E R S 1 8 0 0 9 C H A R A C T E R * 1 D A T E ( 2 0 ) , C D A T E ( 1 0 ) 1 8 0 1 0 E Q U I V A L E N C E ( D A T E R , D A T E ) 1 8 0 1 1 I N T E G E R I I D A T E ( 1 2 ) 1 8 0 1 2 D A T E R = D A T E R S 1 8 0 1 3 C D A T E ( 1 ) = D A T E ( 1 ) 1 8 0 1 4 C D A T E ( 2 ) = D A T E ( 2 ) 1 8 0 1 5 C D A T E ( 3 ) = D A T E ( 1 0 ) 1 8 0 1 6 C D A T E ( 4 ) = D A T E ( 1 1 ) 1 8 0 1 7 C D A T E ( 5 ) = D A T E ( 1 3 ) 1 8 0 1 8 C D A T E ( 6 ) = D A T E ( 1 4 ) 1 8 0 1 9 C D A T E ( 7 ) = D A T E ( 1 6 ) 1 8 0 2 0 C D A T E ( 8 ) = D A T E ( 1 7 ) 1 8 0 2 1 C D A T E ( 9 ) = D A T E ( 1 9 ) 1 8 0 2 2 C D A T E ( 1 0 ) = D A T E ( 2 0 ) 1 8 0 2 3 C 1 8 0 2 4 I F ( D A T E ( 4 ) . E Q . ' S ' ) T H E N 1 8 0 2 5 I I D A T E ( 1 1 ) = 0 1 8 0 2 6 I I D A T E ( 1 2 ) = 9 1 8 0 2 7 E L S E 1 8 0 2 8 I F ( D A T E ( 4 ) . E O . ' 0 ' ) T H E N 1 8 0 2 9 I I D A T E ( 1 1 ) = 1 1 8 0 3 0 I I D A T E ( 1 2 ) = 0 1 8 0 3 1 E L S E 1 8 0 3 2 I F ( D A T E ( 4 ) . E O . ' N ' ) T H E N t 8 0 3 3 I I D A T E ( H ) = 1 1 8 0 3 4 I I D A T E ( 1 2 ) = 1 1 8 0 3 5 E L S E 1 8 0 3 G I F ( D A T E ( 4 ) . E O . ' F ' ) T H E N 1 8 0 3 7 I I D A T E ( 1 1 ) = 0 1 8 0 3 8 I I D A T E ( 1 2 ) = 2 1 8 0 3 9 E L S E 1 8 0 4 0 I F ( D A T E ( 4 ) . E O . ' D ' ) T H E N 1 8 0 4 1 I I D A T E ( 1 1 ) = 1 1 8 0 4 2 I I D A T E ( 1 2 ) = 2 1 8 0 4 3 E L S E 1 8 0 4 4 I F ( D A T E ( 4 ) . E O . ' A ' ) T H E N 1 8 0 4 5 I I D A T E ( 1 1 ) = 0 1 8 0 4 6 I F ( D A T E ( 5 ) . E O . ' P ' ) T H E N 1 8 0 4 7 I I D A T E ( 1 2 ) = 4 1 8 0 4 8 E L S E 1 8 0 4 9 I I D A T E ( 1 2 ) = 8 1 8 0 5 0 E N D I F 1 8 0 5 1 E L S E 1 8 0 5 2 I F ( D A T E ( 4 ) . E O . ' M ' ) T H E N 1 8 0 5 3 I I D A T E ( 1 1 ) = O 1 8 0 5 4 I F ( D A T E ( 6 ) . E O . ' V ) T H E N 1 8 0 5 5 I I D A T E ( 1 2 ) = 5 1 8 0 5 6 E L S E 1 8 0 5 7 I I D A T E ( 1 2 ) = 3 1 8 0 5 8 E N D I F 1 8 0 5 9 E L S E 1 8 0 6 0 I F ( D A T E ( 4 ) . E O . ) T H E N 1 8 0 6 1 I I D A T E ( 1 1 ) = 0 1 8 0 6 2 I F ( D A T E ( 5 ) . E O . ' A ' ) T H E N 1 8 0 6 3 I I D A T E ( 1 2 ) = 1 1 8 0 6 4 E L S E 1 8 0 6 5 I F ( D A T E ( 6 ) . E O . ' N ' ) T H E N 1 8 0 6 6 I I D A T E ( 1 2 ) = 6 1 8 0 6 7 E L S E 1 8 0 6 8 I I D A T E ( 1 2 ) = 7 1 8 0 6 9 E N D I F 1 8 0 7 0 E N D I F 1 8 0 7 1 E N D I F 1 8 0 7 2 E N D I F 1 8 0 7 3 E N D I F 1 8 0 7 4 E N D I F 1 8 0 7 5 E N D I F 1 8 0 7 6 E N D I F 1 8 0 7 7 E N D I F 1 8 0 7 8 E N D I F 1 8 0 7 9 C 1 8 0 8 0 DO 1 0 1 = 1 , 1 0 1 8 0 8 1 I F ( C D A T E ( I ) . E O . ' 0 ' . O R . C D A T E ( I ) . E O . ' ' ) T H E N 1 8 0 8 2 I I D A T E ( I ) = O 1 8 0 8 3 E L S E 1 8 0 8 4 I F ( C D A T E ( I ) . E O . ' 1 ' ) T H E N 1 8 0 8 5 I I D A T E ( I ) = 1 1 8 0 8 6 E L S E 1 8 0 8 7 I F ( C D A T E ( I ) . E O . ' 2 ' ) T H E N 1 8 0 8 8 I I D A T E ( I ) = 2 1 8 0 8 9 E L S E 1 8 0 9 0 I F ( C D A T E ( I ) . E O . ' 3 ' ) T H E N 1 8 0 9 1 I I D A T E ( I ) = 3 1 8 0 9 2 E L S E 1 8 0 9 3 I F ( C D A T E ( I ) . E O . ' 4 ' ) T H E N 1 8 0 9 4 1 1 D A T E ( I ) = 4 1 8 0 9 5 E L S E 1 8 0 9 6 I F ( C D A T E ( I ) . E O . ' 5 ' ) T H E N 1 8 0 9 7 I I D A T E ( I ) = 5 1 8 0 9 8 E L S E 1 8 0 9 9 I F ( C D A T E ( I ) . E O . ' 6 ' ) T H E N 1 8 1 0 0 I I D A T E U ) = 6 1 8 1 0 1 E L S E 1 8 1 0 2 I F ( C D A T E ( I ) . E O . ' 7 ' ) T H E N 1 8 1 0 3 I I D A T E ( I ) = 7 1 8 1 0 4 E L S E 1 8 1 0 5 I F ( C D A T E ( I ) . E O . ' 8 ' ) T H E N 1 8 1 0 6 I I D A T E ( I ) = 8 1 8 1 0 7 E L S E 1 8 1 0 8 I F ( C D A T E ( I ) . E O . ' 9 ' ) T H E N 1 8 1 0 9 I I D A T E ( I ) = 9 1 8 1 1 0 E N D I F 1 8 1 1 1 E N D I F 1 8 1 1 2 E N D I F 1 8 1 1 3 E N D I F 1 8 1 1 4 E N D I F 1 8 1 1 5 E N D I F 1 8 1 1 6 E N D I F 1 8 1 1 7 E N D I F 1 8 1 1 8 E N D I F 1 8 1 1 9 E N D I F 1 8 1 2 0 1 0 C O N T I N U E 1 8 1 2 1 I D A T E = I I D A T E ( 3 ) * 1 0 0 0 0 0 + I I D A T E ( 4 ) * 1 0 0 0 0 + 1 1 D A T E ( 1 1 ) * 1 0 0 0 + 1 8 1 2 2 I I D A T E ( 1 2 ) * 1 0 0 + 1 I D A T E ( 1 ) * 1 0 + I I D A T E ( 2 ) 1 8 1 2 3 I T I M E = I I D A T E ( 5 ) * 1 0 0 0 0 0 + I I D A T E ( 6 ) * 1 0 0 0 0 + I I D A T E ( 7 ) * 1 0 0 0 + 1 8 1 2 4 I I D A T E ( 8 ) * 1 0 0 + 1 I D A T E ( 9 ) * 1 0 + I I D A T E ( 1 0 ) 1 8 1 2 5 C 1 8 1 2 6 R E T U R N 1 8 1 2 7 E N D 1 9 0 0 0 c============================================================= 1 9 0 0 1 C 1 9 0 0 2 S U B R O U T I N E P E A K S ( M T H ) 1 9 0 0 3 C 1 9 0 0 4 c============================================================= 1 9 0 0 5 C C o m p u t e s ( 1 ) t i m e o f f i e l d e n e r g y p e a k s ( T I M E ) . 1 9 0 0 6 C ( i i ) t i m e b e t w e e n p e a k s ( D E L T A T ) . 1 9 0 0 7 C ( 1 1 1 ) r e a l p a r t o f p l a s m a f r e q u e n c y ( O M E G A ) . 1 9 0 0 8 C ( 1 v ) t h e r a t i o o f t h e p e a k a m p l i t u d e s ( R A T I O ) . 1 9 0 0 9 C ( v ) t h e i m a g i n a r y p a r t o f t h e f r e q u e n c y ( G A M M A ) . 1 9 0 1 0 C . T -1 9 0 1 1 S I N S E R T ' E S R 1 . I N S E R T ( 1 0 0 , 1 9 9 ) ' 1 9 0 1 2 S I N S E R T ' E S R 1 . I N S E R T ( 4 0 0 , 5 9 9 ) ' 1 9 0 1 3 D O U B L E P R E C I S I O N T I M ( N T H 1 ) 1 9 0 1 4 P A R A M E T E R ( P I = 3 . 1 4 1 5 9 2 6 5 3 5 8 9 7 9 D 0 ) 1 9 0 1 5 I N T E G E R I P E A K S ( 7 5 0 ) 1 9 0 1 6 T L = I T H L * D T 1 9 0 1 7 C 1 9 0 1 8 DO 1 I = 1 , M T H 1 9 0 1 9 T I M ( I ) = ( I - 1 ) * D T + T L 1 9 0 2 0 1 C O N T I N U E 1 9 0 2 1 C 1 9 0 2 2 C L o c a t e p e a k s . 1 9 0 2 3 C 1 9 0 2 4 M T H M 2 = M T H - 2 1 9 0 2 5 I P E A K S d ) = 1 1 9 0 2 6 J = 2 1 9 0 2 7 DO 1 0 I = 3 , M T H M 2 1 9 0 2 8 I F ( E S E ( I ) . G T . E S E ( 1 - 2 ) . A N D . E S E ( I ) . G T . E S E ( I - 1 ) . A N D . 1 9 0 2 9 E S E ( I ) . G T . E S E ( I + 1 ) . A N D . E S E ( I ) . G T . E S E ( 1 + 2 ) ) T H E N 1 9 0 3 0 I P E A K S ( J ) = I 1 9 0 3 1 d = J + 1 1 9 0 3 2 E N D I F 1 9 0 3 3 1 0 C O N T I N U E 1 9 0 3 4 N P E A K S = J - 1 1 9 0 3 5 C 1 9 0 3 6 C C a l c u l a t e a n d w r i t e o u t p e a k d a t a . 1 9 0 3 7 C 1 9 0 3 8 I F ( N P E A K S . G T . 2 ) T H E N 1 9 0 3 9 W R I T E ( 7 , 3 ) 1 9 0 4 0 W R I T E ( 7 , 4 ) 1 9 0 4 1 DO 2 0 0 = 2 , N P E A K S 1 9 0 4 2 I = I P E A K S ( J - I ) 1 9 0 4 3 I I = I P E A K S ( J ) 1 9 0 4 4 D E L T = T I M ( 1 1 ) - T I M ( I ) 1 9 0 4 5 R A T I O = S O R T ( E S E ( I I ) / E S E ( I ) ) A3 7 1 9 0 4 S O M E G A = P I / D E L T 1 9 0 4 7 G A M M A = L O G ( R A T 1 0 ) / D E L T 1 9 0 4 8 W R I T E ( 7 , 5 ) T I M ( I I ) , D E L T , O M E G A , R A T I O , G A M M A 1 9 0 4 9 2 0 C O N T I N U E 1 9 0 5 0 E N D I F 1 9 0 5 1 C - -1 9 0 5 2 C L o c a t e p e a k s f o r m o d e e l e c t r o s t a t i c e n e r g i e s . 1 9 0 5 3 C 1 9 0 5 4 DO 5 0 K M = 1 , M M A X 1 9 0 5 5 M O D E = M P L O T ( K M ) 1 9 0 5 6 I F ( M O D E . N E . Z E R O ) T H E N 1 9 0 5 7 I P E A K S O ) = 1 1 9 0 5 8 d = 2 1 9 0 5 9 DO 3 0 I = 3 . M T H M 2 1 9 0 6 0 I F ( E S E M ( I . K M ) . G T . E S E M ( I - 2 , K M ) . A N D . 1 9 0 6 1 E S E M ( I . K M ) . G T . E S E M ( I - 1 , K M ) . A N D . 1 9 0 6 2 E S E M ( I . K M ) . G T . E S E M ( I + 1 , K M ) . A N D . 1 9 0 6 3 E S E M ( I , K M ) . G T . E S E M ( I + 2 , K M ) ) T H E N 1 9 0 6 4 I P E A K S ( d ) = I 1 9 0 6 5 «J=J+1 1 9 0 6 6 E N D I F 1 9 0 6 7 3 0 C O N T I N U E 1 9 0 6 8 N P E A K S = J - 1 1 9 0 6 9 C 1 9 0 7 0 C C a l c u l a t e a n d w r i t e o u t p e a k d a t a . 1 9 0 7 1 C - -1 9 0 7 2 I F ( N P E A K 5 . G T . 2 ) T H E N 1 9 0 7 3 W R I T E ( 7 , 6 ) M O D E 1 9 0 7 4 W R I T E ( 7 , 4 ) 1 9 0 7 5 DO 4 0 d = 2 , N P E A K S 1 9 0 7 6 I = I P E A K S ( d - l ) 1 9 0 7 7 I I = I P E A K S ( d ) 1 9 0 7 8 D E L T = T I M ( 1 1 ) - T I M ( I ) 1 9 0 7 9 R A T I O = S Q R T ( E S E M ( I I . K M ) / E S E M ( I . K M ) ) 1 9 0 8 0 O M E G A = P I / D E L T 1 9 0 8 1 G A M M A = L O G ( R A T 1 0 ) / D E L T 1 9 0 8 2 W R I T E ( 7 , 5 ) T I M ( I I ) , D E L T , O M E G A , R A T I O , G A M M A 1 9 0 8 3 4 0 C O N T I N U E 1 9 0 8 4 E N D I F 1 9 0 8 5 E N D I F 1 9 0 8 6 5 0 C O N T I N U E 1 9 0 8 7 C 1 9 0 8 8 R E T U R N 1 9 0 8 9 3 F 0 R M A T ( / / , 2 2 X , ' F i e l d E n e r g y c a l c u l a t e d d a t a . ' , / , 2 1 X , 1 9 0 9 0 . - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' , / / , 1 9 0 9 1 . 9 X , ' T I M E ' , 7 X , ' D E L T A T ' , 6 X , ' O M E G A ' , 7 X , ' R A T I O ' . 7 X , ' G A M M A ' ) 1 9 0 9 2 4 F O R M A T ( 7 X , ' = = = = = = = = = ' , 3 X , ' = = = = = = = = = ' , 3 X , ' = = = = = = = = = ' , 1 9 0 9 3 3 X , ' = = = = = = = = = ' , 3 X , ' = = = = = = = = = ' . / ) 1 9 0 9 4 5 F O R M A T ( 7 X , F 9 . 3 . 3 X , F 9 . 3 , 3 X , F 9 . 5 , 3 X , F 9 . 5 , 3 X , F 9 . 5 ) 1 9 0 9 5 6 F O R M A T ( / / , 1 4 X , ' M o d e ' , 1 2 , ' E l e c t r o s t a t i c E n e r g y ' , 1 9 0 9 6 . ' c a l c u l a t e d d a t a . ' , / , 1 3 X , 1 9 0 9 7 . - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' , / / , 1 9 0 9 8 . 9 X . ' T I M E ' , 7 X , ' D E L T A T ' , 6 X , ' O M E G A ' , 7 X , ' R A T I O ' , 7 X , ' G A M M A ' ) 1 9 0 9 9 E N D 13$ 1 9 0 4 5 1 9 0 4 6 1 9 0 4 7 1 9 0 4 8 1 9 0 4 9 1 9 0 5 0 1 9 0 5 1 1 9 0 5 2 1 9 0 5 3 1 9 0 5 4 1 9 0 5 5 1 9 0 5 6 1 9 0 5 7 1 9 0 5 8 1 9 0 5 9 1 9 0 6 0 1 9 0 6 1 1 9 0 6 2 1 9 0 6 3 1 9 0 6 4 1 9 0 6 5 1 9 0 6 6 1 9 0 6 7 1 9 0 6 8 1 9 0 6 9 1 9 0 7 0 1 9 0 7 1 1 9 0 7 2 1 9 0 7 3 1 9 0 7 4 1 9 0 7 5 1 9 0 7 6 1 9 0 7 7 1 9 0 7 8 1 9 0 7 9 1 9 0 8 0 1 9 0 8 1 1 9 0 8 2 1 9 0 8 3 1 9 0 8 4 1 9 0 8 5 1 9 0 8 6 1 9 0 8 7 1 9 0 8 8 1 9 0 8 9 1 9 0 9 0 1 9 0 9 1 1 9 0 9 2 1 9 0 9 3 1 9 0 9 4 1 9 0 9 5 1 9 0 9 6 1 9 0 9 7 1 9 0 9 8 1 9 0 9 9 2 0 R A T I O = O M E G A = G A M M A = W R I T E O C O N T I N U E E N D I F S O R T ( E S E ( I I ) / E S E ( I ) ) P I / D E L T L O G ( R A T I O ) / D E L T , 5 ) T I M ( I I ) , D E L T , O M E G A , R A T I O , G A M M A C L o c a t e p e a k s f o r m o d e e l e c t r o s t a t i c e n e r g i e s . 3 0 D O 5 0 K M = 1 , M M A X M O D E = M P L O T ( K M ) I F ( M O D E . N E . Z E R O ) I P E A K S M ) = 1 d = 2 DO 3 0 I = 3 . M T H M 2 I F ( E S E M ( I . K M ) . G T . E S E M ( I . K M ) . G T . E S E M ( I , K M ) . G T . E S E M ( I . K M ) . G T . I P E A K S ( d ) = I J = d + 1 E N D I F C O N T I N U E N P E A K S = J - 1 T H E N E S E M ( I - 2 , K M ) E S E M ( 1 - 1 , K M ) E S E M ( 1 + 1 . K M ) . A N D . . A N D . . A N D . E S E M ( I + 2 , K M ) ) T H E N C a l c u l a t e a n d w r i t e o u t p e a k d a t a . I F ( N P E A K S . G T . 2 ) T H E N W R I T E ( 7 , 6 ) M O D E W R I T E ( 7 , 4 ) DO 4 0 d = 2 , N P E A K S I = I P E A K S ( d - l ) I I = I P E A K S ( J ) D E L T = T I M ( I I ) - T I M ( I ) R A T I O = S O R T ( E S E M ( I I . K M ) / E S E M ( I , K M ) ) O M E G A = P I / D E L T G A M M A = L O G ( R A T I O ) / O E L T W R I T E ( 7 , 5 ) T I M ( I I ) , D E L T , O M E G A , R A T I O , G A M M A C O N T I N U E E N D I F E N D I F C O N T I N U E 4 0 5 0 R E T U R N F 0 R M A T ( / / , 2 2 X , ' F i e l d E n e r g y c a l c u l a t e d d a t a . ' , / , 2 1 X , ,//, . 9 X , ' T I M E ' , 7 X , ' D E L T A T ' , 6 X , ' O M E G A ' , 7 X , ' R A T I O ' , 7 X , ' G A M M A ' ) F O R M A T ( 7 X , ' = = = = = = = = = ' , 3 X , ' = = = = = = = = = ' , 3 X , ' = = = = = = = = = ' , 3 X . ' = = = = = = = = = ' , 3 X , ' = " = = = = = = ' , / ) F O R M A T ( 7 X , F 9 . 3 , 3 X , F 9 . 3 , 3 X , F 9 . 5 , 3 X , F 9 . 5 , 3 X , F 9 . 5 ) F O R M A T ( / / , 1 4 X . ' M o d e ' , 1 2 , ' E l e c t r o s t a t i c E n e r g y ' , ' c a l c u l a t e d d a t a . ' , / , 1 3 X , . ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ' , / / . . 9 X , ' T I M E ' , 7 X , ' D E L T A T ' , 6 X , ' O M E G A ' , 7 X , ' R A T I O ' , 7 X , ' G A M M A ' ) E N D /SI 1000 C 1 0 0 1 C 1 0 0 2 C 1 0 0 3 C 1 0 0 4 C 1 0 0 5 1 0 0 6 1 0 0 7 1 0 0 8 1 0 0 9 1 0 1 0 1 0 1 1 1 0 1 2 1 0 1 3 1 0 1 4 1 0 1 5 1 0 1 6 1 0 1 7 1 0 1 8 1 0 1 9 1 0 2 0 1 0 2 1 1 0 2 2 1 0 2 3 1 0 2 4 1 0 2 5 1 0 2 6 1 0 2 7 1 0 2 8 1 0 2 9 1 0 3 0 1 0 3 1 C 1 0 3 2 c 1 0 3 3 c 1 0 3 4 1 0 3 5 1 0 3 6 1 0 3 7 1 0 3 8 1 0 3 9 1 0 4 0 1 0 4 1 1 0 4 2 1 0 4 3 1 0 4 4 1 0 4 5 1 0 4 6 1 0 4 7 1 0 4 8 1 0 4 9 1 0 5 0 1 0 5 1 1 0 5 2 1 0 5 3 1 0 5 4 1 0 5 5 1 0 5 6 1 0 5 7 1 0 5 8 1 0 5 9 1 0 6 0 1 0 6 1 1 0 6 2 1 0 6 3 1 0 6 4 1 0 6 5 1 0 6 6 c 1 0 6 7 c 1 0 6 8 c 1 0 6 9 c 1 0 7 0 E S 1 P L T - A p l o t t i n g p r o g r a m f o r E S R 1 P R O G R A M E S 1 P L T I N C L U D E ( M P A R A M ) I N C L U D E ( M F I E L D ) I N C L U D E ( M P T C L ) I N C L U D E ( M C N T R L ) I N C L U D E ( M T I M E ) I N C L U D E ( M T H E R M ) I N C L U D E ( A J U N K ) I N C L U D E ( H P L O T ) I N T E G E R I N B U F 1 ( 2 0 5 2 ) , I N P A R 1 ( 1 0 2 4 ) , G E T U R , S T A T U S , I N B U F 2 ( 2 0 5 2 ) , I N P A R 2 ( 1 0 2 4 ) , F P I 2 H I , F P R 2 H D D O U B L E P R E C I S I O N A P D A T 1 ( 1 0 2 4 ) , H O D A T 1 ( 1 0 2 4 ) , A P D A T 2 ( 1 0 2 4 ) , H 0 D A T 2 ( 1 0 2 4 ) =C C C C = C N P T C L 1 , N P T C L 2 , N P T C L T , I F V X 0 1 . I F V Y 0 1 , I F V X 0 2 , I F V Y 0 2 , I F V X O T I F V X 1 , I F V Y 1 , I F V X 2 , I F V Y 2 , I F V X T , I T M P 0 1 , I T M P 1 , I T M P 0 2 . I T M P 2 , I X V X 1 , I X V X 2 , I X V Y 1 , I X V Y 2 , I V X V Y 1 I V X V Y 2 , I X V X T , I X V Y T , I V X V Y T , I R H O O , I R H O S O , I P H I O , I E O , I S P E C O , I R H 0 1 , I R H 0 S 1 . I P H I 1 , I E 1 , I S P E C 1 , I T E , I K E 1 , I K E 2 , I E S E , I E S E M , I P 1 X , I P 1 Y , I P 2 X , I P 2 Y , I X T , I V X T , I E L K E , J F L A G , X X O R I G , X X M A X , Y Y O R I G , Y Y M A X , L H S T R Y , L F I E L D , L S P A C E D A T A D A T A D A T A D A T A D A T A D A T A D A T A D A T A D A T A D A T A J F L A G I R S I T E I K E 1 I K E 2 I E S E I E S E M I P 1 X I P 1 Y I P 2 X I P 2 Y I X T I V X T I E L K E L H S T R Y L F I E L D L S P A C E S T A T U S S T A T U S N P T C L 1 , N P T C L 2 , N P T C L T / 3 * 0 / I F V X 0 1 , I F V X 0 2 , I F V X O T / . F A L S E . , . F A L S E . F A L S E I F V Y 0 1 , I F V Y 0 2 / . F A L S E . , . F A L S E . / I T M P 0 1 . I T M P 0 2 / . F A L S E . , . F A L S E . / I R H O O . I R H O S O / . F A L S E . , . F A L S E . / I P H I O , I E O , I S P E C O / . F A L S E . , . F A L S E . F A L S E I F V X 1 , I F V Y 1 , I F V X 2 , I F V Y 2 , I F V X T / 5 * 0 / I T M P 1 , I T M P 2 / 2 * 0 / I X V X 1 , I X V X 2 , I X V Y 1 , I X V Y 2 , I V X V Y 1 / 5 * 0 / I V X V Y 2 , I X V X T , I X V Y T f I V X V Y T / 4 * 0 / I R H 0 1 . I R H 0 S 1 , I P H I 1 I E 1 , I S P E C 1 / 5 * 0 / 1 0 . T R U E . . T R U E . . F A L S E . . T R U E . . T R U E . . T R U E . . F A L S E . . F A L S E . . F A L S E . . F A L S E . . F A L S E . . F A L S E . = . T R U E . • . F A L S E . = . F A L S E . = I N I T I B = I N I T I B ( ( C A L L D S P D E V ( ' P L O T R E A D ( 2 , I N 1 ) I N B U F 1 , ' - A P O U T ' , 6 ) I N B U F 2 , ' H I S T . A P ' , 7 ) ' ) I f L H S T R Y i s t r u e , t h e n r e a d h i s t o r y f i l e a n d m a k e t h e r e q u i r e d h i s t o r y p l o t s . I F ( L H S T R Y ) T H E N 1+6 1 0 7 1 C 1 0 7 2 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) 1 0 7 3 N P A R S = L E N / 8 1 0 7 4 . S T A T U S = F P I 2 H I ( A P D A T 2 , I N P A R 2 , N P A R S , 4 ) 1 0 7 5 I T = I N P A R 2 ( 1 ) 1 0 7 6 I T H = I N P A R 2 ( 2 ) 1 0 7 7 I T H L = I N P A R 2 ( 3 ) 1 0 7 8 N P = I N P A R 2 ( 4 ) 1 0 7 9 N G = I N P A R 2 ( 5 ) 1 0 8 0 I D A T E = I N P A R 2 ( 6 ) 1 0 8 1 I T I M E = I N P A R 2 ( 7 ) 1 0 8 2 I R D A T E = I N P A R 2 ( 8 ) 1 0 8 3 I R T I M E = I N P A R 2 ( 9 ) 1 0 8 4 N 1 1 = I N P A R 2 O 0 ) 1 0 8 5 I E = I N P A R 2 ( 1 1 ) 1 0 8 6 I P H I = I N P A R 2 ( 1 2 ) 1 0 8 7 I R H O = I N P A R 2 ( 1 3 ) 1 0 8 8 I R H O S = I N P A R 2 ( 1 4 ) 1 0 8 9 I T H E R M = I N P A R 2 ( 1 5 ) 1 0 9 0 I X V X = I N P A R 2 ( 1 6 ) 1 0 9 1 N 1 = I N P A R 2 ( 1 7 ) 1 0 9 2 N 2 = I N P A R 2 ( 1 8 ) 1 0 9 3 N T = I N P A R 2 ( 1 9 ) 1 0 9 4 I R S = I N P A R 2 ( 2 0 ) 1 0 9 5 I S P E C = I N P A R 2 ( 2 1 ) 1 0 9 6 J K = 2 2 -1 0 9 7 D O 5 J = 1 , M M A X 1 0 9 8 M P L O T ( J ) = I N P A R 2 ( J K ) 1 0 9 9 J K = J K + 1 1 1 0 0 5 C O N T I N U E 1 1 0 1 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) 1 1 0 2 N P A R S = L E N / 8 1 1 0 3 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) 1 1 0 4 D T H 0 D A T 2 ( 1 ) 1 1 0 5 D X H 0 D A T 2 ( 2 ) 1 1 0 6 L H 0 D A T 2 ( 3 ) 1 1 0 7 T I M E = H 0 D A T 2 ( 4 ) 1 1 0 8 T 1 H 0 D A T 2 ( 5 ) 1 1 0 9 T E M P I = H 0 D A T 2 ( 6 ) 1 1 1 0 T E M P 2 = H O D A T 2 ( 7 ) 1 1 1 1 I I P L O T = Z E R O 1 1 1 2 N G 1 N G + 1 1 1 1 3 G N N G 1 1 1 4 C 1 1 1 5 I F ( N T . L E . N T H ) T H E N 1 1 1 6 J J = 1 1 1 1 7 E L S E • 1 1 1 8 J J = ( N T / N T H ) 1 1 1 9 I F ( M O D ( N T , N T H ) . G T . 0 ) J J = J J + 1 1 1 2 0 J J = J J - ( I T H L / N T H ) 1 1 2 1 E N D I F 1 1 2 2 C 1 1 2 3 DO 1 0 0 J = 1 . J J 1 1 2 4 C 1 1 2 5 I F ( N T . L E . N T H ) T H E N 1 1 2 6 I T = N T 1 1 2 7 T I M E = I T ' D T 1 1 2 8 M T H = I T + 1 1 1 2 9 M T H 1 = M T H + 1 1 1 3 0 E L S E 1 1 3 1 I T M P = I T + N T H 1 1 3 2 I T = M I N ( I T M P . N T ) 1 1 3 3 I F ( I T H L . L E . 0 ) I T = N T H 1 1 3 4 T I M E = I T * D T 1 1 3 5 M T H I = I T - I T H L + 1 1 1 3 6 M T H 1 = M T H + 1 1 1 3 7 E N D I F 1 1 3 8 C 1 1 3 9 N R E C 2 = M T H / 1 0 2 4 1 1 4 0 I F ( M O D ( M T H , 1 0 2 4 ) . G T . 0 ) N R E C 2 = N R E C 2 1 14 1 C 1 1 4 2 DO 4 0 K M = 1 , M M A X 1 1 4 3 K K = M P L O T ( K M ) 1 1 4 4 I F ( K K . N E . O ) T H E N 1 1 4 5 J O = 1 1 1 4 6 DO 3 5 I I = 1 , N R E C 2 1 1 4 7 S T A T U S = G E T U R ( I N B U F 2 . A P D A T 2 , L E N ) 1 1 4 8 N P A R S = L E N / 8 1 1 4 9 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 . N P A R S ) 1 1 5 0 DO 3 0 I = 1 . N P A R S 1 1 5 1 E S E M ( J O . K M ) = H 0 D A T 2 ( I ) 1 1 5 2 J O = J O + 1 1 1 5 3 3 0 C O N T I N U E 1 1 5 4 3 5 C O N T I N U E 1 1 5 5 E N D I F 1 1 5 6 4 0 C O N T I N U E 1 1 5 7 C 1 1 5 8 0 1 = 1 1 1 5 9 J 2 = 1 1 1 6 0 0 3 = 1 1 1 6 1 J 4 = 1 1 1 6 2 J 5 = 1 1 1 6 3 J 6 = 1 1 1 6 4 J 7 = 1 1 1 6 5 J 8 = 1 1 1 6 6 0 9 = 1 1 1 6 7 J 1 0 = 1 1 1 6 8 J 1 1 = 1 1 1 6 9 N R E C 2 = M T H 1 / 1 0 2 4 1 1 7 0 I F ( M 0 D ( M T H 1 , 1 0 2 4 ) . G T . O ) N R E C 2 = N R E C 2 + 1 1 1 7 1 C 1 1 7 2 DO 4 5 I I = 1 , N R E C 2 1 1 7 3 I F ( I I E O . N R E C 2 ) T H E N 1 1 7 4 I F ( M 0 D ( M T H 1 . 1 0 2 4 ) . E O . 1 ) G O T O 5 9 1 1 7 5 E N D I F 1 1 7 6 C . 1 1 7 7 C K E 1 e l e c t r o n t h e r m a l e n e r g y . 1 1 7 8 C 1 1 7 9 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) 1 1 8 0 N P A R S = L E N / 8 1 1 8 1 S T A T U S = F P R 2 H D ( A P D A T 2 . H 0 D A T 2 , N P A R S ) 1 1 8 2 DO 4 8 1 = 1 , N P A R S 1 1 8 3 K E 1 ( J 1 ) = H 0 D A T 2 U ) 1 1 8 4 J 1 = J 1 + 1 1 1 8 5 4 8 C O N T I N U E 1 1 8 6 C 1 1 8 7 C K E 2 s p e c i e s 2 t h e r m a l e n e r g y . 1 1 8 8 C 1 1 8 9 S T A T U S = G E T U R ( I N B U F 2 . A P D A T 2 , L E N ) 1 1 9 0 N P A R S = L E N / 8 1 1 9 1 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) 1 1 9 2 DO 4 9 1 = 1 . N P A R S 1 1 9 3 K E 2 ( J 2 ) = H 0 D A T 2 ( I ) 1 1 9 4 J 2 = J 2 + 1 1 1 9 5 4 9 C O N T I N U E 1 1 9 6 C 1 1 9 7 C T E t o t a l e n e r g y . 1 1 9 8 C 1 1 9 9 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) 1 2 0 0 N P A R S = L E N / 8 1 2 0 1 S T A T U S = F P R 2 H D ( A P D A T 2 . H 0 D A T 2 , N P A R S ) 1 2 0 2 DO 5 0 1 = 1 . N P A R S 1 2 0 3 T E ( J 3 ) = H 0 D A T 2 U ) 1 2 0 4 L)3 = J 3 + 1 1 2 0 5 5 0 C O N T I N U E 1 2 0 6 C 1 2 0 7 C E S E e l e c t r o s t a t i c f i e l d e n e r g y . 1 2 0 8 C 1 2 0 9 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 . L E N ) 1 2 1 0 N P A R S = L E N / 8 I1Z 1 2 1 1 1 2 1 2 1 2 1 3 1 2 1 4 1 2 1 5 1 2 1 6 1 2 1 7 1 2 1 8 1 2 1 9 1 2 2 0 1 2 2 1 1 2 2 2 1 2 2 3 1 2 2 4 1 2 2 5 1 2 2 6 1 2 2 7 1 2 2 8 1 2 2 9 1 2 3 0 1 2 3 1 1 2 3 2 1 2 3 3 1 2 3 4 1 2 3 5 1 2 3 6 1 2 3 7 1 2 3 8 1 2 3 9 1 2 4 0 1 2 4 1 1 2 4 2 1 2 4 3 1 2 4 4 1 2 4 5 1 2 4 6 1 2 4 7 1 2 4 8 1 2 4 9 1 2 5 0 1 2 5 1 1 2 5 2 1 2 5 3 1 2 5 4 1 2 5 5 1 2 5 6 1 2 5 7 1 2 5 8 1 2 5 9 1 2 6 0 1 2 6 1 1 2 6 2 1 2 6 3 1 2 6 4 1 2 6 5 1 2 6 6 1 2 6 7 1 2 6 8 1 2 6 9 1 2 7 0 1 2 7 1 1 2 7 2 1 2 7 3 1 2 7 4 1 2 7 5 1 2 7 6 1 2 7 7 1 2 7 8 1 2 7 9 1 2 8 0 5 1 S T A T U S = F P R 2 H D ( A P D A T 2 , DO 5 1 1 = 1 , N P A R S E S E ( J 4 ) = H 0 D A T 2 ( I ) J 4 = J 4 + 1 C O N T I N U E H 0 D A T 2 . N P A R S ) C E L K E - - e l e c t r o n k i n e t i c e n e r g y . c  S T A T U S = G E T U R ( I N B U F 2 . A P D A T 2 . L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) DO 5 2 1 = 1 , N P A R S E L K E (<J5 ) = H 0 D A T 2 U ) 0 5 = 0 5 + 1 5 2 C O N T I N U E 5 9 C O N T I N U E C X T p o s i t i o n o f p a r t i c l e N o . 1 . c  S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) DO 5 3 1 = 1 , N P A R S X T ( 0 6 ) = H 0 D A T 2 ( I ) 0 6 = 0 6 + 1 5 3 C O N T I N U E C V X T C v e l o c i t y o f p a r t i c l e N o . 1 S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 . H 0 D A T 2 . N P A R S ) DO 5 4 1 = 1 , N P A R S V X T ( 0 7 ) = H 0 D A T 2 ( I ) 0 7 = 0 7 + 1 5 4 C O N T I N U E C P 1 X C e l e c t r o n X m o m e n t u m . S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 . H 0 D A T 2 , N P A R S ) DO 5 5 1 = 1 , N P A R S P 1 X ( U 8 ) = H 0 D A T 2 ( I ) 0 8 = 0 8 + 1 5 5 C O N T I N U E C P 2 X C - - s p e c i e s 2 X m o m e n t u m . S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) DO 5 6 1 = 1 , N P A R S P 2 X ( 0 9 ) = H 0 D A T 2 ( I ) 0 9 = 0 9 + 1 5 6 C O N T I N U E c  C P 1 Y e l e c t r o n Y m o m e n t u m . c  S T A T U S = G E T U R ( I N B U F 2 , A P D A T 2 , L E N ) N P A R S = L E N / 8 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 . N P A R S ) DO 5 7 1 = 1 , N P A R S P 1 Y ( 0 1 0 ) = H 0 D A T 2 O ) 0 1 0 = 0 1 0 + 1 5 7 C O N T I N U E c  C P 2 Y s p e c i e s 2 Y m o m e n t u m . c  S T A T U S = G E T U R ( I N B U F 2 . A P D A T 2 , L E N ) /V3 1 2 8 1 N P A R S = L E N / 8 1 2 8 2 S T A T U S = F P R 2 H D ( A P D A T 2 , H 0 D A T 2 , N P A R S ) 1 2 8 3 D O 5 8 1 = 1 , N P A R S 1 2 8 4 P 2 Y ( d 1 1 ) = H 0 D A T 2 ( I ) 1 2 8 5 J 1 1 = J 1 1 + 1 1 2 8 6 5 8 C O N T I N U E 1 2 8 7 C 1 2 8 8 4 5 C O N T I N U E 1 2 8 9 C 1 2 9 0 C A L L H I S T R Y 1 2 9 1 I T H L = I T 1 2 9 2 1 0 0 C O N T I N U E 1 2 9 3 E N D I F 1 2 9 4 C 1 2 9 5 C I f L F I E L D S o r L S P A C E 1 s T R U E , t h e n : 1 2 9 6 C 1 2 9 7 C ( 1 ) r e a d X , V X , & V Y a r r a y s a n d m a k e p h a s e - s p a c e 1 2 9 8 C a n d o t h e r p l o t s i f L S P A C E 1 s T R U E . 1 2 9 9 C ( 1 i ) r e a d f i e l d d a t a a n d m a k e p l o t s I f L F I E L D 1 3 0 0 C i s T R U E . 1 3 0 1 C 1 3 0 2 I F ( L F I E L D . O R . L S P A C E ) T H E N 1 3 0 3 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 3 0 4 N P A R S = L E N / 8 1 3 0 5 S T A T U S = F P I 2 H I ( A P D A T 1 . I N P A R 1 , N P A R S , 4 ) 1 3 0 6 I T = I N P A R I O ) 1 3 0 7 I T H = I N P A R 1 ( 2 ) 1 3 0 8 I T H L = I N P A R 1 ( 3 ) 1 3 0 9 N P = I N P A R 1 ( 4 ) 1 3 1 0 N G = I N P A R 1 ( 5 ) 1 3 1 1 I D A T E = I N P A R 1 ( 6 ) 1 3 1 2 I T I M E = I N P A R 1 ( 7 ) 1 3 1 3 I R D A T E = I N P A R 1 ( 8 ) 1 3 1 4 I R T I M E = I N P A R 1 ( 9 ) 1 3 1 5 N 1 1 = I N P A R 1 ( 1 0 ) 1 3 1 6 I E = I N P A R 1 ( 1 1 ) 1 3 1 7 I P H I = I N P A R 1 ( 1 2 ) 1 3 1 8 I R H O = I N P A R 1 ( 1 3 ) 1 3 1 9 I R H O S = I N P A R 1 ( 1 4 ) 1 3 2 0 I T H E R M = I N P A R 1 ( 1 5 ) 1 3 2 1 I X V X = I N P A R 1 ( 1 6 ) 1 3 2 2 N 1 = I N P A R 1 ( 1 7 ) 1 3 2 3 N 2 = I N P A R 1 ( 1 8 ) 1 3 2 4 N T = I N P A R 1 ( 1 9 ) 1 3 2 5 I R S = I N P A R 1 ( 2 0 ) 1 3 2 6 I S P E C = I N P A R 1 ( 2 1 ) 1 3 2 7 J K = 2 2 1 3 2 8 DO 6 J = 1 , M M A X 1 3 2 9 M P L O T ( J ) = I N P A R 1 ( J K ) 1 3 3 0 J K = vJK+1 1 3 3 1 6 C O N T I N U E 1 3 3 2 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 . L E N ) 1 3 3 3 N P A R S = L E N / 8 1 3 3 4 S T A T U S = F P R 2 H D ( A P D A T 1 , H 0 D A T 1 , N P A R S ) 1 3 3 5 D T = H O D A T 1 ( 1 ) 1 3 3 6 D X = H O D A T 1 ( 2 ) 1 3 3 7 L = H O D A T 1 ( 3 ) 1 3 3 8 T I M E = H O D A T 1 ( 4 ) 1 3 3 9 T 1 = H O D A T 1 ( 5 ) 1 3 4 0 T E M P I = H O D A T 1 ( 6 ) 1 3 4 1 T E M P 2 = H O D A T 1 ( 7 ) 1 3 4 2 I I P L O T = Z E R O 1 3 4 3 N G 1 = N G + 1 1 3 4 4 G N = N G 1 3 4 5 N R E C S = N P / 1 0 2 4 1 3 4 6 I F ( M 0 D ( N P , 1 O 2 4 ) . G T . 0 ) N R E C S = N R E C S + 1 1 3 4 7 I F ( I R S . G T . 0 ) GO T O 1 0 0 0 1 3 4 8 C 1 3 4 9 C R e a d X . V X . & V Y a t T = 0 . 1 3 5 0 C 1 3 5 1 C 1 3 5 2 J S = 1 1 3 5 3 J E = 1 0 2 4 1 3 5 4 DO 1 0 1 = 1 . N R E C S 1 3 5 5 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 . L E N ) 1 3 5 6 N P A R S = L E N / 8 1 3 5 7 S T A T U S = F P R 2 H D ( A P D A T 1 , X ( J S ) . N P A R S ) 1 3 5 8 J S = J E + 1 1 3 5 9 J E = J E + N P A R S 1 3 6 0 1 0 C O N T I N U E 1 3 6 1 C 1 3 6 2 J S = 1 1 3 6 3 J E = 1 0 2 4 1 3 6 4 DO 11 I = 1 , N R E C S 1 3 6 5 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 3 6 6 N P A R S = L E N / 8 1 3 6 7 S T A T U S = F P R 2 H D ( A P D A T 1 , V X ( J S ) , N P A R S ) 1 3 6 8 J S = J E + 1 1 3 6 9 J E = J E + N P A R S 1 3 7 0 11 C O N T I N U E 1 3 7 1 C 1 3 7 2 J S = 1 1 3 7 3 J E = 1 0 2 4 1 3 7 4 DO 1 2 I = 1 , N R E C S 1 3 7 5 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 3 7 6 N P A R S = L E N / 8 1 3 7 7 S T A T U S = F P R 2 H D ( A P D A T 1 , V Y ( J S ) , N P A R S ) 1 3 7 8 J S = J E + 1 1 3 7 9 J E = J E + N P A R S 1 3 8 0 1 2 C O N T I N U E 1 3 8 1 c============================================================= 1 3 8 2 C P l o t t h e n u m b e r o f p a r t i c l e s 1 n e a c h g r i d c e l l 9 t = 0 . 1 3 8 3 c============================================================= 1 3 8 4 C E l e c t r o n s . 1 3 8 5 C 1 3 8 6 I F ( N P T C L 1 . G T . Z E R O ) T H E N 1 3 8 7 D U M I = D Z E R O 1 3 8 8 C A L L P L T F O V ( O N E . N 1 , D U M I , G N , X , N G , O N E , N P T C L 1 . T E M P 1 . T E M P 2 ) 1 3 8 9 E N D I F 1 3 9 0 C 1 3 9 1 C S p e c i e s N o . 2 . 1 3 9 2 C 1 3 9 3 I F ( N P T C L 2 . G T . Z E R O ) T H E N 1 3 9 4 D U M I = D Z E R O 1 3 9 5 C A L L P L T F O V ( N 1 1 , N P , D U M I , G N , X , N G , T W O , N P T C L 2 , T E M P 1 , T E M P 2 ) 1 3 9 6 E N D I F 1 3 9 7 C 1 3 9 8 C A l 1 p a r t i c l e s . 1 3 9 9 C 1 4 0 0 I F ( N P T C L T . G T . Z E R O ) T H E N 1 4 0 1 D U M I = D Z E R O 1 4 0 2 C A L L P L T F O V ( O N E , N P , D U M I , G N , X , N G , T H R E E , N P T C L T , T E M P 1 . 1 4 0 3 T E M P 2 ) 1 4 0 4 E N D I F 1 4 0 5 c============================================================= 1 4 0 6 C P l o t t h e d i s t r i b u t i o n f u n c t i o n ( s ) e t = 0 . 1 4 0 7 c============================================================= 1 4 0 8 C E l e c t r o n s - F ( V X ) . 1 4 0 9 C 1 4 1 0 I F ( I F V X 0 1 ) T H E N 1 4 1 1 D U M I = D Z E R O 1 4 1 2 D U M I 2 = D Z E R O 1 4 1 3 D U M I 3 = O N E 1 4 1 4 C A L L P L T F O V ( O N E , N 1 , D U M I , D U M I 2 , V X . 1 0 0 , F O U R , D U M I 3 , T E M P 1 , 1 4 1 5 T E M P 2 ) 1 4 1 6 E N D I F 1 4 1 7 C 1 4 1 8 C E l e c t r o n s - F ( V Y ) . 1 4 1 9 C 1 4 2 0 I F ( I F V Y 0 1 ) T H E N 1 4 2 1 D U M I = D Z E R O 1 4 2 2 D U M I 2 = D Z E R O 1 4 2 3 D U M I 3 = O N E 1 4 2 4 C A L L P L T F O V ( O N E , N 1 , D U M I , D U M I 2 , V Y , 1 0 0 . F I V E , D U M I 3 , T E M P 1 , 1 4 2 5 T E M P 2 ) 1 4 2 6 E N D I F 1 4 2 7 C 1 4 2 8 I F ( N 1 1 . L E . N P ) T H E N 1 4 2 9 C 1 4 3 0 C I o n s - F ( V X ) . 1 4 3 1 C - - - - -1 4 3 2 I F ( I F V X 0 2 ) T H E N 1 4 3 3 D U M I = D Z E R O 1 4 3 4 D U M I 2 = D Z E R O 1 4 3 5 D U M I 3 = O N E 1 4 3 6 C A L L P L T F O V ( N 1 1 , N P , D U M I , D U M I 2 , V X , 1 0 0 , S I X , D U M I 3 , T E M P 1 1 4 3 7 T E M P 2 ) 1 4 3 8 E N D I F 1 4 3 9 C 1 4 4 0 C I o n s - F ( V Y ) . 1 4 4 1 C 1 4 4 2 I F ( I F V Y 0 2 ) T H E N 1 4 4 3 D U M I = D Z E R O 1 4 4 4 D U M I 2 = D Z E R O 1 4 4 5 D U M I 3 = O N E 1 4 4 6 C A L L P L T F O V ( N 1 1 , N P , D U M I , D U M I 2 , V Y , 1 0 0 , S E V E N , D U M I 3 , 1 4 4 7 T E M P I , T E M P 2 ) 1 4 4 8 E N D I F 1 4 4 9 C 1 4 5 0 C A l l p a r t i c l e s - F ( V X ) . 1 4 5 1 C 1 4 5 2 I F ( I F V X O T ) T H E N 1 4 5 3 D U M I = D Z E R O 1 4 5 4 D U M I 2 = D Z E R O 1 4 5 5 D U M I 3 = O N E 1 4 5 6 C A L L P L T F O V ( O N E . N P , D U M I , D U M I 2 , V X , 1 0 0 , E I G H T , D U M I 3 . 1 4 5 7 T E M P I , T E M P 2 ) 1 4 5 8 E N D I F 1 4 5 9 E N D I F 1 4 6 0 c============================================================== 1 4 6 1 C R e a d / p l o t c h a r g e d e n s i t y v a l u e s <s t = 0 . 1 4 6 2 c=================================== = = = = = = = = = = = = = = = = = = = = = = = = = = = 1 4 6 3 I F ( I R H O . N E . Z E R O ) T H E N 1 4 6 4 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 4 6 5 S T A T U S = F P R 2 H D ( A P D A T 1 , R H O . N G 1 ) 1 4 6 6 I F ( I R H O O ) T H E N 1 4 6 7 C A L L P L O T F ( R H O , O N E ) 1 4 6 8 E N D I F 1 4 6 9 E N D I F 1 4 7 0 c============================================================= 1 4 7 1 C R e a d / p l o t s m o o t h e d c h a r g e d e n s i t y e> t = 0 . 1 4 7 2 c============================================================= 1 4 7 3 I F ( I R H O S . N E . Z E R O ) T H E N 1 4 7 4 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 4 7 5 S T A T U S = F P R 2 H D ( A P D A T 1 , R H O , N G 1 ) 1 4 7 6 I F ( I R H O S O ) T H E N 1 4 7 7 C A L L P L O T F ( R H O , TWO ) 1 4 7 8 E N D I F 1 4 7 9 E N D I F 1 4 8 0 c============================================================= 1 4 8 1 C R e a d / p l o t e l e c t r i c p o t e n t i a l @ t = 0 . 1 4 8 2 0============================================================= 1 4 8 3 I F ( I P H I . N E . Z E R O ) T H E N 1 4 8 4 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 4 8 5 S T A T U S = F P R 2 H D ( A P D A T 1 , P H I , N G 1 ) 1 4 8 6 I F ( I P H I O ) T H E N 1 4 8 7 C A L L P L O T F ( P H I , T H R E E ) 1 4 8 8 E N D I F 1 4 8 9 E N D I F 1 4 9 0 C============================================================= 1 4 9 1 C 1 4 9 2 C = 1 4 9 3 1 4 9 4 1 4 9 5 1 4 9 6 1 4 9 7 1 4 9 8 1 4 9 9 1 5 0 0 C 1 5 0 1 c 1 5 0 2 c 1 5 0 3 1 5 0 4 1 5 0 5 1 5 0 6 1 5 0 7 1 5 0 8 1 5 0 9 1 5 1 0 1 5 1 1 c 1 5 1 2 c 1 5 1 3 c 1 5 1 4 1 5 1 5 1 5 1 6 1 5 1 7 1 5 1 8 1 5 1 9 1 5 2 0 1 5 2 1 c 1 5 2 2 c 1 5 2 3 c 1 5 2 4 c 1 5 2 5 c 1 5 2 6 1 5 2 7 1 5 2 8 1 5 2 9 c 1 5 3 0 c 1 5 3 1 c 1 5 3 2 1 5 3 3 1 5 3 4 1 5 3 5 1 5 3 6 c 1 5 3 7 c 1 5 3 8 c 1 5 3 9 c 1 5 4 0 c 1 5 4 1 1 5 4 2 c 1 5 4 3 c 1 5 4 4 c 1 5 4 5 1 5 4 6 1 5 4 7 1 5 4 8 1 5 4 9 1 5 5 0 1 5 5 1 1 5 5 2 1 5 5 3 c 1 5 5 4 c 1 5 5 5 c 1 5 5 6 c 1 5 5 7 c 1 5 5 8 1 5 5 9 1 5 6 0 R e a d / p l o t e l e c t r i c f i e l d v a l u e s P t = 0 . I F ( I E . N E . Z E R O ) T H E N S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 , E , N G 1 ) I F ( I E O ) T H E N C A L L P L O T F ( E , F O U R ) E N D I F E N D I F R e a d / p l o t e l e c t r o s t a t i c e n e r g y s p e c t r u m . I F ( I S P E C . N E . Z E R O ) T H E N N G 2 P = N G / 2 + 1 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 . E K . N G 2 P ) I F ( I S P E C O ) T H E N C A L L P S P E C E N D I F E N D I F R e a d r e l a t i v e e l e c t r o n ( i o n ) t e m p e r a t u r e . I F ( I T H E R M . G T . Z E R O ) T H E N S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 , T H R M X 1 , N G 1 ) I F ( N 2 . G E . O N E ) T H E N S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 , T H R M X 2 , N G 1 ) E N D I F P l o t t e m p e r a t u r e p r o f i l e s P t = 0 . : = = = = = = = - S = = = = = = = B S B = = = = S S S = B S = = = = S I E 1 e c t r o n s . I F ( I T M P 0 1 ) T H E N C A L L P L O T F ( T H R M X 1 , F I V E ) E N D I F I o n s . I F ( I T M P 0 2 ) T H E N C A L L P L O T F ( T H R M X 2 , S I X ) E N D I F E N D I F B e g i n t i m e s t e p l o o p . 1 0 0 0 C O N T I N U E R e a d r e l a t i v e e l e c t r o n ( i o n ) t e m p e r a t u r e s . I F ( I T H E R M . G T . Z E R O ) T H E N I F ( ( I T / 1 T H E R M ) * I T H E R M . E O . I T ) T H E N S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 , T H R M X 1 , N G 1 ) I F ( N 2 . G E . O N E ) T H E N S T A T U S = G E T U R ( I N B U F 1 . A P D A T 1 , L E N ) S T A T U S = F P R 2 H D ( A P D A T 1 , T H R M X 2 , N G 1 ) E N D I F P l o t t e m p e r a t u r e p r o f i l e s . E 1 e c t r o n s . I F ( I T . G T . Z E R O ) T H E N I F ( I T M P 1 . N E . Z E R O ) T H E N I F ( ( 1 T / I T M P 1 ) * I T M P 1 . E O . I T ) T H E N 1+1 1 5 6 1 C A L L P L O T F ( T H R M X 1 , F I V E ) 1 5 6 2 E N D I F 1 5 6 3 E N D I F 1 5 6 4 1 5 6 5 C I o n s . 1 5 6 6 1 5 6 7 • I F ( I T M P 2 . N E . Z E R O ) T H E N 1 5 6 8 I F ( ( I T / I T M P 2 ) * I T M P 2 . E O . I T ) T H E N 1 5 6 9 C A L L P L O T F ( T H R M X 2 , S I X ) 1 5 7 0 E N D I F 1 5 7 1 E N D I F 1 5 7 2 E N D I F 1 5 7 3 E N D I F 1 5 7 4 E N D I F 1 5 7 5 1 5 7 6 C R e a d : X P t = I T , V X . V Y © t = I T + . 5 1 5 7 7 1 5 7 8 I F ( I X V X . N E . Z E R O ) T H E N 1 5 7 9 I F ( ( I T / I X V X ) * I X V X . E O . I T ) T H E N 1 5 8 0 C 1 5 8 1 J S = 1 1 5 8 2 J E = 1 0 2 4 1 5 8 3 DO 2 0 I = 1 , N R E C S 1 5 8 4 S T A T U S = G E T U R ( I N B U F 1 . A P D A T 1 , L E N ) 1 5 8 5 N P A R S = L E N / 8 1 5 8 6 S T A T U S = F P R 2 H D ( A P D A T 1 , X ( J S ) , N P A R S ) 1 5 8 7 J S = J E + 1 1 5 8 8 J E = J E + N P A R S 1 5 8 9 2 0 C O N T I N U E 1 5 9 0 C 1 5 9 1 J S = 1 1 5 9 2 J E = 1 0 2 4 1 5 9 3 D O 2 1 I = 1 . N R E C S 1 5 9 4 S T A T U S = G E T U R ( I N B U F 1 . A P D A T 1 , L E N ) 1 5 9 5 N P A R S = L E N / 8 1 5 9 6 S T A T U S = F P R 2 H D ( A P D A T 1 , V X ( J S ) , N P A R S ) 1 5 9 7 J S = J E + 1 1 5 9 8 J E = J E + N P A R S 1 5 9 9 2 1 C O N T I N U E 1 6 0 0 C 1 6 0 1 I F ( T 1 . N E . D Z E R O ) T H E N 1 6 0 2 J S = 1 1 6 0 3 J E = 1 0 2 4 1 6 0 4 D O 2 2 1 = 1 . N R E C S 1 6 0 5 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 6 0 6 N P A R S = L E N / 8 1 6 0 7 S T A T U S = F P R 2 H D ( A P D A T 1 , V Y ( J S ) , N P A R S ) 1 6 0 8 J S = J E + 1 1 6 0 9 J E = J E + N P A R S 1 6 1 0 . 2 2 C O N T I N U E 1 6 1 1 E N D I F 1 6 1 2 C 1 6 1 3 DO 2 6 J = 1 , N P 1 6 1 4 X ( J ) = X ( J ) * D X 1 6 1 5 1 6 1 6 2 6 C O N T I N U E C ! 1 6 1 7 1 6 1 8 c P h a s e - s p a c e a n d v e l o c i t y - s p a c e p l o t s o f a l l s p e c i e s . c= 1 6 1 9 1 6 2 0 c X - V X . E 1 e c t r o n s . C" 1 6 2 1 I F ( I X V X 1 . N E . Z E R O ) T H E N 1 6 2 2 I F ( ( I T / I X V X 1 ) * I X V X 1 . E O . I T ) T H E N 1 6 2 3 V L = D Z E R O 1 6 2 4 V U = D Z E R O 1 6 2 5 C A L L P L O T X V ( O N E , N 1 , V L , V U , O N E , O N E ) 1 6 2 6 E N D I F 1 6 2 7 1 6 2 8 E N D I F c-1 6 2 9 1 6 3 0 c c-X - V X . S p e c i e s N o . 2 . 1 6 3 1 I F ( N 2 . G E . 1 ) T H E N 1 6 3 2 I F ( I X V X 2 . N E . Z E R O ) T H E N 1 6 3 3 I F ( ( I T / I X V X 2 ) * I X V X 2 . E O . I T ) T H E N 1 6 3 4 V L = D Z E R O 1 6 3 5 V U •= D Z E R O 1 6 3 6 C A L L P L O T X V ( N.1 1 , N P . V L , V U , O N E , TWO ) 1 6 3 7 E N D I F 1 6 3 8 E N D I F 1 6 3 9 C 1 6 4 0 C X - V X . A l l s p e c i e s . 1 6 4 1 C - - - — -1 6 4 2 I F ( I X V X T . N E . Z E R O ) T H E N 1 6 4 3 I F ( ( I T / I X V X T ) * I X V X T . E O . I T ) T H E N 1 6 4 4 V L = D Z E R O 1 6 4 5 V U = D Z E R O 1 6 4 6 C A L L P L O T X V ( O N E . N P . V L . V U . O N E . T H R E E ) 1 6 4 7 E N D I F 1 6 4 8 E N D I F 1 6 4 9 E N D I F 1 6 5 0 C 1 6 5 1 C X - V Y . E l e c t r o n s . 1 6 5 2 C 1 6 5 3 I F ( T 1 . N E . D Z E R O ) T H E N 1 6 5 4 I F ( I X V Y 1 . N E . Z E R O ) T H E N 1 6 5 5 I F ( ( I T / I X V Y 1 ) * I X V Y 1 . E O . I T ) T H E N 1 6 5 6 V L = D Z E R O 1 6 5 7 V U = D Z E R O 1 6 5 8 C A L L P L O T X V ( O N E , N 1 , V L , V U , T W O , O N E ) 1 6 5 9 E N D I F 1 6 6 0 E N D I F 1 6 6 1 C 1 6 6 2 C V X - V Y . E l e c t r o n s . 1 6 6 3 C 1 6 6 4 I F ( I V X V Y 1 . N E . Z E R O ) T H E N 1 6 6 5 I F ( ( I T / I V X V Y 1 ) * I V X V Y 1 . E O . I T ) T H E N 1 6 6 6 V M U = D Z E R O 1 6 6 7 C A L L P L T V X Y ( O N E , N 1 , V M U , O N E ) 1 6 6 8 E N D I F 1 6 6 9 E N D I F 1 6 7 0 C 1 6 7 1 C X - V Y . S p e c i e s N o . 2 . 1 6 7 2 C 1 6 7 3 I F ( I X V Y 2 . N E . Z E R O ) T H E N 1 6 7 4 I F ( ( I T / I X V Y 2 ) * I X V Y 2 . E O . I T ) T H E N 1 6 7 5 V L = D Z E R O 1 6 7 6 V U = D Z E R O 1 6 7 7 C A L L P L O T X V ( N 1 1 , N P , V L , V U , T W O , TWO ) 1 6 7 8 E N D I F 1 6 7 9 E N D I F 1 6 8 0 C 1 6 8 1 C V X - V Y . S p e c i e s N o . 2 . 1 6 8 2 C 1 6 8 3 I F ( I V X V Y 2 . N E . Z E R O ) T H E N 1 6 8 4 I F ( ( I T / I V X V Y 2 ) * I V X V Y 2 . E O . I T ) T H E N 1 6 8 5 V M U = D Z E R O 1 6 8 6 C A L L P L T V X Y ( N i l . N P , V M U . TWO ) 1 6 8 7 E N D I F 1 6 8 8 E N D I F 1 6 8 9 C 1 6 9 0 C X - V Y . A l l s p e c i e s . 1 6 9 1 C 1 6 9 2 I F ( I X V Y T . N E . Z E R O ) T H E N 1 6 9 3 I F ( ( I T / I X V Y T ) * I X V Y T . E O . I T ) T H E N 1 6 9 4 V L = D Z E R O 1 6 9 5 V U = D Z E R O 1 6 9 6 C A L L P L O T X V ( O N E , N P , V L , V U , T W O , T H R E E ) 1 6 9 7 E N D I F 1 6 9 8 E N D I F 1 6 9 9 C 1 7 0 0 C V X - V Y . A l l s p e c i e s . 1 7 0 1 C 1 7 0 2 I F ( I V X V Y T . N E . Z E R O ) T H E N 1 7 0 3 I F ( ( I T / I V X V Y T ) * I V X V Y T . E O . I T ) T H E N 1 7 0 4 V M U = D Z E R O 1 7 0 5 C A L L P L T V X Y ( O N E , N P , V M U , T R H E E ) 1 7 0 6 E N D I F 1 7 0 7 E N D I F 1 7 0 8 E N D I F 1 7 0 9 E N D I F 1 7 1 0 E N D I F 1 7 1 1 C 1 7 1 2 C C h e c k t o s e e I f f i n i s h e d . 1 7 1 3 C 1 7 1 4 I F ( I T . G E . N T ) GO T O 2 0 0 0 1 7 1 5 C 1 7 1 6 C R e a d t i m e v a r i a b l e s . 1 7 1 7 C - - - -1 7 1 8 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 7 1 9 N P A R S = L E N / 8 1 7 2 0 S T A T U S = F P I 2 H I ( A P D A T 1 , I N P A R 1 , N P A R S , 4 ) 1 7 2 1 I T = I N P A R 1 ( 1 ) 1 7 2 2 I T H = I N P A R 1 ( 2 ) 1 7 2 3 T I M E = I T * D T 1 7 2 4 I F ( I X V X . N E . Z E R O ) T H E N 1 7 2 5 I F ( ( I T / I X V X ) * I X V X . E O . I T ) T H E N 1 7 2 6 c=========================================================== 1 7 2 7 C P l o t t h e n u m b e r o f p a r t i c l e s I n e a c h g r i d c e l l . 1 7 2 8 c=========================================================== 1 7 2 9 C E l e c t r o n s . 1 7 3 0 C 1 7 3 1 I F ( N P T C L 1 . G T . Z E R O ) T H E N 1 7 3 2 I F ( ( I T / N P T C L 1 ) * N P T C L 1 . E O . I T ) T H E N 1 7 3 3 D U M I = D Z E R O 1 7 3 4 C A L L P L T F O V ( O N E , N 1 , D U M I , G N , X , N G , O N E , N P T C L 1 , 1 7 3 5 T E M P I , T E M P 2 ) 1 7 3 6 E N D I F 1 7 3 7 E N D I F 1 7 3 8 C - - -1 7 3 9 C S p e c i e s N o . 2 . 1 7 4 0 C 1 7 4 1 I F ( N P T C L 2 . G T . Z E R O ) T H E N 1 7 4 2 I F ( ( I T / N P T C L 2 ) * N P T C L 2 . E O . I T ) T H E N 1 7 4 3 D U M I = D Z E R O 1 7 4 4 C A L L P L T F O V ( N 1 1 , N P , D U M I , G N , X , N G , T W O , N P T C L 2 , 1 7 4 5 T E M P 1 , T E M P 2 ) 1 7 4 6 E N D I F 1 7 4 7 E N D I F 1 7 4 8 C 1 7 4 9 C A l l p a r t i c l e s . 1 7 5 0 C 1 7 5 1 I F ( N P T C L T . G T . Z E R O ) T H E N 1 7 5 2 I F ( ( I T / N P T C L T ) . * N P T C L T . E O . I T ) T H E N 1 7 5 3 D U M I = D Z E R O 1 7 5 4 C A L L P L T F O V ( O N E , N P , D U M I , G N , X , N G , T H R E E , N P T C L T , 1 7 5 5 T E M P I , T E M P 2 ) 1 7 5 6 E N D I F 1 7 5 7 E N D I F 1 7 5 8 c=========================================================== 1 7 5 9 C P l o t t h e d i s t r i b u t i o n f u n c t i o n s . 1 7 6 0 c=========================================================== 1 7 6 1 C F ( V X ) - E l e c t r o n s . 1 7 6 2 C 1 7 6 3 I F ( I F V X 1 . N E . Z E R O ) T H E N 1 7 6 4 I F ( ( I T / I F V X 1 ) * I F V X 1 . E O . I T ) T H E N 1 7 6 5 V R L = D Z E R O 1 7 6 6 V R U = D Z E R O 1 7 6 7 C A L L C A R T M M ( N 1 , V R L , V R U , V X ) 1 7 6 8 V M = M A X ( A B S ( V R L ) , A B S ( V R U ) ) 1 7 6 9 C A L L P L T F O V ( O N E , N 1 , - V M , V M , V X , C E N T , F O U R , I F V X 1 , 1 7 7 0 T E M P I , T E M P 2 ) 1 7 7 1 E N D I F 150 1 7 7 2 E N D I F 1 7 7 3 C 1 7 7 4 C F ( V X ) - I o n s . 1 7 7 5 C 1 7 7 6 I F ( N 2 . G E . O N E ) T H E N 1 7 7 7 I F ( I F V X 2 . N E . Z E R O ) T H E N 1 7 7 8 I F ( ( I T / I F V X 2 ) * I F V X 2 . E O . I T ) T H E N 1 7 7 9 R U = V X ( N 1 1 ) 1 7 8 0 R L = R U 1 7 8 1 DO 6 0 I = N 1 1 . N P 1 7 8 2 R U = M A X ( R U . V X ( I ) ) 1 7 8 3 R L = M I N ( R L . V X ( I ) ) 1 7 8 4 6 0 C O N T I N U E 1 7 8 5 V M = M A X ( A B S ( R L ) , A B S ( R U ) ) 1 7 8 6 C A L L P L T F O V ( N 1 1 . N P , - V M , V M . V X , C E N T , S I X . I F V X 2 , 1 7 8 7 T E M P I , T E M P 2 ) 1 7 8 8 E N D I F 1 7 8 9 E N D I F 1 7 9 0 E N D I F 1 7 9 1 C 1 7 9 2 C F ( V Y ) - E l e c t r o n s . 1 7 9 3 C 1 7 9 4 I F ( T 1 . N E . D Z E R O ) T H E N 1 7 9 5 I F ( I F V Y 1 . N E . Z E R O ) T H E N 1 7 9 6 I F ( ( I T / I F V Y 1 ) * I F V Y 1 . E O . I T ) T H E N 1 7 9 7 V R L = D Z E R O 1 7 9 8 V R U = D Z E R O 1 7 9 9 C A L L C A R T M M ( N 1 , V R L , V R U . V Y ) 1 8 0 0 V M = M A X ( A B S ( V R L ) , A B S ( V R U ) ) 1 8 0 1 C A L L P L T F O V ( O N E , N 1 , - V M . V M , V Y , C E N T , F I V E , I F V Y 1 . 1 8 0 2 T E M P 1 , T E M P 2 ) 1 8 0 3 E N D I F 1 8 0 4 E N D I F 1 8 0 5 C 1 8 0 6 C F ( V Y ) - I o n s . 1 8 0 7 C 1 8 0 8 I F ( N 2 . G E . O N E ) T H E N 1 8 0 9 I F ( I F V Y 2 . N E . Z E R O ) T H E N 1 8 1 0 I F ( ( I T / I F V Y 2 ) *' I F V Y 2 . E O . I T ) T H E N 1 8 1 1 R U = V Y ( N 1 1 ) 1 8 1 2 R L = R U 1 8 1 3 DO 7 0 I = N 1 1 . N P 1 8 1 4 R U = M A X ( R U , V Y ( I ) ) 1 8 1 5 R L = M I N ( R L . V Y ( I ) ) 1 8 1 6 7 0 C O N T I N U E 1 8 1 7 V M = M A X ( A B S ( R L ) . A B S ( R U ) ) 1 8 1 8 C A L L P L T F O V ( N 1 1 . N P . - V M , V M , V Y . C E N T , S E V E N , I F V Y 2 , 1 8 1 9 T E M P 1 , T E M P 2 ) 1 8 2 0 E N D I F 1 8 2 1 E N D I F 1 8 2 2 E N D I F 1 8 2 3 E N D I F 1 8 2 4 C 1 8 2 5 C F ( V X ) - A l l p a r t i c l e s . 1 8 2 6 C 1 8 2 7 I F ( N 2 . G E . O N E ) T H E N 1 8 2 8 I F ( I F V X T . N E . Z E R O ) T H E N 1 8 2 9 I F ( ( I T / I F V X T ) * I F V X T . E O . I T ) T H E N 1 8 3 0 V M = 1 . 0 1 8 3 1 C A L L P L T F O V ( O N E , N P , - V M , V M , V X , C E N T , E I G H T , I F V X T . 1 8 3 2 T E M P I . T E M P 2 ) 1 8 3 3 E N D I F 1 8 3 4 E N D I F 1 8 3 5 E N D I F 1 8 3 6 E N D I F 1 8 3 7 E N D I F 1 8 3 8 c============================================================== 1 8 3 9 C R e a d / p l o t c h a r g e d e n s i t y v a l u e s . 1 8 4 0 c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 1 8 4 1 I F ( I R H O . N E . Z E R O ) T H E N 1 8 4 2 I F ( ( I T / I R H O ) * I R H O . E O . I T ) T H E N 1 8 4 3 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 8 4 4 S T A T U S = F P R 2 H D ( A P D A T 1 , R H O , N G 1 ) 1 8 4 5 I F ( I R H 0 1 . G T . Z E R O ) T H E N 1 8 4 6 I F ( ( I T / I R H 0 1 ) * I R H 0 1 . E O . I T ) T H E N 1 8 4 7 C A L L P L O T F ( R H O , O N E ) 1 8 4 8 E N D I F 1 8 4 9 E N D I F 1 8 5 0 E N D I F 1 8 5 1 E N D I F 1 8 5 2 c============================================================= 1 8 5 3 C R e a d / p l o t s m o o t h e d c h a r g e d e n s i t y ( R H O ) . 1 8 5 4 c============================================================= 1 8 5 5 I F ( I R H O S . N E . Z E R O ) T H E N 1 8 5 6 I F ( ( I T / I R H O S ) * I R H O S . E O . I T ) T H E N 1 8 5 7 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 8 5 8 S T A T U S = F P R 2 H D ( A P D A T 1 , R H O , N G 1 ) 1 8 5 9 I F ( I R H 0 S 1 . G T . Z E R O ) T H E N 1 8 6 0 I F ( ( I T / I R H 0 S 1 ) * I R H 0 S 1 . E O . I T ) T H E N 1 8 6 1 C A L L P L O T F ( R H O , TWO ) 1 8 6 2 E N D I F 1 8 6 3 E N D I F 1 8 6 4 E N D I F 1 8 6 5 E N D I F 1 8 6 6 c============================================================= 1 8 6 7 C R e a d / p l o t e l e c t r i c p o t e n t 1 a l ( P H I ) . 1 8 6 9 I F ( I P H I . N E . Z E R O ) T H E N 1 8 7 0 I F ( ( 1 T / I P H I ) * I P H I . E O . I T ) T H E N 1 8 7 1 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 8 7 2 S T A T U S = F P R 2 H D ( A P D A T 1 , P H I , N G 1 ) 1 8 7 3 I F ( I P H I 1 . G T . Z E R O ) T H E N 1 8 7 4 I F ( ( I T / I P H I 1 ) * I P H I 1 . E O . I T ) T H E N 1 8 7 5 C A L L P L O T F ( P H I . T H R E E ) 1 8 7 6 E N D I F 1 8 7 7 E N D I F 1 8 7 8 E N D I F 1 8 7 9 E N D I F 1 8 8 0 c============================================================= 1 8 8 1 C R e a d / p l o t e l e c t r i c f i e l d v a l u e s . 1 8 8 2 c============================================================= 1 8 8 3 I F ( I E . N E . Z E R O ) T H E N 1 8 8 4 I F ( ( I T / I E ) * I E . E O . I T ) T H E N 1 8 8 5 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 8 8 6 S T A T U S = F P R 2 H D ( A P D A T 1 . E , N G 1 ) 1 8 8 7 I F ( I E 1 . G T . Z E R O ) T H E N 1 8 8 8 I F ( ( I T / I E 1 ) * I E 1 . E O . I T ) T H E N 1 8 8 9 C A L L P L O T F ( E , F O U R ) 1 8 9 0 E N D I F 1 8 9 1 E N D I F 1 8 9 2 E N D I F 1 8 9 3 E N D I F 1 8 9 4 c============================================================= 1 8 9 5 C R e a d / p l o t e l e c t r o s t a t i c e n e r g y s p e c t r u m . 1 8 9 6 c============================================================= 1 8 9 7 I F ( I S P E C . N E . Z E R O ) T H E N 1 8 9 8 I F ( ( I T / I S P E C ) * I S P E C . E Q . I T ) T H E N 1 8 9 9 N G 2 P = N G / 2 + 1 1 9 0 0 S T A T U S = G E T U R ( I N B U F 1 , A P D A T 1 , L E N ) 1 9 0 1 S T A T U S = F P R 2 H D ( A P D A T 1 , E K . N G 2 P ) 1 9 0 2 I F ( I S P E C 1 . G T . Z E R O ) T H E N 1 9 0 3 I F ( ( I T / I S P E C 1 ) * I S P E C 1 . E Q . I T ) T H E N 1 9 0 4 C A L L P S P E C 1 9 0 5 E N D I F 1 9 0 6 E N D I F 1 9 0 7 E N D I F 1 9 0 8 E N D I F 1 9 0 9 C 1 9 1 0 G O T O 1 0 0 0 1 9 1 1 1 9 1 2 1 9 1 3 1 9 1 4 1 9 1 5 1 9 1 6 1 9 1 7 1 9 1 8 1 9 1 9 1 9 2 0 1 9 2 1 1 9 2 2 1 9 2 3 1 9 2 4 1 9 2 5 1 9 2 6 1 9 2 7 1 9 2 8 1 9 2 9 1 9 3 0 1 9 4 3 1 9 4 4 1 9 4 5 1 9 4 6 1 9 4 7 1 9 4 8 1 9 4 9 1 9 5 0 1 9 5 1 1 9 5 2 1 9 5 3 1 9 5 4 1 9 5 5 1 9 5 6 1 9 5 7 1 9 5 8 1 9 5 9 1 9 6 0 1 9 6 1 1 9 6 2 1 9 6 3 1 9 6 4 1 9 6 5 1 9 6 6 1 9 6 7 1 9 6 8 1 9 6 9 C C E n d C 2 0 0 0 C I5Z o f l o o p . C O N T I N U E I F ( J F L A G . E O . W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E W R I T E E N D I F 1 0 5 0 ) 1 0 5 1 ) 1 0 5 2 ) 1 0 5 3 ) 1 0 5 4 ) 1 0 5 5 ) 1 0 5 6 ) 1 0 5 7 ) 1 0 5 8 ) 1 0 5 9 ) 1 0 6 0 ) 1 0 6 1 ) 0 ) T H E N C D M I N C D M A X S D M I N S D M A X E P M I N E P M A X E F M I N E F M A X E T M I N E T M A X I T M I N I T M A X 1 9 3 1 1 0 5 0 F O R M A T ( / / / , 3 X . ' M I N . C H A R G E D E N S I T Y = ' . 1 P D 2 2 . 14 ) 1 9 3 2 1 0 5 1 F O R M A T ( 3 X , ' M A X . C H A R G E D E N S I T Y ' , 1 P D 2 2 1 4 . / ) 1 9 3 3 1 0 5 2 F O R M A T ( 3 X , ' M I N . S M O O T H E D C H A R G E D E N S I T Y = ' , 1 P D 2 2 1 4 ) 1 9 3 4 1 0 5 3 F O R M A T ( 3 X , ' M A X . S M O O T H E D C H A R G E D E N S I T Y = ' . 1 P D 2 2 1 4 . / ) 1 9 3 5 1 0 5 4 F O R M A T ( 3 X , ' M I N . E L E C T R I C P O T E N T I A L ' , 1 P D 2 2 1 4 ) 1 9 3 6 1 0 5 5 F O R M A T ( 3 X , ' M A X . E L E C T R I C P O T E N T I A L ' , 1 P D 2 2 1 4 . / ) 1 9 3 7 1 0 5 6 F O R M A T ( 3 X , ' M I N . E L E C T R I C F I E L D ' , 1 P D 2 2 1 4 ) 1 9 3 8 1 0 5 7 F O R M A T ( 3 X , ' M A X . E L E C T R I C F I E L D ' . 1 P D 2 2 1 4 , / ) 1 9 3 9 1 0 5 8 F O R M A T ( 3 X . ' M I N . E L E C T R O N T E M P E R A T U R E ' . 1 P D 2 2 1 4 ) 1 9 4 0 1 0 5 9 F O R M A T ( 3 X , ' M A X . E L E C T R O N T E M P E R A T U R E ' , 1 P D 2 2 1 4 , / ) 1 9 4 1 1 0 6 0 F O R M A T ( 3 X , ' M I N . S P E C I E S 2 T E M P E R A T U R E ' , 1 P D 2 2 14 ) 1 9 4 2 1 0 6 1 F O R M A T ( 3 X , ' M A X . S P E C I E S 2 T E M P E R A T U R E ' , 1 P D 2 2 1 4 ) 1 0 4 E N D I F S T O P E N D C = = = = C C C = = = = C T h i C t h e C S U B R O U T I N E P I C T U R ( I ) s s u b r o u t i n e c o n t a i n s u s e r d e f i n e d s y m b o l s f o r u s e b y D I S S P L A p l o t t i n g r o u t i n e s . R E A L X X 1 ( 5 ) , Y Y 1 ( 5 ) , X X 2 ( 5 ) , Y Y 2 ( 5 ) C C D A T A ( X X 1 ( I ) , 1 = 1 , 5 ) / - . 0 0 5 , D A T A ( Y Y 1 ( I ) . 1 = 1 , 5 ) / - . 0 0 5 . D A T A ( X X 2 ( I ) . 1 = 1 . 5 ) / - . 0 0 5 , D A T A ( Y Y 2 ( I ) , 1 = 1 . 5 ) / O . O O O , G O T O ( 1 , 2 ) , I C A L L P I C T R C ( X X 1 , Y Y 1 , 5 ) R E T U R N C A L L P I C T R C ( X X 2 . Y Y 2 , 5 ) R E T U R N E N D - . 0 0 5 , . 0 0 5 , . 0 0 5 , . 0 0 5 . -. 0 0 5 . 0 . 0 0 0 . O 0 . 0 0 0 . 0 . 0 0 0 , 0 0 5 , - . 0 0 5 / 0 0 5 , - . 0 0 5 / 0 0 0 . 0 . 0 0 0 / 0 0 5 , - . 0 0 5 / 2 0 0 0 c============================================================ 2 0 0 1 C 2 0 0 2 S U B R O U T I N E H I S T R Y 2 0 0 3 C 2 0 0 4 c============================================================ 2 0 0 5 C P l o t e n e r g i e s , e t c . v s t i m e . 2 0 0 6 C 2 0 0 7 I N C L U D E ( M P A R A M ) 2 0 0 8 I N C L U D E ( M C N T R L ) 2 0 0 9 I N C L U D E ( M T I M E ) 2 0 1 0 I N C L U D E ( M P T C L ) 2 0 1 1 I N C L U D E ( M T H E R M ) 2 0 1 2 I N C L U D E ( H P L O T ) 2 0 1 3 D O U B L E P R E C I S I O N T I M ( N T H 1 ) , T I M T H ( N T H 1 ) 2 0 1 4 I N T E G E R D U M M Y , T I T L E 2 0 1 5 P A R A M E T E R ( D U M M Y = - 1 ) 2 0 1 6 C 2 0 1 7 T L = I T H L * D T 2 0 1 8 M T H = I T - I T H L + 1 2 0 1 9 C 2 0 2 0 DO 1 I = 1 , M T H 2 0 2 1 T I M ( I ) = ( 1 - 1 ) * D T + T L 2 0 2 2 1 C O N T I N U E 2 0 2 3 c============================================================ 2 0 2 4 C P l o t m o d e e n e r g i e s . 2 0 2 5 c============================================================ 2 0 2 6 I F ( I E S E M ) T H E N 2 0 2 7 T I T L E = 1 2 0 2 8 C 2 0 2 9 DO 5 0 K M = 1 , M M A X 2 0 3 0 K = M P L O T ( K M ) 2 0 3 1 I F ( K . E O . O ) G O T O 5 2 2 0 3 2 C A L L P L T H S T ( E S E M ( 1 , K M ) , T I M . M T H , T L , T I M E , O N E , 2 0 3 3 T I T L E , D U M M Y . K ) 2 0 3 4 5 0 C O N T I N U E 2 0 3 5 5 2 C O N T I N U E 2 0 3 6 E N D I F 2 0 3 7 c============================================================ 2 0 3 8 C P l o t f i e l d e n e r g y . 2 0 3 9 c============================================================ 2 0 4 0 I F ( I E S E ) T H E N 2 0 4 1 T I T L E = 2 2 0 4 2 C A L L P L T H S T ( E S E , T I M , M T H , T L , T I M E , O N E , 2 0 4 3 T I T L E , D U M M Y , D U M M Y ) 2 0 4 4 E N D I F 2 0 4 5 c============================================================ 2 0 4 6 C P l o t e l e c t r o n k i n e t i c e n e r g y . 2 0 4 7 c = = = = = = = = = = ='= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 2 0 4 8 I F ( I E L K E ) T H E N 2 0 4 9 T I T L E = 1 2 2 0 5 0 C A L L P L T H S T ( E L K E , T I M , M T H , T L , T I M E . Z E R O , 2 0 5 1 T I T L E , D U M M Y , D U M M Y ) 2 0 5 2 E N D I F 2 0 5 3 C 2 0 5 4 C P l o t a v g . d r i f t m o m e n t u m p e r p t c l i n u n i t s o f M C , 2 0 5 5 C i e . , p l o t G A M M A * V / C . 2 0 5 6 C 2 0 5 7 C P l o t i s l a b e l e d T L t o T I M E w h e r e a s m o m e n t u m v a l u e s a r e 2 0 5 8 C a c t u a l l y k n o w n f r o m T L - D T / 2 t o T I M E - D T / 2 2 0 5 9 C 2 0 6 0 P 1 X L = P 1 X ( M T H ) 2 0 6 1 P 1 Y L = P 1 Y ( M T H ) 2 0 6 2 c============================================================ 2 0 6 3 C E l e c t r o n s - a v g . X d i r e c t i o n d r i f t m o m e n t u m . 2 0 6 4 c============================================================ 2 0 6 5 I F ( I P 1 X ) T H E N 2 0 6 6 T I T L E = 3 2 0 6 7 C A L L P L T H S T ( P 1 X , T I M , M T H , T L , T I M E , Z E R O . 2 0 6 8 T I T L E , O N E , D U M M Y ) 2 0 6 9 E N D I F 2 0 7 0 c ============================================================ 15+ 2 0 7 1 C E l e c t r o n s - a v g . Y d i r e c t i o n d r i f t m o m e n t u m . 2 0 7 2 c===================================================== 2 0 7 3 I F ( I P 1 Y ) T H E N 2 0 7 4 T I T L E = 4 2 0 7 5 C A L L P L T H S T ( P 1 Y , T I M , M T H , T L , T I M E , Z E R O , 2 0 7 6 T I T L E , O N E , D U M M Y ) 2 0 7 7 E N D I F 2 0 7 8 I F ( N 2 . N E . Z E R O ) T H E N 2 0 7 9 P 2 X L = P 2 X ( M T H ) 2 0 8 0 P 2 Y L = P 2 Y ( M T H ) 2 0 8 1 c===================================================== 2 0 8 2 C S p e c i e s 2 - a v g . X d i r e c t i o n d r i f t m o m e n t u m . 2 0 8 3 c===================================================== 2 0 8 4 I F ( I P 2 X ) T H E N 2 0 8 5 T I T L E = 5 2 0 8 6 C A L L P L T H S T ( P 2 X , T I M , M T H , T L . T I M E , Z E R O , 2 0 8 7 T I T L E . T W O , D U M M Y ) 2 0 8 8 E N D I F 2 0 8 9 c===================================================== 2 0 9 0 C S p e c i e s 2 - a v g . Y d i r e c t i o n d r i f t m o m e n t u m . 2 0 9 1 c===================================================== 2 0 9 2 I F ( I P 2 Y ) T H E N 2 0 9 3 T I T L E = 6 2 0 9 4 C A L L P L T H S T ( P 2 Y , T I M , M T H , T L , T I M E , Z E R O , 2 0 9 5 T I T L E , T W O , D U M M Y ) 2 0 9 6 E N D I F 2 0 9 7 E N D I F 2 0 9 8 c===================================================== 2 0 9 9 C P l o t p o s i t i o n o f p a r t i c l e n o . 1 . 2 1 0 0 c===================================================== 2 1 0 1 I F ( I X T ) T H E N 2 1 0 2 T I T L E = 7 2 1 0 3 DO 2 0 I = 1 , M T H 2 1 0 4 X T ( I ) = X T ( I ) * D X 2 1 0 5 2 0 C O N T I N U E 2 1 0 6 C A L L P L T H S T ( X T , T I M , M T H , T L , T I M E , Z E R O , 2 1 0 7 T I T L E , D U M M Y , D U M M Y ) 2 1 0 8 E N D I F 2 1 0 9 c===================================================== 2 1 1 0 C P l o t v e l o c i t y o f p a r t i c l e n o . 1 2 1 1 1 c===================================================== 2 1 1 2 I F ( I V X T ) T H E N 2 1 1 3 T I T L E = 8 2 1 1 4 D X D T = D X / D T 2 1 1 5 DO 5 9 8 I = 1 . M T H 2 1 1 6 5 9 8 T I M ( I ) = T I M ( I ) - 0 . 5 D 0 * D T 2 1 1 7 C A L L P L T H S T ( V X T , T I M , M T H , T L , T I M E , Z E R O , 2 1 1 8 T I T L E , D U M M Y , D U M M Y ) 2 1 1 9 D O 5 9 9 I = 1 , M T H 2 1 2 0 5 9 9 T I M ( I ) = T I M ( I ) + 0 . 5 D 0 * D T 2 1 2 1 E N D I F 2 1 2 2 c======================== ======================== 2 1 2 3 C P l o t t o t a l e n e r g y . 2 1 2 4 c===================================================== 2 1 2 5 I F ( I T E ) T H E N 2 1 2 6 T I T L E = 9 2 1 2 7 C A L L P L T H S T ( T E . T I M , M T H , T L , T I M E , O N E , 2 1 2 8 T I T L E , D U M M Y , D U M M Y ) 2 1 2 9 E N D I F 2 1 3 0 C 2 1 3 1 I F ( I T . E O . N T ) T H E N 2 1 3 2 I F ( I T H E R M . N E . Z E R O ) T H E N 2 1 3 3 N P T H = I T / I T H E R M +1 2 1 3 4 DO 2 0 0 1 = 1 , N P T H 2 1 3 5 T I M T H ( I ) = ( I - 1 ) * I T H E R M * P T 2 1 3 6 2 0 0 C O N T I N U E 2 1 3 7 c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 2 1 3 8 C P l o t e l e c t r o n t h e r m a l e n e r g y . 2 1 3 9 0===================================================== 2 1 4 0 I F ( I K E 1 ) T H E N '55 2 1 4 1 T I T L E = 1 0 2 1 4 2 C A L L P L T H S T ( K E 1 , T I M T H . N P T H . T L , T I M E , Z E R O , 2 1 4 3 T I T L E , O N E , D U M M Y ) 2 1 4 4 E N D I F 2 1 4 5 C 2 1 4 6 I F ( N 2 . N E . Z E R O ) T H E N 2 1 4 7 2 1 4 8 c P l o t s p e c i e s 2 t h e r m a l e n e r g y . 2 1 4 9 2 1 5 0 I F ( I K E 2 ) T H E N 2 1 5 1 T I T L E = 11 2 1 5 2 C A L L P L T H S T ( K E 2 , T I M T H , N P T H , T L . T I M E . Z E R O , 2 1 5 3 T I T L E , T W O , D U M M Y ) 2 1 5 4 E N D I F 2 1 5 5 E N D I F 2 1 5 6 E N D I F 2 1 5 7 E N D I F 2 1 5 8 c 2 1 5 9 R E T U R N 2 1 6 0 3 0 0 0 E N D 3 0 0 1 c 3 0 0 2 S U B R O U T I N E P L T H S T ( R E C , T I M , M T H . T L , T U , L I N L O G , T I T L E , I S , M O D E j 3 0 0 3 3 0 0 4 c 3 0 0 5 c P l o t : t i m e h i s t o r y , l i n e a r o r l o g . 3 0 0 6 3 0 0 7 I N C L U D E ( M P A R A M ) 3 0 0 8 I N C L U D E ( M C N T R L ) 3 0 0 9 I N C L U D E ( M P T C L ) 3 0 1 0 I N C L U D E ( M T I M E ) 3 0 1 1 D O U B L E P R E C I S I O N R E C ( M T H ) , T I M ( M T H ) 3 0 1 2 R E A L X A X I S , Y A X I S , X O R I G , X M A X , Y O R I G , Y M A X , T I M R ( I O O O ) , 3 0 1 3 X S T E P , Y C Y C L E , R E C R ( I O O O ) , T I M E R 3 0 1 4 I N T E G E R T I T L E 3 0 1 5 c 3 0 1 6 C A L L P A G E ( 1 1 . O , 8 . 5 0 ) 3 0 1 7 X A X I S = 9 . 5 3 0 1 8 Y A X I S = 6 . 0 3 0 1 9 C A L L A R E A 2 D ( X A X I S . Y A X I S ) 3 0 2 0 c 3 0 2 1 C A L L C A R T M M ( M T H , R L , R U , R E C ) 3 0 2 2 c 3 0 2 3 5 0 I F ( T I T L E . N E . 1 ) GO T O 1 0 0 3 0 2 4 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 2 5 C A L L Y N A M E ( ' M O D E E N E R G Y S ' , 1 0 0 ) 3 0 2 6 C A L L H E A D I N ( ' M O D E E N E R G Y V S T I M E S ' , l O O . 2 . , 1 ) 3 0 2 7 I d P L O T = I I P L O T + 1 3 0 2 8 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - M O D E " , I 2 , 3 0 2 9 " E N E R G Y v s . T I M E " ) ' ) I J P L O T , M O D E 3 0 3 0 G O T O 1 1 0 0 3 0 3 1 c 3 0 3 2 1 0 0 I F ( T I T L E . N E . 2 ) GO T O 2 0 0 3 0 3 3 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 3 4 C A L L Y N A M E ( ' F I E L D E N E R G Y S ' , 1 0 0 ) 3 0 3 5 C A L L H E A D I N ( ' F I E L D E N E R G Y V S T I M E S ' , 1 0 0 , 2 . , 1 ) 3 0 3 6 I J P L O T = I I P L O T + 1 3 0 3 7 W R I T E ( * , F M T = ' ( 2 X . " P L O T " , I 3 , " - F I E L D " , 3 0 3 8 " E N E R G Y v s . T I M E " ) ' ) I J P L O T 3 0 3 9 GO T O 1 1 0 0 3 0 4 0 c 3 0 4 1 2 0 0 I F ( T I T L E . N E . 3 ) G O T O 3 0 0 3 0 4 2 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 4 3 C A L L Y N A M E ( ' A V E R A G E X - M O M E N T U M ( M C ) S ' , 1 0 0 ) 3 0 4 4 C A L L H E A D I N ( ' E L E C T R O N S : A V G . X - M O M E N T U M V S T I M E S ' , 3 0 4 5 1 0 0 , 2 . , 1 ) 3 0 4 6 I J P L O T = I I P L O T + 1 3 0 4 7 W R I T E ( * . F M T = ' ( 2 X , " P L O T " , I 3 , " - E L E C T R O N S " , 3 0 4 8 " A V G . X - M M T M . v s . T I M E " ) ' ) I J P L O T 3 0 4 9 G O T O 1 1 0 0 3 0 5 0 C ' 3 0 5 1 3 0 0 I F ( T I T L E . N E . 4 ) G O T O 4 0 0 3 0 5 2 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 5 3 C A L L Y N A M E ( ' A V E R A G E Y - M O M E N T U M ( M C ) S ' . 1 0 0 ) 3 0 5 4 C A L L H E A D I N ( ' E L E C T R O N S : A V G . Y - M O M E N T U M V S T I M E S ' , 3 0 5 5 1 0 0 , 2 . . 1 ) 3 0 5 6 I J P L O T = I I P L O T + 1 3 0 5 7 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T ' ' , 1 3 , ' ' - E L E C T R O N S ' ' , 3 0 5 8 " A V G . Y - M M T M . v s . T I M E " ) ' ) I J P L O T 3 0 5 9 GO T O 1 1 0 0 3 0 6 0 C 3 0 6 1 4 0 0 I F ( T I T L E . N E . 5 ) G O T O 5 0 0 3 0 6 2 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 6 3 C A L L Y N A M E ( ' A V E R A G E X - M O M E N T U M ( M C ) S ' , 1 0 0 ) 3 0 6 4 C A L L H E A D I N ( ' S P E C I E S 2 : A V G . X - M O M E N T U M V S T I M E S ' , 3 0 6 5 1 0 0 , 2 . , 1 ) 3 0 6 6 I J P L O T = I I P L O T + 1 3 0 6 7 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - S P E C I E S 2 " . 3 0 6 8 " A V G . X - M M T M . v s . T I M E " ) ' ) I J P L O T 3 0 6 9 GO T O 1 1 0 0 3 0 7 0 C 3 0 7 1 5 0 0 I F ( T I T L E . N E . 6 ) GO T O 6 0 0 3 0 7 2 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 7 3 C A L L Y N A M E ( ' A V E R A G E Y - M O M E N T U M ( M C ) S ' , 1 0 0 ) 3 0 7 4 C A L L H E A D I N ( ' S P E C I E S 2 : A V G . Y - M O M E N T U M V S T I M E S ' , 3 0 7 5 1 0 0 , 2 . , 1 ) 3 0 7 6 I J P L O T = I I P L O T + 1 3 0 7 7 W R I T E ( * , F M T = ' ( 2 X . " P L O T " , I 3 , " - S P E C I E S . 2 " , 3 0 7 8 " A V G . Y - M M T M . v s . T I M E " ) ' ) I J P L O T 3 0 7 9 GO T O 1 1 0 0 3 0 8 0 C 3 0 8 1 6 0 0 I F ( T I T L E . N E . 7 ) GO T O 7 0 0 3 0 8 2 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 8 3 C A L L Y N A M E ( ' X P O S I T I O N S ' , 1 0 0 ) 3 0 8 4 C A L L H E A D I N ( ' P O S I T I O N O F P A R T I C L E N O . 1 $ ' . 1 0 0 , 2 . , 1 ) 3 0 8 5 I J P L O T = I I P L O T + 1 3 0 8 6 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T " , I 3 , " - P O S I T I O N " . 3 0 8 7 " O F P A R T I C L E 1 v s . T I M E " ) ' ) I J P L O T 3 0 8 8 G O T O 1 1 0 0 3 0 8 9 C 3 0 9 0 7 0 0 I F ( T I T L E . N E . 8 ) G O T O 8 0 0 3 0 9 1 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 0 9 2 C A L L Y N A M E ( ' X V E L O C I T Y S ' , 1 0 0 ) 3 0 9 3 C A L L H E A D I N ( ' V E L O C I T Y O F P A R T I C L E N O . 1 $ ' . 1 0 0 , 2 . , 1 ) 3 0 9 4 I J P L O T = I I P L O T + 1 3 0 9 5 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T " , I 3 , " - V E L O C I T Y " , 3 0 9 6 " O F P A R T I C L E 1 v s . T I M E " ) ' ) I J P L O T 3 0 9 7 G O T O 1 1 0 0 3 0 9 8 C 3 0 9 9 8 0 0 I F ( T I T L E . N E . 9 ) GO T O 9 0 0 3 1 0 0 C A L L X N A M E ( ' T I M E S ' . 1 0 0 ) 3 1 0 1 C A L L Y N A M E ( ' T O T A L E N E R G Y S ' , 1 0 0 ) 3 1 0 2 C A L L H E A D I N ( ' T O T A L E N E R G Y S ' , 1 0 0 , 2 . , 1 ) 3 1 0 3 I J P L O T = I I P L O T + 1 3 1 0 4 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - T O T A L " , 3 1 0 5 " E N E R G Y v s . T I M E " ) ' ) I J P L O T 3 1 0 6 G O T O 1 1 0 0 3 1 0 7 C 3 1 0 8 9 0 0 I F ( T I T L E . N E . 1 0 ) G O T O 1 0 0 0 3 1 0 9 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 1 1 0 C A L L Y N A M E ( ' T H E R M A L E N E R G Y ( E V ) S ' , 1 0 0 ) 3 1 1 1 C A L L H E A D I N ( ' T H E R M A L E N E R G Y - E L E C T R O N S S ' , 1 0 0 , 2 . , 1 ) 3 1 1 2 I J P L O T = I I P L O T + 1 3 1 1 3 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - E L E C T R O N T H E R M A L " , 3 1 1 4 " E N E R G Y v s . T I M E " ) ' ) I J P L O T 3 1 1 5 G O T O 1 1 0 0 3 1 1 6 C 3 1 1 7 1 0 0 0 I F ( T I T L E . N E . 11 ) G O T O 1 0 5 0 3 1 1 8 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 1 1 9 C A L L Y N A M E ( ' T H E R M A L E N E R G Y ( E V ) S ' , 1 0 0 ) 3 1 2 0 C A L L H E A D I N ( ' T H E R M A L E N E R G Y - S P E C I E S 2 $ ' , 1 0 0 , 2 . , 1 ) 157 3 1 2 1 I J P L O T = I I P L O T + 1 3 1 2 2 W R I T E ( * . F M T = ' ( 2 X . ' ' P L O T ' ' . 1 3 , ' ' - S P E C I E S 2 T H E R M A L ' ' . 3 1 2 3 " E N E R G Y v s . T I M E ' ' ) ' ) I J P L O T 3 1 2 4 G O T O 1 1 0 0 3 1 2 5 C 3 1 2 6 1 0 5 0 I F ( T I T L E . N E . 1 2 ) G O T O 1 1 0 0 3 1 2 7 C A L L X N A M E ( ' T I M E S ' , 1 0 0 ) 3 1 2 8 C A L L Y N A M E ( ' K I N E T I C E N E R G Y ( E V ) S ' , 1 0 0 ) 3 1 2 9 C A L L H E A D I N ( ' E L E C T R O N K I N E T I C E N E R G Y S ' . 1 0 0 , 2 . , 1 ) 3 1 3 0 I J P L O T = I I P L O T + 1 3 1 3 1 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - E L E C T R O N K I N E T I C " , 3 1 3 2 " E N E R G Y v s . T I M E ' ' ) ' ) I J P L O T 3 1 3 3 C 3 1 3 4 1 1 0 0 X O R I G = T L 3 1 3 5 X M A X = T U 3 1 3 6 Y O R I G = R L 3 1 3 7 Y M A X = R U 3 1 3 8 I M A R K = 0 3 1 3 9 I F ( T I T L E . E O . 9 . A N D . L I N L O G . E Q . 0 ) X O R I G = 0 . 0 3 1 4 0 C A L L Y A X A N G ( 0 . ) 3 1 4 1 C 3 1 4 2 I F ( L I N L O G . N E . 1 . O R . R L . L E . D Z E R O ) T H E N 3143 C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' , Y M A X 3 1 4 4 E L S E 3 1 4 5 R L T = M A X ( R L , 1 . 0 D - 6 * R U ) 3 1 4 6 I F ( R L T . E O . R L ) T H E N 3 1 4 7 Y O R I G = R L T 3 1 4 8 Y C Y C L E = 1 . 0 3 1 4 9 E L S E 3 1 5 0 R L T = M A X ( R L , 1 . 0 D - 1 2 * R U ) 3 1 5 1 Y O R I G = R L T 3 1 5 2 Y C Y C L E = 0 . 5 3 1 5 3 I F ( R L T . E O . 1 . 0 D - 1 2 * R U ) T H E N 3 1 5 4 C A L L M E S S A G ( ' S O M E O U T O F R A N G E P O I N T S N O T P L O T T E D S 3 1 5 5 1 0 0 . 0 . 3 , 0 . 3 ) 3 1 5 6 E N D I F 3 1 5 7 E N D I F 3 1 5 8 X S T E P = ( T U - T L ) / 9 . 5 3 1 5 9 C A L L Y L O G ( X O R I G , X S T E P , Y O R I G , Y C Y C L E ) 3 1 6 0 E N D I F 3 1 6 1 C 3 1 6 2 c * * * * * * * * * * * c o d e t o m a n u a l l y s e t t h e s c a l e s ************: 3 1 6 3 C 3 1 6 4 C I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . O . A N D . M O D E . E O . 1 ) T H E N 3 1 6 5 C Y O R I G = 0 . 0 3 1 6 6 C Y M A X = 3 0 . 0 E - 5 3 1 6 7 C C A L L G R A F ( X O R I G , ' S C A L E ' . X M A X . Y O R I G , ' S C A L E ' , Y M A X 3 1 6 8 C E N D I F 3 1 6 9 C I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . 1 . A N D . M O D E . E O . 1 ) T H E N 3 1 7 0 C Y 0 R I G = 2 . O E - 1 6 3 1 7 1 C Y C Y C L E = 0 . 5 3 1 7 2 C X S T E P = ( T U - T L ) / 9 . 5 3 1 7 3 C C A L L Y L O G ( X O R I G , X S T E P . Y O R I G , Y C Y C L E ) 3 1 7 4 c E N D I F 3 1 7 5 c I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . O . A N D . M O D E . E Q . 2 ) T H E N 3 1 7 6 c Y O R I G = 0 . 0 3 1 7 7 c Y M A X = 3 5 . 0 E - 5 3 1 7 8 c C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' , Y M A X 3 1 7 9 c E N D I F 3 1 8 0 c I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . 1 . A N D . M O D E . E O . 2 ) T H E N 3 1 8 1 c Y 0 R I G = 3 . 0 E - 1 6 3 1 8 2 c Y C Y C L E = 0 . 5 3 1 8 3 c X S T E P = ( T U - T L ) / 9 . 5 3 1 8 4 c C A L L Y L O G ( X O R I G , X S T E P , Y O R I G , Y C Y C L E ) 3 1 8 5 c E N D I F 3 1 8 6 c I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . O . A N D . M O D E . E O . 3 ) T H E N 3 1 8 7 C Y O R I G = 0 . 0 3 1 8 8 c Y M A X = 7 . O E - 5 3 1 8 9 c C A L L G R A F ( X O R I G , ' S C A L E ' . X M A X , Y O R I G , ' S C A L E ' . Y M A X 3 1 9 0 c E N D I F IS? 3 1 9 1 C I F ( T I T L E . E O . 1 . A N D . L I N L O G . E O . 1 . A N D . M O D E . E O . 3 ) T H E N 3 1 9 2 C Y 0 R I G = 6 . O E - 1 7 3 1 9 3 C Y C Y C L E = 0 . 5 3 1 9 4 C X S T E P = ( T U - T L ) / 9 . 5 3 1 9 5 C C A L L Y L O G ( X O R I G , X S T E P , Y O R I G , Y C Y C L E ) 3 1 9 6 C E N D I F 3 1 9 7 C I F ( T I T L E . E O . 1 2 ) T H E N 3 1 9 8 C Y 0 R I G = 5 0 . 0 E - 5 3 1 9 9 C Y M A X = 8 5 . O E - 5 3 2 0 0 C C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' , Y M A X 3 2 0 1 C E N D I F 3 2 0 2 C I F ( T I T L E . E O . 2 . A N D . L I N L O G . E O . 1 ) T H E N 3 2 0 3 C Y 0 R I G = 6 . O E - 1 6 3 2 0 4 C Y C Y C L E = 0 . 5 3 2 0 5 C X S T E P = ( T U - T L ) / 9 . 5 3 2 0 6 C C A L L Y L O G ( X O R I G , X S T E P . Y O R I G , Y C Y C L E ) 3 2 0 7 C E N D I F 3 2 0 8 C I F ( T I T L E . E 0 . 3 ) T H E N 3 2 0 9 C Y 0 R I G = - O . O O 5 3 2 1 0 C Y M A X = 0 . 0 4 5 3 2 1 1 C C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' , Y M A X 3 2 1 2 C E N D I F 3 2 1 3 C I F ( T I T L E . E 0 . 9 . A N D . L I N L O G . E O . O ) T H E N 3 2 1 4 C Y 0 R I G = 1 . 6 E - 3 3 2 1 5 C Y M A X = 1 . 6 5 E - 3 3 2 1 6 C C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' . Y M A X 3 2 1 7 c E N D I F 3 2 1 8 c I F ( T I T L E . E O . 9 . A N D . L I N L O G . E O . 1 ) T H E N 3 2 1 9 c Y 0 R I G = 1 . O E - 3 3 2 2 0 c Y C Y C L E = 1 . 0 3 2 2 1 c X S T E P = ( T U - T L ) / 9 . 5 3 2 2 2 c C A L L Y L O G ( X O R I G , X S T E P , Y O R I G , Y C Y C L E ) 3 2 2 3 c E N D I F 3 2 2 4 c 3 2 2 5 c * * * * * * * * * * * M a n u a l s c a l e s e t t i n g e n d s h e r e ************ 3 2 2 6 c 3 2 2 7 3 2 2 8 c I f m o r e t h a n 1 0 0 0 t l m e s t e p s , p l o t e v e r y 2 n d , 3 r d , e t c . 3 2 2 9 3 2 3 0 I K = 1 3 2 3 1 I F ( M T H . G T . 1 0 O O ) T H E N 3 2 3 2 I K = ( M T H / 1 0 0 0 ) 3 2 3 3 I F ( M O D I M T H , 1 0 0 0 ) . G T . 0 ) I K = I K + 1 3 2 3 4 E N D I F 3 2 3 5 O K = M T H / I K 3 2 3 6 J J = 1 3 2 3 7 DO 5 1 = 1 , M T H , I K 3 2 3 8 T I M R ( J J ) = T I M ( I ) 3 2 3 9 R E C R ( J J ) = R E C ( I ) 3 2 4 0 J J = J J + 1 3 2 4 1 5 C O N T I N U E 3 2 4 2 c 3 2 4 3 T I M E R = T I M E 3 2 4 4 C A L L C U R V E ( T I M R , R E C R , J K , I M A R K ) 3 2 4 5 I F ( M O D E . N E . - 1 ) T H E N 3 2 4 6 C A L L M E S S A G ( ' M O D E N O . : $ ' , 1 0 0 , 7 . 2 , 1 . 2 ) 3 2 4 7 C A L L I N T N O ( M O D E , ' A B U T ' , ' A B U T ' ) 3 2 4 8 E N D I F 3 2 4 9 I F ( I S . N E . - 1 ) T H E N 3 2 5 0 C A L L M E S S A G ( ' S P E C I E S : $ ' , 1 0 0 . 7 . 2 , 1 . 2 ) 3 2 5 1 C A L L I N T N O ( I S , ' A B U T ' , ' A B U T ' ) 3 2 5 2 E N D I F 3 2 5 3 C A L L M E S S A G ( ' R U N T I M E : $ ' , 1 0 0 , 7 . 2 , 0 . 9 ) 3 2 5 4 C A L L R E A L N O ( T I M E R , 2 , ' A B U T ' . ' A B U T ' ) 3 2 5 5 C A L L M E S S A G ( ' D A T E : $ ' , 1 0 0 . 7 . 2 . 0 . 6 ) 3 2 5 6 C A L L I N T N O ( I D A T E , ' A B U T ' , ' A B U T ' ) 3 2 5 7 C A L L M E S S A G ( ' R U N N O . : $ ' , 1 0 0 , 7 . 2 , 0 . 3 ) 3 2 5 8 C A L L I N T N O ( I T I M E , ' A B U T ' , ' A B U T ' ) 3 2 5 9 I I P L O T = I I P L O T + 1 3 2 6 0 C A L L M E S S A G ( ' P L O T N O . : $ ' , 1 0 0 , 8 . 0 , - 0 . 7 ) 3 2 6 1 C A L L I N T N O ( I I P L O T , ' A B U T ' , ' A B U T ' ) 3 2 6 2 C A L L E N D P L ( 0 ) 3 2 6 3 C 3 2 6 4 I F ( T I T L E . E O . 9 ) T H E N 3 2 6 5 I F ( L I N L O G . N E . 0 ) T H E N 3 2 6 6 C A L L P A G E ( 1 1 . 0 . 8 . 5 0 ) 3 2 6 7 X A X I S = 9 . 5 3 2 6 8 Y A X I S = 6 . 0 3 2 6 9 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 3 2 7 0 L I N L O G = 0 3 2 7 1 G O T O 8 0 0 3 2 7 2 E N D I F 3 2 7 3 E N D I F 3 2 7 4 C 3 2 7 5 I F ( T I T L E . E O . 1 ) T H E N 3 2 7 6 I F ( L I N L O G . N E . 0 ) T H E N 3 2 7 7 C A L L P A G E ( 1 1 . 0 . 8 . 5 0 ) 3 2 7 8 X A X I S = 9 . 5 3 2 7 9 Y A X I S = 6 . 0 3 2 8 0 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 3 2 8 1 L I N L O G = 0 3 2 8 2 GO T O 5 0 3 2 8 3 E N D I F 3 2 8 4 L I N L O G = 1 3 2 8 5 E N D I F 3 2 8 6 C 3 2 8 7 R E T U R N 3 2 8 8 E N D 4 0 0 0 L. -4 0 0 1 c 4 0 0 2 S U B R O U T I N E P L O T X V ( I L , I U , V L . V U . M A R K , I M E S S ) 4 0 0 3 c 4 0 O 4 c= 4 0 0 5 c P l o t X - V X ( M a r k = 1 ) o r X - V Y ( M a r k = 2 ) p h a s e - s p a c e . 4 0 0 6 4 0 0 7 I N C L U D E ( M P A R A M ) 4 0 0 8 I N C L U D E ( M P T C L ) 4 0 0 9 I N C L U D E ( M C N T R L ) 4 0 1 0 R E A L X A X I S . Y A X I S , X O R I G , X M A X , Y O R I G , Y M A X , T I M R , T I M R 2 4 0 1 1 c 4 0 1 2 I F ( I L . G T . I U ) R E T U R N 4 0 1 3 C A L L P A G E ( 1 1 . 0 , 8 . 5 0 ) 4 0 1 4 X A X I S = 9 . 5 4 0 1 5 Y A X I S = 6 . 0 4 0 1 6 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 4 0 1 7 X O R I G = 0 . 0 4 0 1 8 X M A X = L 4 0 1 9 C A L L X N A M E ( ' X P O S I T I O N S ' , 1 0 0 ) 4 0 2 0 N P T S = I U - I L + 1 4 0 2 1 4 0 2 2 c S e t v e l o c i t y r a n g e 1 f n e c e s s a r y . 4 0 2 3 4 0 2 4 I F ( M A R K . E O . 1 ) T H E N 4 0 2 5 I F ( V L . G E . V U ) T H E N 4 0 2 6 DO 1 0 I = I L . I U 4 0 2 7 V L = M I N ( V L . V X ( I ) ) 4 0 2 8 V U = M A X ( V U . V X ( I ) ) 4 0 2 9 1 0 C O N T I N U E 4 0 3 0 I F ( A B S ( V L ) . E O . A B S ( V U ) ) T H E N 4 0 3 1 I F ( V U . E O . D Z E R O ) T H E N 4 0 3 2 V U = 1 0 . O D O 4 0 3 3 E L S E 4 0 3 4 V U = 1 . 5 D 0 * A B S ( V U ) 4 0 3 5 E N D I F 4 0 3 6 E N D I F 4 0 3 7 E N D I F 4 0 3 8 V U = M A X ( V U . A B S ( V L ) ) 4 0 3 9 V L = - V U 4 0 4 0 I F ( V U . G E . 0 . 2 5 ) T H E N 4 0 4 1 Y O R I G = - 1 . 0 4 0 4 2 Y M A X = 1 . 0 4 0 4 3 E L S E 4 0 4 4 Y O R I G = V L 4 0 4 5 Y M A X = V U 4 0 4 6 E N D I F 4 0 4 7 C A L L Y A X A N G ( 0 . ) 4 0 4 8 C A L L Y N A M E ( ' X V E L O C I T Y $ ' , 1 0 0 ) 4 0 4 9 C A L L H E A D I N ( ' P H A S E S P A C E - V X V S . X $ ' , 1 0 0 . 2 . , 1 ) 4 0 5 0 I J P L O T = I I P L O T + 1 4 0 5 1 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - P H A S E S P A C E - " , 4 0 5 2 " V X v s . X " ) ' ) I J P L O T 4 0 5 3 E L S E 4 0 5 4 I F ( V L . G E . V U ) T H E N 4 0 5 5 DO 2 0 I = I L . I U 4 0 5 6 V L = M I N ( V L . V Y ( I ) ) 4 0 5 7 V U = M A X ( V U , V Y ( I ) ) 4 0 5 8 2 0 C O N T I N U E 4 0 5 9 I F ( A B S ( V L ) . E O . A B S ( V U ) ) T H E N 4 0 6 0 I F ( V U . E O . D Z E R O ) T H E N 4 0 6 1 V U = 1 0 . O D O 4 0 6 2 E L S E 4 0 6 3 V U = 1 . 5 D 0 * A B S ( V U ) 4 0 6 4 E N D I F 4 0 6 5 E N D I F 4 0 6 6 E N D I F 4 0 6 7 V U = M A X ( V U , A B S ( V L ) ) 4 0 6 8 V L = - V U 4 0 6 9 I F ( V U . G E . 0 . 2 5 ) T H E N 4 0 7 0 Y O R I G = - 1 . 0 4 0 7 1 Y M A X = 1 . 0 4 0 7 2 E L S E 4 0 7 3 Y O R I G = V L 4 0 7 4 Y M A X = V U 4 0 7 5 E N D I F 4 0 7 6 C A L L Y A X A N G ( O . ) 4 0 7 7 C A L L Y N A M E ( ' Y V E L O C I T Y S ' , 1 0 0 ) 4 0 7 8 C A L L H E A D I N ( ' P H A S E S P A C E - V Y V S . X $ ' , 1 0 0 , 2 . , 1 ) 4 0 7 9 I J P L O T = I I P L O T + 1 4 0 8 0 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T " , I 3 . " - P H A S E S P A C E - " . 4 0 8 1 " V Y v s . X " ) ' ) I J P L O T 4 0 8 2 E N D I F 4 0 8 3 C 4 0 8 4 C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X . Y O R I G , ' S C A L E ' , Y M A X ) 4 0 8 5 C 4 0 8 6 C I f N o . p a r t i c l e s < 2 0 0 0 p l o t p l u s e s , f o r b e s t v i s i b i l i t y . 4 0 8 7 C 4 0 8 8 I F ( N P T S . L E . 2 0 0 0 ) T H E N 4 0 8 9 I F ( M A R K . E O . 1 ) T H E N 4 0 9 0 - DO 3 0 I = I L . I U 4 0 9 1 Z X ( I ) = X ( I ) 4 0 9 2 Z V ( I ) = V X ( I ) 4 0 9 3 3 0 C O N T I N U E 4 0 9 4 E L S E 4 0 9 5 DO 4 0 I = I L , I U 4 0 9 6 Z X ( I ) = X ( I ) 4 0 9 7 Z V ( I ) = V Y ( I ) 4 0 9 8 4 0 C O N T I N U E 4 0 9 9 E N D I F 4 1 0 0 I M A R K = - 1 4 1 0 1 C A L L M A R K E R ( 3 ) 4 1 0 2 C A L L C U R V E ( Z X , Z V , I U , I M A R K ) 4 1 0 3 E L S E 4 1 0 4 C 4 1 0 5 C I f m o r e t h a n 1 3 0 0 0 p a r t i c l e s , p l o t e v e r y 3 r d , o r 5 t h . . . . 4 1 0 6 C 4 1 0 7 I N T = 2 * ( N P T S / 1 3 0 0 0 ) + 3 4 1 0 8 J = 1 4 1 0 9 I F ( M A R K . E O . 1 ) T H E N 4 1 1 0 DO 5 0 I = I L , I U , I N T 4 1 1 1 Z X ( J ) = X ( I ) 4 1 1 2 4 1 1 3 4 1 1 4 4 1 1 5 4 1 1 6 4 1 1 7 4 1 1 8 4 1 1 9 4 1 2 0 4 1 2 1 4 1 2 2 4 1 2 3 4 1 2 4 4 1 2 5 4 1 2 6 4 1 2 7 C 4 1 2 8 4 1 2 9 4 1 S O 4 1 3 1 C 4 1 3 2 4 1 3 3 4 1 3 4 4 1 3 5 4 1 3 6 4 1 3 7 4 1 3 8 4 1 3 9 4 1 4 0 4 1 4 1 C 4 1 4 2 4 1 4 3 4 1 4 4 4 1 4 5 4 1 4 6 4 1 4 7 4 1 4 8 4 1 4 9 4 1 5 0 4 1 5 1 4 1 5 2 4 1 5 3 4 1 5 4 C 4 1 5 5 4 1 5 6 5 0 0 0 5 0 0 1 C 5 0 0 2 5 0 0 3 C 5 0 0 4 C = 5 0 0 5 C 1 5 0 0 6 c-5 0 0 7 5 0 0 8 5 0 0 9 5 0 1 0 C 5 0 1 1 5 0 1 2 C 5 0 1 3 5 0 1 4 5 0 1 5 5 0 1 6 5 0 1 7 5 0 1 8 5 0 1 9 5 0 2 0 C < 5 0 2 1 c-5 0 2 2 5 0 2 3 5 0 2 4 5 0 6 0 Z V ( O ) = V X ( I ) J = d + 1 C O N T I N U E E L S E DO 6 0 I Z X ( d ) = Z V ( J ) = V Y ( I ) vJ = J + 1 C O N T I N U E E N D I F I I = I U / I N T + I M A R K = - 1 C A L L M A R K E R ( - 1 ) C A L L C U R V E ( E N D I F I L , I U , I N T X ( I ) Z X , Z V , I I , I M A R K ) T I M = T I M E T I M R = T I M T I M R 2 = T I M E + 0 . 5 * D T I F ( I M E S S . E O . 1 ) T H E N C A L L M E S S A G ( ' E L E C T R O N S S E L S E I F ( I M E S S . E Q . 2 ) T H E N C A L L M E S S A G ( ' S P E C I E S 2 $ ' , E L S E C A L L M E S S A G ( ' B O T H S P E C I E S S E N D I F E N D I F 1 0 0 , 7 . 2 , 1 . 2 ) 1 0 0 , 7 . 2 . 1 . 2 ) 1 0 0 , 7 . 2 , 1 . 2 ) C A L L M E S S A G ( ' R U N T I M E C A L L R E A L N O ( T I M R . 2 , C A L L M E S S A G ( ' D A T E C A L L I N T N O ( I D A T E C A L L M E S S A G ( ' R U N N O . C A L L I N T N O ( I T I M E $ ' , 1 0 0 , 7 . 2 , A B U T ' , ' A B U T ' $ ' , 1 0 0 , 7 . 2 , ' A B U T ' , ' A B U T ' $ ' , 1 0 0 , 7 . 2 , ' A B U T ' , ' A B U T ' C A L L M E S S A G ( ' P O S I T I O N S A R E A T T I M E $ ' C A L L R E A L N O ( T I M R 2 , 2 , ' A B U T ' . ' A B U T ' 1 1 P L O T = I I P L O T + 1 C A L L M E S S A G ( ' P L O T N O . 0 . 9 ) ) 0 . 6 ) ) 0 . 3 ) ) . 1 0 0 , . 3 ) C A L L I N T N O C A L L E N D P L R E T U R N E N D ( I I P L O T ( 0 ) $ ' , 1 0 0 . 8 . 0 , • ' A B U T ' , ' A B U T ' 0 . 7 S U B R O U T I N E P L T V X Y ( I L , I U . V M U . I M E S S ) I N C L U D E ( M P A R A M ) I N C L U D E ( M P T C L ) I N C L U D E ( M C N T R L ) R E A L X A X I S , Y A X I S , X O R I G . X M A X , Y O R I G , Y M A X , T I M R I F ( I L . G T . I U ) R E T U R N C A L L P A G E ( 1 1 . O , 8 . 5 0 ) X A X I S = 9 . 5 Y A X I S = 6 . 0 C A L L A R E A 2 D ( X A X I S , Y A X I S ) N P T S = I U - I L + 1 I F ( V M U . E O . D Z E R O ) V L = V X ( I L ) V U = V L T H E N 5 0 2 5 DO 1 I = I L . I U 5 0 2 6 V L = M I N ( V L , V X ( I ) , V Y ( I ) ) 5 0 2 7 V U = M A X ( V U , V X ( I ) . V Y ( I ) ) 5 0 2 8 1 C O N T I N U E 5 0 2 9 V M U = M A X ( A B S ( V L ) , A B S ( V U ) ) 5 0 3 0 E N D I F 5 0 3 1 C 5 0 3 2 C A L L X N A M E ( ' X V E L O C I T Y $ ' . 1 0 0 ) 5 0 3 3 C A L L Y N A M E ( ' Y V E L O C I T Y S ' . 1 0 0 ) 5 0 3 4 C A L L H E A D I N ( ' V E L O C I T Y S P A C E - V Y V S . V X $ ' , 1 0 0 , 2 . , 1 5 0 3 5 I J P L O T = I I P L O T + 1 5 0 3 6 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 . " - V E O C I T Y S P A C E - " , 5 0 3 7 " V Y v s . V X " ) ' ) I J P L O T 5 0 3 8 I F ( V M U . N E . D Z E R O ) GO T O 4 5 0 3 9 V M U = 1 0 . O D O 5 0 4 0 4 C O N T I N U E 5 0 4 1 X O R I G = - V M U 5 0 4 2 X M A X = V M U 5 0 4 3 Y O R I G = - V M U 5 0 4 4 Y M A X = V M U 5 0 4 5 C A L L Y A X A N G ( 0 . ) 5 0 4 6 C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X . Y O R I G . ' S C A L E ' , Y M A X ) 5 0 4 7 C 5 0 4 8 C I f < t h a n 2 0 0 0 p a r t i c l e s , p l o t p l u s e s f o r b e s t v i s i b i l i t y . 5 0 4 9 C 5 0 5 0 I F ( N P T S . G T . 2 0 0 0 ) GO T O 3 1 5 0 5 1 C 5 0 5 2 DO 3 I = I L . I U 5 0 5 3 Z X ( I ) = V X ( I ) 5 0 5 4 Z V ( I ) = V Y ( I ) 5 0 5 5 3 C O N T I N U E 5 0 5 6 I M A R K = - 1 5 0 5 7 C A L L M A R K E R ( 3 ) 5 0 5 B C A L L C U R V E ( Z X , Z V , I U , I M A R K ) 5 0 5 9 G O T O 3 3 5 0 6 0 C 5 0 6 1 C I f m o r e t h a n 1 3 0 0 0 p a r t i c l e s , p l o t e v e r y 3 r d , o r 5 t h . . . 5 0 6 2 C 5 0 6 3 3 1 I N T = 2 * ( N P T S / 1 3 0 0 0 ) + 1 5 0 6 4 J = 1 5 0 6 5 C 5 0 6 6 DO 3 2 I = I L . I U , I N T 5 0 6 7 Z X ( J ) = V X ( I ) 5 0 6 8 Z V ( J ) = V Y ( I ) 5 0 6 9 J = J + 1 5 0 7 0 3 2 C O N T I N U E 5 0 7 1 C 5 0 7 2 I I = I U / I N T + 1 5 0 7 3 I M A R K = - 1 5 0 7 4 C A L L M A R K E R ( - 1 ) 5 0 7 5 C A L L C U R V E ( Z X , Z V , I I , I M A R K ) 5 0 7 6 3 3 C O N T I N U E 5 0 7 7 T I M = T I M E + 0 . 5 D 0 * D T 5 0 7 8 T I M R = T I M 5 0 7 9 C 5 0 8 0 I F ( I M E S S . E O . 1 ) T H E N 5 0 8 1 C A L L M E S S A G ( ' E L E C T R O N S * ' , 1 0 0 , 7 . 2 , 1 . 2 ) 5 0 8 2 E L S E 5 0 8 3 I F ( I M E S S . E O . 2 ) T H E N 5 0 8 4 C A L L M E S S A G ( ' S P E C I E S 2 $ ' . 1 0 0 , 7 . 2 , 1 . 2 ) 5 0 8 5 E L S E 5 0 8 6 C A L L M E S S A G ( ' B O T H S P E C I E S 2 $ ' , 1 0 0 , 7 . 2 , 1 . 2 ) 5 0 8 7 E N D I F 5 0 8 8 E N D I F 5 0 8 9 C 5 0 9 0 C A L L M E S S A G ( ' R U N T I M E : $ ' , 1 0 0 , 7 . 2 , 0 . 9 ) 5 0 9 1 C A L L R E A L N O ( T I M R . 2 . ' A B U T ' , ' A B U T ' ) 5 0 9 2 C A L L M E S S A G ( ' D A T E : $ ' , 1 0 0 , 7 . 2 , 0 . 6 ) 5 0 9 3 C A L L I N T N O ( I D A T E . ' A B U T ' , ' A B U T ' ) 5 0 9 4 C A L L M E S S A G ( ' R U N N O . : $ ' , 1 0 0 , 7 . 2 . 0 . 3 ) 5 0 9 5 C A L L I N T N O ( I T I M E . ' A B U T ' , ' A B U T ' ) 5 0 9 6 5 0 9 7 5 0 9 8 5 0 9 9 5 1 0 0 5 1 0 1 5 1 0 2 6 0 0 0 6 0 0 1 6 0 0 2 6 0 0 3 6 0 0 4 6 0 0 5 6 0 0 6 6 0 0 7 6 0 0 8 6 0 0 9 6 0 1 0 6 0 1 1 6 0 1 2 6 0 1 3 6 0 1 4 6 0 1 5 6 0 1 6 6 0 1 7 6 0 1 8 6 0 1 9 6 0 2 0 6 0 2 1 6 0 2 2 6 0 2 3 6 0 2 4 6 0 2 5 6 0 2 6 6 0 2 7 6 0 2 8 6 0 2 9 6 0 3 0 6 0 3 1 6 0 3 2 6 0 3 3 6 0 3 4 6 0 3 5 6 0 3 6 6 0 3 7 6 0 3 8 6 0 3 9 6 0 4 0 6 0 4 1 6 0 4 2 6 0 4 3 6 0 4 4 6 0 4 5 6 0 4 6 6 0 4 7 6 0 4 8 6 0 4 9 6 0 5 0 6 0 5 1 6 0 5 2 6 0 5 3 6 0 5 4 6 0 5 5 6 0 5 6 6 0 5 7 6 0 5 8 6 0 5 9 6 0 6 0 6 0 6 1 6 0 6 2 6 0 6 3 1 1 P L O T = I I P L O T + 1 C A L L M E S S A G ( ' P L O T N O . C A L L I N T N O ( I I P L O T C A L L E N D P L ( 0 ) R E T U R N E N D /t>3 $ ' , 1 0 0 , 8 . 0 , - 0 . 7 ) ' A B U T ' , ' A B U T ' ) : ts a * = E e S U B R O U T I N E P L T F O V ( I L . I U , V L , V U , V V , N B I N S P . T I T L E . 1 1 F O V , T E M P 1 , T E M P 2 ) P l o t t h e d i s t r i b u t i o n f u n c t i o n f ( v ) . I f I F O V I s n e g a t i v e , m a k e b o t h s e m i - l o g a n d c a r t e s i a n p l o t s . I N C L U D E ( M P A R A M ) I N C L U D E ( M P T C L ) I N C L U D E ( M C N T R L ) I N C L U D E ( M T H E R M ) R E A L X A X I S , Y A X I S , X O R I G , X M A X . Y O R I G , Y M A X , T I M R , X S T E P , Y C Y C L E . T V B I N , T F B I N , R T E M P 1 , R T E M P 2 P A R A M E T E R ( M A X B I N = 1 0 0 ) C O M M O N / S C R A T C / V B I N ( M A X B I N ) , B I N ( M A X B I N ) , T V B I N ( M A X B I N ) , T F B I N ( M A X B I N ) I N T E G E R T I T L E ' D I M E N S I O N V V ( I U ) I F O V = I I F O V R T E M P 1 = T E M P I R T E M P 2 = T E M P 2 N B I N S m u s t h o t e x c e e d d i m e n s i o n o f t h e s e a r r a y s . N B I N S = M I N ( N B I N S P , M A X B I N ) I F ( T I T L E . E O . 1 . O R . T I T L E . E O . T I T L E . E O . 3 ) T H E N V L = D Z E R O V U = L E L S E 2 . O R . F i n d v e l o c i t y r a n g e . I F ( V L . E O . D Z E R O . A N D . V U . E O . D Z E R O ) T H E N V L = V V ( I L ) V U = V L DO 1 I = I L , I U V L = M I N ( V L . V V ( I ) ) V U = M A X ( V U , V V ( I ) ) C O N T I N U E V U = M A X ( V U , A B S ( V L ) ) V L = - V U E N D I F E N D I F I F ( V L . E Q . V U . O R . N B I N S . L E . C A L L P A G E ( 1 1 . 0 . 8 . 5 0 ) X A X I S = 9 . 5 Y A X I S = 6 . 0 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 1 ) R E T U R N : A s s i g n b i n m i d p o i n t s a n d i n i t i a l i z e b i n s t o z e r o . D O 1 0 J = 1 , N B I N S B I N ( J ) = D Z E R O V B I N ( d ) = V L + ( V U - V L ) * ( F L 0 A T ( d ) - O . 5 D O ) / F L 0 A T ( N B I N S ) 1 0 C O N T I N U E : A s s i g n V V ' s t o b i n s w i t h l i n e a r w e i g h t i n g . D O 2 0 I = I L . I U X X X = N B I N S * ( V V ( I ) - V L ) / ( V U - V L ) J J = X X X + 1 I(p+ 6 0 6 4 I F ( J J . G T . N B I N S . O R . J J . L T . 1 ) GO T O 2 0 6 0 6 5 B I N ( J J ) = B I N ( J J ) + 1 . O D O 6 0 6 6 2 0 C O N T I N U E 6 0 6 7 C 6 0 6 8 C A L L C A R T M M ( N B I N S . R M I N , R M A X , B I N ) 6 0 6 9 1 0 0 C O N T I N U E 6 0 7 0 C 6 0 7 1 I F ( T I T L E . E O . 1 ) T H E N 6 0 7 2 C A L L X N A M E ( ' X - P O S I T I O N S ' , 1 0 0 ) 6 0 7 3 C A L L Y N A M E ( ' N O . O F P A R T I C L E S S ' , 1 0 0 ) 6 0 7 4 C A L L H E A D I N ( ' E L E C T R O N D I S T R I B U T I O N I N S P A C E S ' , 1 0 0 , 2 . , 1 ) 6 0 7 5 I J P L O T = I I P L O T + 1 6 0 7 6 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T ' ' , 1 3 , ' ' - E L E C T R O N D I S T R I B U T I O N ' ' , 6 0 7 7 " I N S P A C E . " ) ' ) I J P L O T 6 0 7 8 E L S E 6 0 7 9 C 6 0 8 0 I F ( T I T L E . E O . 2 ) T H E N 6 0 8 1 C A L L X N A M E ( ' X - P O S I T I O N S ' , 1 0 0 ) 6 0 8 2 C A L L Y N A M E ( ' N O . O F P A R T I C L E S S ' , 1 0 0 ) 6 0 8 3 C A L L H E A D I N ( ' S P E C I E S 2 - D I S T . I N S P A C E S ' , 1 0 0 , 2 . , ^ 1 ) 6 0 8 4 I J P L O T = I I P L O T + 1 6 0 8 5 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - S P E C I E S 2 D I S T R I B U T I O N " , 6 0 8 6 " I N S P A C E . " ) ' ) I J P L O T 6 0 8 7 E L S E 6 0 8 8 C 6 0 8 9 ' I F ( T I T L E . E O . 3 ) T H E N 6 0 9 0 C A L L X N A M E ( ' X - P O S I T I O N S ' , 1 0 0 ) 6 0 9 1 C A L L Y N A M E ( ' N O . O F P A R T I C L E S S ' , 1 0 0 ) 6 0 9 2 C A L L H E A D I N ( ' A L L P A R T I C L E S - D I S T . I N S P A C E S ' , 1 0 0 , 2 . . 1 ) 6 0 9 3 I J P L O T = I I P L O T + 1 6 0 9 4 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - A L L P A R T I C L E S D I S T R I B U " , 6 0 9 5 " T I O N I N S P A C E . " ) ' ) I J P L O T 6 0 9 6 E L S E 6 0 9 7 C 6 0 9 8 I F ( T I T L E . E O . 4 ) T H E N 6 0 9 9 C A L L X N A M E ( ' V E L O C I T Y S ' , 1 0 0 ) 6 1 0 0 C A L L Y N A M E ( ' D I S T R I B U T I O N F N . - F ( V X ) $ ' , 1 0 0 ) 6 1 0 1 C A L L H E A D I N ( ' E L E C T R O N S : F ( V X ) - V E L O C I T Y D I S T . S ' , 6 1 0 2 1 0 0 , 2 . , 1 ) 6 1 0 3 I J P L O T = I I P L O T + 1 6 1 0 4 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - E L E C T R O N S " , 6 1 0 5 . " F ( V X ) . " ) ' ) I J P L O T 6 1 0 6 E L S E 6 1 0 7 C 6 1 0 8 I F ( T I T L E . E O . 5 ) T H E N 6 1 0 9 C A L L X N A M E ( ' V E L O C I T Y S ' , 1 0 0 ) 6 1 1 0 C A L L - Y N A M E ( ' D I S T R I B U T I O N F N . - F ( V Y ) $ ' , 1 0 0 ) 6 1 1 1 C A L L H E A D I N ( ' E L E C T R O N S : F ( V Y ) - V E L O C I T Y D I S T . S ' . 6 1 1 2 1 0 0 , 2 . , 1 ) 6 1 1 3 I J P L O T = I I P L O T + 1 6 1 1 4 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - E L E C T R O N S " , 6 1 1 5 " F ( V Y ) . " ) ' ) I J P L O T 6 1 1 6 E L S E 6 1 1 7 C 6 1 1 8 I F ( T I T L E . E O . 6 ) T H E N 6 1 1 9 C A L L X N A M E ( ' V E L O C I T Y * ' , 1 0 0 ) 6 1 2 0 C A L L Y N A M E ( ' D I S T R I B U T I O N F N . - F ( V X ) $ ' , 1 0 0 ) 6 1 2 1 C A L L H E A D I N ( ' S P E C I E S 2 : F ( V X ) - V E L O C I T Y D I S T . S ' , 6 1 2 2 1 0 0 , 2 . , 1 ) 6 1 2 3 I J P L O T = I I P L O T + 1 6 1 2 4 W R I T E ( * , F M T = ' ( 2 X . " P L O T " , I 3 , " - S P E C I E S 2 " , 6 1 2 5 " F ( V X ) . " ) ' ) I J P L O T 6 1 2 6 E L S E 6 1 2 7 C 6 1 2 8 I F ( T I T L E . E O . 7 ) T H E N 6 1 2 9 C A L L X N A M E ( ' V E L O C I T Y S ' , 1 0 0 ) 6 1 3 0 C A L L Y N A M E ( ' D I S T R I B U T I O N F N . - F ( V Y ) $ ' , 1 0 0 ) 6 1 3 1 C A L L H E A D I N ( ' S P E C I E S 2 : F ( V Y ) - V E L O C I T Y D I S T . S ' , 6 1 3 2 1 0 0 , 2 . . 1 ) 6 1 3 3 I J P L O T = I I P L O T + 1 6 1 3 4 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - S P E C I E S 2 " . 6 1 3 5 " F ( V Y ) . " ) ' ) I J P L O T 6 1 3 6 E L S E 6 1 3 7 C 6 1 3 8 I F ( T I T L E . E O . 8 ) T H E N 6 1 3 9 C A L L X N A M E ( ' V E L O C I T Y * ' , 1 0 0 ) 6 1 4 0 C A L L Y N A M E ( ' D I S T R I B U T I O N F N . - F ( V X ) $ ' , 1 0 0 ) 6 1 4 1 C A L L H E A D I N ( ' F ( V X ) - A L L P A R T I C L E S * ' , 1 0 0 , 2 . , 1 ) 6 1 4 2 I J P L O T = I I P L O T + 1 6 1 4 3 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T ' ' . I B , ' ' - A L L P A R T I C L E S " . 6 1 4 4 ' ' F ( V X ) . " ) ' ) I J P L O T 6 1 4 5 E N D I F 6 1 4 6 E N D I F 6 1 4 7 E N D I F 6 1 4 8 E N D I F 6 1 4 9 E N D I F 6 1 5 0 E N D I F 6 1 5 1 E N D I F 6 1 5 2 E N D I F 6 1 5 3 C 6 1 5 4 X O R I G = V L 6 1 5 5 X M A X = V U 6 1 5 6 Y O R I G = 0 . 0 6 1 5 7 Y M A X = R M A X 6 1 5 8 I M A R K = 0 6 1 5 9 C A L L Y A X A N G ( 0 . ) 6 1 6 0 C 6 1 6 1 I F ( I F O V . G E . Z E R O ) T H E N 6 1 6 2 C A L L G R A F ( X O R I G . ' S C A L E ' . X M A X , Y O R I G , ' S C A L E ' . Y M A X ) 6 1 6 3 E L S E 6 1 6 4 R M I N = M A X ( R M I N . 1 . 0 D - 5 * R M A X ) 6 1 6 5 Y O R I G = R M I N 6 1 6 6 X S T E P = ( V U - V L ) / 9 . 5 6 1 6 7 Y C Y C L E = 1 . 6 1 6 8 C A L L Y L O G ( X O R I G , X S T E P , Y O R I G , Y C Y C L E ) 6 1 6 9 E N D I F 6 1 7 0 C 6 1 7 1 I F ( T I M E . G T . D Z E R O ) T H E N 6 1 7 2 T I M = T I M E - 0 . 5 * D T 6 1 7 3 E L S E 6 1 7 4 T I M = T I M E 6 1 7 5 E N D I F 6 1 7 6 T I M R = T I M 6 1 7 7 C 6 1 7 8 DO 5 I = 1 , N B I N S 6 1 7 9 T V B I N ( I ) = V B I N ( I ) 6 1 8 0 T F B I N ( I ) = B I N ( I ) 6 1 8 1 5 C O N T I N U E 6 1 8 2 C 6 1 8 3 I F ( T I T L E . E O . 4 . O R . T I T L E . E O . 5 ) T H E N 6 1 8 4 C A L L M E S S A G ( ' T E M P I : $ ' , 1 0 0 , 7 . 2 , 1 . 2 ) 6 1 8 5 C A L L R E A L N O ( R T E M P 1 , 2 , ' A B U T ' , ' A B U T ' ) 6 1 8 6 E L S E 6 1 8 7 I F ( T I T L E . E O . 6 . O R . T I T L E . E O . 7 ) T H E N 6 1 8 8 C A L L M E S S A G ( ' T E M P 2 : $ ' , 1 0 0 , 7 . 2 , 1 . 2 ) 6 1 8 9 C A L L R E A L N O ( R T E M P 2 , 2 , ' A B U T ' , ' A B U T ' ) 6 1 9 0 E L S E 6 1 9 1 I F ( T I T L E . E O . 8 ) T H E N 6 1 9 2 C A L L M E S S A G ( ' T E M P I : $ ' , 1 0 0 , 7 . 2 , 1 . 5 ) 6 1 9 3 C A L L R E A L N O ( R T E M P 1 , 2 , ' A B U T ' , ' A B U T ' ) 6 1 9 4 C A L L M E S S A G ( ' T E M P 2 : $ ' , 1 0 0 , 7 . 2 , 1 . 2 ) 6 1 9 5 C A L L R E A L N O ( R T E M P 2 , 2 , ' A B U T ' , ' A B U T ' ) 6 1 9 6 E N D I F 6 1 9 7 E N D I F 6 1 9 8 E N D I F 6 1 9 9 C 6 2 0 0 C A L L C U R V E ( T V B I N , T F B I N , N B I N S , I M A R K ) 6 2 0 1 C A L L M E S S A G ( ' R U N T I M E : $ ' , 1 0 0 , 7 . 2 , 0 . 9 ) 6 2 0 2 C A L L R E A L N O ( T I M R , 2 , ' A B U T ' , ' A B U T ' ) 6 2 0 3 C A L L M E S S A G ( ' D A T E : $ ' , 1 0 0 , 7 . 2 , 0 . 6 ) 6 2 0 4 C A L L I N T N O ( I D A T E , ' A B U T ' , ' A B U T ' ) 6 2 0 5 C A L L M E S S A G ( ' R U N N O . : $ ' , 1 0 0 , 7 . 2 , 0 . 3 ) 6 2 0 6 C A L L I N T N O ( I T I M E , ' A B U T ' , ' A B U T ' ) 6 2 0 7 I I P L O T = I I P L O T + 1 6 2 0 8 C A L L M E S S A G ( ' P L O T N O . : $ ' , 1 0 0 , 8 . 0 . - 0 . 7 ) 6 2 0 9 C A L L I N T N O ( I I P L O T . ' A B U T ' , ' A B U T ' ) 6 2 1 0 C A L L E N D P L ( O ) 6 2 1 1 C 6 2 1 2 I F ( I F O V . L T . Z E R O ) T H E N 6 2 1 3 C A L L P A G E ( 1 1 . 0 , 8 . 5 0 ) 6 2 1 4 X A X I S = 9 . 5 6 2 1 5 Y A X I S = 6 . 0 6 2 1 6 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 6 2 1 7 I F O V = A B S ( I F O V ) 6 2 1 8 G O T O 1 0 0 6 2 1 9 E N D I F 6 2 2 0 C 6 2 2 1 R E T U R N 6 2 2 2 E N D 7 0 0 0 C=========================================================== 7 0 0 1 C 7 0 0 2 S U B R O U T I N E P L O T F ( F , T I T L E ) 7 0 0 3 C 7 0 0 4 c=========================================================== 7 0 0 5 C P l o t f i e l d s o r e l e c t r o n / 1 o n t e m p e r a t u r e s . 7 0 0 6 C -7 0 0 7 I N C L U D E ( M P A R A M ) 7 0 0 8 I N C L U D E ( M F I E L D ) 7 0 0 9 I N C L U D E ( M C N T R L ) 7 0 1 0 I N T E G E R T I T L E 7 0 1 1 D O U B L E P R E C I S I O N X J ( N G 1 M ) . F ( 1 ) 7 0 1 2 R E A L X A X I S , Y A X I S , X O R I G , X M A X , Y O R I G , Y M A X , T I M E R , 7 0 1 3 T X J ( N G 1 M ) , T F ( N G 1 M ) 7 0 1 4 C 7 0 1 5 N G 1 = N G + 1 7 0 1 6 D A T A X d ( 2 ) / O . O D O / 7 0 1 7 I F ( X J ( 2 ) . N E . D X ) T H E N 7 0 1 8 DO 1 J = 1 . N G 1 7 0 1 9 X J ( J ) = ( J - 1 ) * D X 7 0 2 0 1 C O N T I N U E 7 0 2 1 E N D I F 7 0 2 2 C 7 0 2 3 C A L L C A R T M M ( N G 1 , R M I N , R M A X , F ) 7 0 2 4 I F ( J F L A G . E O . O ) T H E N 7 0 2 5 C -7 0 2 6 C I f J F L A G . E O . O t h e n j u s t d e t e r m i n e m a x & m 1 n v a l u e s f o r 7 0 2 7 C l a t e r u s e w h e n s e t t i n g s c a l e s v i a J F L A G . L T . O 7 0 2 8 C 7 0 2 9 I F ( T I T L E . E O . 1 ) T H E N 7 0 3 0 C D M I N = M I N ( C D M I N , R M I N ) 7 0 3 1 C D M A X = M A X ( C D M A X , R M A X ) 7 0 3 2 E L S E 7 0 3 3 I F ( T I T L E . E O . 2 ) T H E N 7 0 3 4 S D M I N = M I N ( S D M I N , R M I N ) 7 0 3 5 S D M A X = M A X ( S D M A X , R M A X ) 7 0 3 6 E L S E 7 0 3 7 I F ( T I T L E . E O . 3 ) T H E N 7 0 3 8 E P M I N = M I N ( E P M I N , R M I N ) 7 0 3 9 E P M A X = M A X ( E P M A X , R M A X ) 7 0 4 0 E L S E 7 0 4 1 I F ( T I T L E . E O . 4 ) T H E N 7 0 4 2 E F M I N = M I N ( E F M I N , R M I N ) 7 0 4 3 E F M A X = M A X ( E F M A X , R M A X ) 7 0 4 4 E L S E 7 0 4 5 I F ( T I T L E . E O . 5 ) T H E N 7 0 4 6 E T M I N = M I N ( E T M I N , R M I N ) 7 0 4 7 E T M A X = M A X ( E T M A X , R M A X ) 7 0 4 8 E L S E 7 0 4 9 I F ( T I T L E . E O . 6 ) T H E N 7 0 5 0 I T M I N = M I N ( I T M I N , R M I N ) 7 0 5 1 I T M A X = M A X ( I T M A X . R M A X ) 7 0 5 2 E N D I F 7 0 5 3 E N D I F 7 0 5 4 E N D I F 7 0 5 5 E N D I F 7 0 5 6 E N D I F 7 0 5 7 E N D I F 7 0 5 8 R E T U R N 7 0 5 9 E N D I F 7 0 6 0 C 7 0 6 1 C A L L P A G E ( 1 1 . 0 . 8 . 5 0 ) 7 0 6 2 X A X I S = 9 . 5 7 0 6 3 Y A X I S = 6 . 0 7 0 6 4 C A L L A R E A 2 D ( X A X I S . Y A X I S ) 7 0 6 5 C 7 0 6 6 I F ( T I T L E . E O . 1 ) T H E N 7 0 6 7 C A L L X N A M E ( ' X P O S I T I O N S ' . 1 0 0 ) 7 0 6 8 C A L L Y N A M E ( ' C H A R G E D E N S I T Y * ' . 1 0 0 ) 7 0 6 9 C A L L H E A D I N ( ' C H A R G E D E N S I T Y * ' . 1 0 0 , 2 . . 1 ) 7 0 7 0 I J P L O T = I I P L O T + 1 7 0 7 1 W R I T E ( * , F M T = ' ( 2 X , ' ' P L O T " . 1 3 . ' ' - C H A R G E " , 7 0 7 2 ' ' D E N S I T Y . " ) ' ) I J P L O T 7 0 7 3 E L S E 7 0 7 4 I F ( T I T L E . E O . 2 ) T H E N 7 0 7 5 C A L L X N A M E ( ' X P O S I T I O N * ' , 1 0 0 ) 7 0 7 6 C A L L Y N A M E ( ' S M O O T H E D D E N S I T Y * ' , 1 0 0 ) 7 0 7 7 C A L L H E A D I N ( ' S M O O T H E D D E N S I T Y * ' , 1 0 0 , 2 . , 1 ) 7 0 7 8 I J P L O T = I I P L O T + 1 7 0 7 9 W R I T E ( * , F M T = ' ( 2 X . ' ' P L O T " . 1 3 , " - S M O O T H E D C H A R G E ' 7 0 8 0 ' ' D E N S I T Y . " ) ' ) I J P L O T 7 0 8 1 E L S E 7 0 8 2 I F ( T I T L E . E O . 3 ) T H E N 7 0 8 3 C A L L X N A M E ( ' X P O S I T I O N * ' . 1 0 0 ) 7 0 8 4 C A L L Y N A M E ( ' E L E C T R O S T A T I C P O T E N T I A L * ' . 1 0 0 ) 7 0 8 5 C A L L H E A D I N ( ' E L E C T R O S T A T I C P O T E N T I A L * ' , 1 0 0 , 2 . , 7 0 8 6 I J P L O T = I I P L O T + 1 7 0 8 7 W R I T E ( * , F M T = ' ( 2 X , " P L O T " . 1 3 , " - E L E C T R O S T A T I C 7 0 8 8 " P O T E N T I A L . " ) ' ) I J P L O T 7 0 8 9 E L S E 7 0 9 0 I F ( T I T L E . E O . 4 ) T H E N 7 0 9 1 C A L L X N A M E ( ' X P O S I T I O N * ' . 1 0 0 ) 7 0 9 2 C A L L Y N A M E ( ' E L E C T R I C F I E L D * ' , 1 0 0 ) 7 0 9 3 C A L L H E A D I N ( ' E L E C T R I C F I E L D * ' , 1 0 0 . 2 . . 1 ) 7 0 9 4 I J P L O T = I I P L O T + 1 7 0 9 5 W R I T E ( * . F M T = ' ( 2 X , " P L O T " . 1 3 , " - E L E C T R I C " , 7 0 9 6 " F I E L D . " ) ' ) I J P L O T 7 0 9 7 E L S E 7 0 9 8 I F ( T I T L E . E O . 5 ) T H E N 7 0 9 9 C A L L X N A M E ( ' X P O S I T I O N * ' , 1 0 0 ) 7 1 0 0 C A L L Y N A M E ( ' E L E C T R O N T E M P E R A T U R E * ' , 1 0 0 ) 7 1 0 1 C A L L H E A D I N ( ' R E L A T I V E E L E C T R O N T E M P . ( E V ) $ ' , 1 0 0 7 1 0 2 I J P L O T = I I P L O T + 1 7 1 0 3 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - R E L . E L E C T R O N 7 1 0 4 ' ' T E M P . " ) ' ) I J P L O T 7 1 0 5 E L S E 7 1 0 6 I F ( T I T L E . E Q . 6 ) T H E N 7 1 0 7 C A L L X N A M E ( ' X P O S I T I O N * ' . 1 0 0 ) 7 1 0 8 C A L L Y N A M E ( ' I O N T E M P E R A T U R E * ' , 1 0 0 ) 7 1 0 9 C A L L H E A D I N ( ' I O N T E M P E R A T U R E ( E V ) * ' . 1 0 0 , 2 . , 7 1 1 0 I J P L O T = I I P L O T + 1 7 1 1 1 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - R E L . I O N " , 7 1 1 2 ' ' T E M P . ' . ' ) ' ) I J P L O T 7 1 1 3 E N D I F 7 1 1 4 E N D I F 7 1 1 5 E N D I F 7 1 1 6 E N D I F 7 1 1 7 E N D I F 7 1 1 8 E N D I F 7 1 1 9 C 7 1 2 0 I F ( R M I N . E O . R M A X ) T H E N 7 1 2 1 I F ( R M I N . E O . D Z E R O ) T H E N 7 1 2 2 R M A X = 1 0 . 0 0 0 7 1 2 3 E L S E 7 1 2 4 R M A X = 1 . 5 D 0 * A B S ( R M A X ) I 7 1 2 5 7 1 2 6 7 1 2 7 C 7 1 2 8 7 1 2 9 7 1 3 0 C 7 1 3 1 7 1 3 2 7 1 3 3 7 1 3 4 7 1 3 5 7 1 3 6 7 1 3 7 7 1 3 8 7 1 3 9 7 1 4 0 7 1 4 1 7 1 4 2 C 7 1 4 3 7 1 4 4 7 1 4 5 C 7 1 4 6 7 1 4 7 7 1 4 8 7 1 4 9 C 7 1 5 0 7 1 5 1 7 1 5 2 7 1 5 3 7 1 5 4 7 1 5 5 7 1 5 6 7 1 5 7 7 1 5 8 7 1 5 9 7 1 6 0 7 1 6 1 7 1 6 2 7 1 6 3 C 7 1 6 4 7 1 6 5 8 0 0 0 C 8 0 0 1 C 8 0 0 2 8 0 0 3 C 8 0 0 4 C 8 0 0 5 C 8 0 0 6 C 8 0 0 7 C 8 0 0 8 8 0 0 9 8 0 1 0 C 8 0 1 1 8 0 1 2 8 0 1 3 C 8 0 1 4 8 0 1 5 C 8 0 1 6 8 0 1 7 8 0 1 8 8 0 1 9 8 0 2 0 C 8 0 2 1 8 0 2 2 E N D I F E N D I F R M A X R M I N /IS M A X ( R M A X , - R M A X A B S ( R M I N ) ) T H E N I F ( J F L A G . L T . Z E R O ) X O R I G = X X O R I G X X M A X M I N ( Y Y O R I G , R M I N ) X M A X Y O R I G Y M A X E L S E X O R I G X M A X Y O R I G Y M A X E N D I F I M A R K = 0 C A L L Y A X A N G ( 0 . ) = M A X ( Y Y M A X , R M A X ) = O . O = L = R M I N = R M A X DO 7 1=1 T X d ( I ) = T F ( I ) • N G 1 X J ( I ) ' F ( I ) T I M E R = T I M E C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , C A L L C U R V E ( T X d , T F . N G + 1 . I M A R K ) ' S C A L E ' , Y M A X ) C A L L M E S S A G ( ' R U N T I M E C A L L R E A L N O ( T I M E R , 2 , C A L L M E S S A G ( ' D A T E C A L L I N T N O ( I D A T E C A L L M E S S A G ( ' R U N N O . C A L L I N T N O ( I T I M E I I P L O T = I I P L O T + 1 C A L L M E S S A G ( ' P L O T N O . $ ' , 1 0 0 ' A B U T ' , $ ' , 1 0 O ' A B U T ' , $ ' , 1 0 0 ' A B U T ' , 7 . 2 , A B U T ' 7 . 2 , A B U T ' 7 . 2 , A B U T ' C A L L I N T N O C A L L E N D P L R E T U R N E N D ( I I P L O T ( 0 ) $ ' , 1 0 0 , 8 . 0 , - 0 . 7 A B U T ' , ' A B U T ' 0 . 9 ) ) 0 . 6 ) ) ) ) ) ) 0 . 3 S U B R O U T I N E C A R T M M ( N , R L , R U , R E C ) I M P L I C I T D O U B L E P R E C I S I O N ( A - H . 0 - Z ) D I M E N S I O N R E C ( N ) R U = R E C ( 1 ) R L = R U I F ( N . E O . 1 ) R E T U R N DO 1 0 I = 2 . N R U = M A X ( R U , R E C ( I ) ) R L = M I N ( R L , R E C ( I ) ) 1 0 C O N T I N U E R E T U R N E N D 9 0 0 1 C 9 0 0 2 S U B R O U T I N E P S P E C 9 0 0 3 C 9 0 0 4 c============================================================= 9 0 0 5 C P l o t e n e r g y s p e c t r u m . 9 0 0 6 C 9 0 0 7 I N C L U D E ( M P A R A M ) 9 0 0 8 I N C L U D E ( M F I E L D ) 9 0 0 9 I N C L U D E ( M C N T R L ) 9 0 1 0 D O U B L E P R E C I S I O N X J ( N G 1 M ) 9 0 1 1 R E A L X A X I S , Y A X I S , X O R I G . X M A X , Y O R I G , Y M A X , T I M E R , 9 0 1 2 T X J ( N G 1 M ) , T F ( N G 1 M ) 9 0 1 3 C 9 0 1 4 N G 2 P = N G / 2 + 1 9 0 1 5 C 9 0 1 6 C A L L C A R T M M ( N G 2 P , R L , R U , E K ) 9 0 1 7 C 9 0 1 8 C A L L P A G E ( 1 1 . 0 , 8 . 5 0 ) 9 0 1 9 X A X I S = 9 . 5 9 0 2 0 Y A X I S = 6 . 0 9 0 2 1 C A L L A R E A 2 D ( X A X I S , Y A X I S ) 9 0 2 2 C 9 0 2 3 C A L L X N A M E ( ' M O D E N U M B E R S ' , 1 0 0 ) 9 0 2 4 . C A L L Y N A M E ( ' M O D E E N E R G Y S ' , 1 0 0 ) 9 0 2 5 C A L L H E A D I N ( ' E N E R G Y S P E C T R U M S ' . 1 0 0 . 2 . . 1 ) 9 0 2 6 I J P L O T = I I P L O T + 1 9 0 2 7 W R I T E ( * , F M T = ' ( 2 X , " P L O T " , I 3 , " - E N E R G Y " , 9 0 2 8 " S P E C T R U M . " ) ' ) I J P L O T 9 0 2 9 C 9 0 3 0 X O R I G = 0 . 0 9 0 3 1 X M A X = N G 2 P 9 0 3 2 Y O R I G = 0 . 0 9 0 3 3 Y M A X = 1 . 0 9 0 3 4 I M A R K = 0 9 0 3 5 C A L L Y A X A N G ( O . ) 9 0 3 6 C 9 0 3 7 DO 7 1 = 1 , N G 2 P 9 0 3 8 T X J ( I ) = 1 - 1 9 0 3 9 7 T F ( I ) = ( E K ( I ) / R U ) 9 0 4 0 C 9 0 4 1 T I M E R = T I M E 9 0 4 2 C A L L G R A F ( X O R I G , ' S C A L E ' , X M A X , Y O R I G , ' S C A L E ' , Y M A X ) 9 0 4 3 C A L L C U R V E ( T X J , T F , N G 2 P , I M A R K ) 9 0 4 4 C A L L M E S S A G ( ' R U N T I M E : $ ' , 1 0 0 , 7 . 2 , 0 . 9 ) 9 0 4 5 C A L L R E A L N O ( T I M E R , 2 , ' A B U T ' , ' A B U T ' ) 9 0 4 6 C A L L M E S S A G ( ' D A T E : $ ' . 1 0 0 . 7 . 2 , 0 . 6 ) 9 0 4 7 C A L L I N T N O ( I D A T E , ' A B U T ' , ' A B U T ' ) 9 0 4 8 C A L L M E S S A G ( ' R U N N O . : $ ' , 1 0 0 , 7 . 2 , 0 . 3 ) 9 0 4 9 C A L L I N T N O ( I T I M E , ' A B U T ' , ' A B U T ' ) 9 0 5 0 I I P L O T = I I P L O T + 1 9 0 5 1 C A L L M E S S A G ( ' P L O T N O . : S ' , 1 0 0 , 8 . 0 , - 0 . 7 ) 9 0 5 2 C A L L I N T N O ( I I P L O T , ' A B U T ' . ' A B U T ' ) 9 0 5 3 C A L L E N D P L ( 0 ) 9 0 5 4 C 9 0 5 5 R E T U R N 9 0 5 6 E N D 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0085294/manifest

Comment

Related Items