SIMPLE THERMOSTATS IN (NPyyT)-MD SIMULATIONS OF A BINARY MIXTURE. B. HAFSKJOLD, 28.3.1995 Introduction We describe here two simple thermostats for use with the constant-stress algorithm [Hafskjold, notes]. In this algorithm, the length of the MD cell, Lx, is fixed. The cross-sectional area of the cell is A=LyLz. A fluctuates and its time derivative is A. The relation between the velocities and the momenta for the particles in the system are v x, i = p x,i mi p q,i A + qi ; q = y, z vq,i = m 2A Because of the difference between a particle's momentum and mivi, the kinetic energy must be computed as K= 2 2 2 px, i + p y,i + pz,i iCV 2 mi The kinetic energy is related to the system's temperature in the usual way. The thermostats operate by scaling and shifting the velocities or the momenta in a given control volume (CV), such as the regions H or L in the NEMD algorithm. The thermostats do not have to operate at every time step, but can be activated at regular intervals or when the temperature has exceeded specified tolerance limits. For both thermostats, the scaling and shifting are subject to the condition that the momentum of all particles in CV is conserved and that the kinetic energy after scaling corresponds to a specified temperature, T0, for each type independently; s=1,2. The first thermostat scales the velocities of the particles. The second scales the momenta of the particles. The latter algorithm is both simpler to use and probably more correct because it operates on the quantities that give the particles' kinetic energy and temperature. Definitions: A prime (') on a variable means the value after thermostatting, unprimed variables represent the value before thermostatting. The subscript s is used to denote component number (s=1,2) and subscript q denotes coordinate (q=x,y,z). Number of particles of type s in CV: N s 3 Velocity of particle i: v i = { v x,i , v y,i , vz,i } 4 pi Momentum divided by mass: ui = 5 mi 1 2 Sum of velocities: V s, q = vq,i ; q = x, y, z 6 U s, q = u q,i ; q = x, y, z 7 is Sum of velocities: is Sum of velocity squares: 2 W s, q = ( v q,i ) ; q = x, y, z 8 is Sum of velocity squares: U U s = ( u 2x, i + u 2y, i + 9 is Q s = qi Sum of positions: ; q = y, z 10 is Sum of position squares: Q Qs = qi2 ; q = y, z 11 is Sum of position times velocity: Q V s = qi vq,i ; q = y, z 12 is Total momentum in x-direction: P s, x = ms V s, x = ms U s, x 13 A Total momentum in y- and z-directions: Q = ms U s, q ; q = y, z 14 P s, q = ms V s, q - ms 2A s M = N 1 m1 + N 2 m2 15 Total mass in CV: N s ms ; s = 1,2 16 Weight fraction of species s: ws = M Velocity scaling algorithm We set vq, i = (1+ s, q ) vq,i + q ; s = 1,2 (1) where (1+αs,q) is the scaling factor in q-direction for particles of type s and βq is the velocity shift that will conserve momentum in q-direction. We assume that αs,x αs,y = αs,z. The requirements are for each of the control volumes H and L: Pq = P1, q + P2, q - ( P1, q + P2, q ) =0 0 m ; qs W = sx, , x y, z kT = Ns 2 A A ms 0 kT = W s, y + W s, z - (Y V s + Z V s ) + (Y Y s + Z Z s 2 Ns A 2A (2) ) ; q = y, z (3) The sum of velocities and sum of velocity squares before and after thermostatting are related by V s, q = (1+ s, q )V s, q + N s q W s, q = (1+ s, q ) W s, q + 2(1+ s, q ) q V s, q + N s 2 (4) 2 q where it is understood that s=1,2 and q=x,y,z. Eq. (4) inserted into (2) leads to (5) 3 q=- m1V 1, q 1, q + m2 V 2, q 2, q M (6) where we have used the fact that the positions do not scale, i.e. (7) Ps, q - Ps, q = ms ( V s, q - V s, q ) We now need to solve Eqs. (3), (5), and (6). This is best done iteratively by rewriting Eq. (5) to (1+ s, q )2 = 1 W s, q W s, q - 2(1+ s, q ) q V s, q - N s 2q (8) We will also use the assumption that αs,y = αs,z = αs, and get (1 + s, x )2 = (1 + s,_ )2 = where 1 W s, x W s , x - 2(1 + s, x ) x V s, x - N s 2x 1 2 2 W s, y + W s, z - 2(1 + s,_ )( y V s, y + z V s, z ) - N s ( y + z ) + W s, y W s, z (9) 4 W s, x = W s, y + W s, z = 2 N s kT 0 ms N s kT ms 0 A + (1 + s,_ )(Y V s + Z V s ) + y Y + z Z A 2 A - (Y Y s + Z Z s ) 2A (10) The iterative solution is implemented by the following algorithm: compute Ns, Vs,q, Ws,q, Qs,q, QQs,q, QVs,q, and M γs,q=1 start: αs,q=γs,q-1 βq=-(m1V1,qα1,q+m2V2,qα2,q)/M 2 =(NskT*/ms-2γs,xβxVs,x-Nsβx2)/Ws,x γs,x 2 ={2NskT*/ms+A [(1+αs,)(YVs+ZVs)+βyY+βzZ]/A-(A /2A)2(YYs+ZZs) γs, -2γs,(βyVs,y+βzVs,z)-Ns(βy2+βz2)}/(Ws,y+Ws,z) 2 ) γs,q=sqrt(γs,q if |γs,q-1-αs,q|>ε then goto start else continue Momentum scaling algorithm In this case, the scaling and shifting algorithm is u q, i = (1+ s ) u q,i + q ; s = 1,2 (11) where the scaling factor (1+αs) now is isotropic. The requirements are Pq = P31N P2*, q - ( P1, q + P2, q ) = 0 ; q = x, y, z ,q + s kT U U s = ; s = 1,2 ms (12) (13) The sum of velocities and sum of velocity squares before and after thermostatting are related by U s, q = (1+ s )U s, q + N s q (14) 5 U U s = (1+ s )2 U U s + 2(1+ s )( x U s, x + y U s, y + z U s, z ) + N s ( 2x + 2y + 2z ) (15) Eq. (14) inserted into (12) leads to q=- P1, q 1, q + P2, q 2, q M (16) Eqs. (13), (15), and (16) are again solved iteratively by rewriting Eq. (15) to (1 + s )2 = 1 UUs U U s - 2(1 + s )( x V s, x + y V s, y + z V s, z ) - N s ( 2x + 2y + 2z ) (17) The numerical algorithm for this is: compute Ns, Vs, Ws, and M γs=1 start: αs=γs-1 βq=-(m1U1,qα1,q+m2U2,qα2,q)/M γs2=[3NskT*/ms-2γs(βxUs,x+βyUs,y+βzUs,z)-Ns(βx2+βy2+βz2)]/UUs γs=sqrt(γs2) if |γs-1-αs|>ε then goto start else continue