Chemistry Reference
In-Depth Information
d
¼
o1-o2;
d2
¼
sum(d.*d);
e
¼
e
þ
qo*qo/sqrt(d2);
%o1 is fixed so no corresponding term for fslow
(1:2)
%o2 is fixed so no corresponding term for fslow
(7:8)
f
¼
f
þ
fslow;
end
%%%%%%%%%%end of function%%%%%%%%%%%%%%%%%%%%%%
function r
¼
dynlang1(n,gamma,Temp,h,m);
%r
¼
dynlang1(n,gamma,Temp,h,m);
% Langevin dynamics random forces, modified for two
fixed atoms
%
%INPUT ARGUMENTS
% n number of degrees of freedom
% gamma Langevin friction parameter
% Temp target temperature for Langevin dynamics
% h timestep
%OUTPUT ARGUMENTS
% r random force vector
%
%Eric Barth
%Kalamazoo College, 2007
n
¼
n-4;
m
¼
m([3:6,9:12]);
kB
¼
1.987191e-03;
r
¼
randn(n,1);
r
¼
r*sqrt(2*gamma*kB*Temp/h);
r
¼
sqrt(m).*r;
r
¼
[0;0;r(1:4);0;0;r(5:8)];
%%%%%%%%%%end of function%%%%%%%%%%%%%%%%%%%%%%
%Matlab script to compute dipole angle ''theta'' from
%trajectory of positions ''x''
%