Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help me with algorithm I can't find a way to code this. Please send the code I will ever be grateful to you. For

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedPlease Help me with algorithm I can't find a way to code this. Please send the code I will ever be grateful to you. For full pdf go to - send (ohiolink.edu)

CHAPTER III IMPLEMENTATION OF THE EVENT DRIVEN MONTE CARLO METHOD 3.1 Software and hardware To perform simulations with the BKL algorithm we wrote C programs for the simulations and Matlab (7.7.0 R2008B) scripts for system setup and some of the evaluations. The C-code was developed with the gnu C-compiler under the Cygwin bash shell. Production simulations were performed on a cluster of Intel Pentium (3.0 GHz) processors and typically took between fourteen and 28 days to complete. The C-code for the simulation consists of five header files, Material_Lattice.h, Ewald_Lattice.h, Rnox.h, Start_Data.h and Event_header.h, and eight program files Event_Driven.c (main program), Config_Lattice.c, Coulomb_Energy.c, Material_Energy.c, Move.c, Potential_Energy.c, Record.c and Total_Energy.c. A "make" file, Event_Driven.make contains the compilation and link instructions. Figure 3.1 illustrates the initialization, simulation loop and recording. up the initialization, event execution, determination, and recording loop. The first step in initializing a simulation involves two separate scripts in MatLab. The first "Material.m" generates the material lattice (Material_Lattice.h) file containing the numerical values corresponding to the acceptor and donor material for a lattice of size XYZ. In this file the boundaries of the donor and acceptor materials are set determining the geometry of the solar cell. This script also plots the material lattice in three dimensions and provides lattice statistics such as the number of donor/acceptor sites for a given configuration. The second script is called "Ewald.m" which calculates the values for a lattice of size XY2Z corresponding to the real- and reciprocalspace contributions of Vpair(mijx,miyj,mijz) defined in equation (2.13). The script generates the file Ewald_Lattice.h. The file "Event_Header.h" defines variables for the lattice size (SIZEX, SIZEY, SIZEZ) and number of simulation steps (TST). The file also contains the system dependent parameters given in Table 2.1. Note that the exciton generation rate is calculated from exg=4.01012[ps1nm3]NDonorSites. The number of times the output files are written during the course of the simulation is set by the variable "EVAL", and the external potential is set by the "Vext" variable. To start a simulation from a previous set of conditions the variable "START" must be set to one, the variable "LINES" must equal the number of lines in the input file Start_Data.h, which is generated by copying and pasting the starting conditions from the file Configuration_Data.txt to a file saved as Start_Data.h. 26 3.3 Simulation Loop The simulation loop in Figure 3.1 is composed of four primary parts, choosing an event, executing the event, recording the configuration and determining the new set of events. 3.3.1 Choose an Event To choose an event the function "Move" in the file Move.c is called. This function depends on the current occupation of the charge/image lattice, the fixed Ewald lattice, and the fixed event rates. Within the Move function, a data structure is built containing the initial and final positions for all possible events of all particles along with the associated rates. These rates are then normalized, and an event time line (see Figure 1.4) is constructed. A random number R(0,1) is generated and compared to the event time line, this selects the next event to be executed on the lattice. The update time is calculated according to, Tupdate=TotallnR where Total is the sum of all event rates as given by Equation (1.2). This value along with the event type represented by a unique integer and initial and final particle positions are the output of the Move function; they are passed in the one by eight variable "moveVector" to the main program. 3.3.2 Event Execution and Time Update The output variable moveVector is evaluated in the main program (file Event_Driven.c) to identify the type of move (element 7 of the array) and the initial and final coordinates (elements 0 to 5) of the particle[s] involved in the event. For example, for the event electron/hole recombination, the elements 0 to 2 of moveVector correspond to the X,Y and Z positions of the electron, and the elements 3 - 5 represent the position of the hole. The event is then executed on the lattice. For instance, in the case of a particle move, the original lattice site is set to zero and the new lattice site is set to the unique integer of the particle (-1 for electrons, 1 for holes, and 2 for excitons). After the event is executed on the lattice the update time in the eighth element of moveVector is added to the current simulation time. 3.3.3 Record Configuration and Check Time After the simulation time has been updated, it is compared with the target simulation time. If the simulation time is greater than or equal to the target time, the simulation is stopped and the final lattice configuration is recorded. If the simulation time is less than the target time, and if the current number of simulation steps is a multiple of the recording interval set by the variable EVAL, the function "Record" (file Record.c) is called. Record writes to file the current lattice configuration along with the update time and event type. 3.3.4 Determine New Events To determine all possible events of the new configuration, the function Move sweeps through all lattice points, determines what (if any) particle exists on the lattice point and what events can be associated with that particle. The energy difference of the current configuration and a possible new configuration is calculated using the "Total_Energy" function in file Total_Energy.c. The Total_Energy function determines the energy contribution for each interaction, as described in Chapter 2 , and then applies Equation (2.3) to the event rate for hopping events. The information regarding the event type, event rate, final and initial positions for all events is stored in a structure which is accessed by the function Move when an event is chosen, as described in 3.3.1. 3.4 Output Files Each simulation generates three output files; the first, "seeds.txt", contains the seed value for the random number generator so that a particular simulation can be executed again if needed. The second file "Current_Configuration.txt" is periodically updated, with the periodicity set by the variable EVAL, and contains the X,Y and Z coordinates of each particle, the particle type, the simulation step number, and the simulation time. The file "Configuration_Data.txt" is updated for every simulation step and contains the simulation step, simulation time, time interval between steps, the number of each particle type, total number of particles and the last event that took place. Tables 3.1 and 3.2 contain the output format of the variables in each file. Table 3.1: Recorded quantities and their output formats for the Current_Configuration.txt file. Step is the step number, time is the simulation time in seconds, T is the time interval between steps, Ne,NH,NX,NP are the number of electrons, holes, excitons and total particles respectively and En is event number. Table 3.2: Recorded quantities and their output formats for the Configuration_Data.txt file. Step is the step number, time is the simulation time in seconds, PX,PY, and PZ are the X,Y, and Z positions of the particle, TP and TM are the particle type and the material type

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Tempering of steel is done to make it Brittle Hard Rollable Soft

Answered: 1 week ago

Question

=+How can you personalize the language?

Answered: 1 week ago

Question

=+Can your message work in another locale?

Answered: 1 week ago

Question

=+Can you create an idea that spins out?

Answered: 1 week ago