COMPUTATIONAL PHYSICS PHZ 5156
University of Central Florida
Popular in Course
Popular in Physics 2
verified elite notetaker
This 26 page Class Notes was uploaded by Humberto Romaguera II on Thursday October 22, 2015. The Class Notes belongs to PHZ 5156 at University of Central Florida taught by Staff in Fall. Since its upload, it has received 9 views. For similar materials see /class/227505/phz-5156-university-of-central-florida in Physics 2 at University of Central Florida.
Reviews for COMPUTATIONAL PHYSICS
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/22/15
Damped driven oscillator Start with the case where q0 FD0 yt Acos not Bsin not Initial conditions Ay0 Bv0 loo0 Energy kinetic potential should be conserved Compare with analytical to verify code also test energy conservation Test with simple harmonic oscillator If 39i satay Use Verlet algoritim yn1 2yn 39 yn1 39 0002C yn c forcemass from spring force om02ynow c integrate to get y at next time step use Verlet ynext 20d0ynowylastdt2force Initial conditions analytic solution Analytic result computed for comparison Verlet algorithm needs position at two previous times Translate into initial position and initial velocity yt Acos not Bsin not Initial conditions Ay0 Bv0 loo0 c velocity at current timestep vnow ynextylast20d0dt c If i1 first integration step determine the initial conditions for an c Next five lines not used in the case of damped driven oscillator ifieq1 then Aynow Bvnowom0 endif 100 Energy calculation analytical and output c velocity at current timestep vnow ynextylast20d0dt potential 05d0sk ynow2 kinetic 05d0vnow2 etot potential kinetic write 6100 tynowyanalyticdiffpotentialkinetic etot formatf8462xf126 For a 1 dt0 05 Difference between exact and numerical gnuplotgt set term jpeg Terminal type set to 39jpeg39 Options are 39small size 640480 39 gnuplotgt set output 39displacejpg39 gnuplotgt plot 39output3939output39 using 13 output39 using 14 535 SENESNQF 9353 immq SEN ainwin 3m Hum ninwin wm Hum ainuin 3m quot4 n n ou 5 923 333 n u x nunzwu 353 x 2 x I z z z 2 as s on m3m6lt 3 oosmemn 2 s v z s r s z z 3quot unz Vu NHHHuvw a z 3 2u 23v u nm sxuwwa u u usnsvusnono vousmon son ms 3 on W H on s 82 3 oschV mm 06 62339 oschV 90H ocEE swim Ammaoc ca swim fmaocHUcH swim u Damped driven harmonic oscillator v V 3quot I I 3 i Err l 15 y d flittiriilrli til39l39i j urt39i Have to work out numerical integration using Verlet Case with q0 FD0 serves as starting point Damping driving force mean energy not conserved Can still compare to analytical yt after transient decays In the underdamped regime q lt 000 yt c e39qt sin st 1 For q001 0001 transient decays away 11q 100 After decay of transient analytical behavior is yt A sinlts2Dt v Damped driven oscillator position vs time Terminal type set to 39jpeg39 Options are 39small size 640480 39 gnuplotgt set output 39damped1jpg39 gnuplotgt plot 300400 39output39 using 12 output39 using 13 Di erences between analytic numerical are due to transients important for tlt100 nmpuv usmg m gnuplotgt set output 39damped2jpg39 gnuplotgt plot 39output39 using 14 Differences are equal to the transient behavior which is not included in analytical result in code Code for the analytical result comparison c Next three lines are for the damped driven harmonic oscillator A Fdsqrtom02om2220d0qom02 used for d phi datan20dOomqom02 om2 used for damped dr yanalytic Adcosomtphi used for damped driven oscillato diff ynow yanalytic Notice the transient behavior which depends on the initial conditions is not included here which explains the differences seen in the preceding slide Random walk declarations I Program to perform a random walk in two dimensions I repeats for many realizations and accumulates r2 statistics IMPLICIT NONE INTEGER PARAMETER Prec14SELECTEDREALKIND14 INTEGER ijisnent REALKNDPrec14 rndrndsr2t INTEGER PARAMETER ntmax100 I maximum number of time steps INTEGER PARAMETER nemax100000 I number of walks in ensemble REALKNDPrec14 DIMENSIONntmax r2a I accumulated average of Random number generator initialize random number generator ca RANDOMSEED ca RANDOMNUMBERrnd ca RANDOMNUMBERrnds One random number rnds can be used to decide on Step Other random number rnd can be used to decide whether we move walker in x or y direction do ne1nemax nemax realizations of random walk do nt1ntmax 6O r2reai2reaj2 r2antr2antr2nemax enddo enddo Random walk results 3 r2N v 25 C o 2 l 15 1 05 IogN r2 N as expected Declarations Monte Carlo 2D Ising model IMPLICIT NONE INTEGER PARAMETER Prec14SELECTEDREALKIND14 INTEGER PARAMETER mcmax50d8mcminmcmaxl1O INTEGER PARAMETER nn500 INTEGER PARAMETER nxnnnynn INTEGER ixiy INTEGER mcktktot REALKINDPrec14 I1enen0Kmagavmavrndprobmav2av2 REALKINDPrec14 DIMENSIONnxny S REALKINDPrec14 PARAMETER ksteps 100 REALKINDPrec14 PARAMETER kmax050d0kmin030d0 REALKINDPrec14 PARAMETER dkkmaxkminksteps Ising model overall outline of code Generate random array of spins Compute initial magnetization energy Begin loop over coupling constant K Begin loop on MC steps Choose a random spin Compute local energy of randomly chosen spin Flip randomly chosen spin and again compute local energy If energy decreased accept new spin If energy increased draw random number to see if accepte 10 Compute any changes in energy magnetization 11Accumulate thermodynamic averages 12 Return to step 4 if more MC steps required 13 Output thermodynamic averages for current K 14 Return to step 3 for a new coupling constant K P NFDQJgtP Nf Initial energy 100d0 do ix1nx do iy1ny call clusterixiynxnySKen 11O5d0en enddo enddo Cluster subroutine subroutine clusterixiynxnySKen INTEGER PARAMETER Prec14SELECTEDREALKIND14 INTEGER ixiynxnymn REALKINDPrec14 DIMENSIONnxny S REALKINDPrec14 Ken compute interaction of spin ixiy with its neighbors en00d0 do n01 ix1n2 miy implement the pbc ift1 nx ifgtnx 1 enenKSixiySm enddo do n01 ix miy1n2 implement the pbc ifmt1 mny ifmgtny m1 enenKSixiySm enddo return end Magnetization 1 09 X 05 quota 07 1 05 2 ltMgt 05 03 39 02 39 Heat capacity discontinuity at TTC Susceptibility diverges at TTE 000015 00001 52705 o Chapter 9 Moleculardynamics Integrate equations of motion classical Discrete form of Newton s second law Forces from interaction potential gt Fl VlUr1r2rN For a simple pair potential we get s s 1 Ur1rN Egljumj Integrating equations of motion d dv dv Fixmi Vlx FZ dt by 1 dt dt dv dzx N xin1 2xin xin 1 dt alt2 At2 This works out to give the Verlet algorithm F iAtz m l xin 1 2xln xin 1 Vreps un LennardJones potential for noble gas 2 Hssgmz Heat capacity Angle brackets thermal average In MD thermal averages done by time average Heat capacity given by fluctuations in total energy Radial distribution function gr piNltEar a p is the density NQ Diracdelta defined numerically not infinitely sharp In an ideal gas gr 1 In a liquid gr 1 at long ranges short range structure In a crystal g r has sharp peaks longrange order
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'