%% % Author: MJ Schnieders % Date: April 19th, 2013 % Function: vanDerWaalsForce
ID: 3830675 • Letter: #
Question
%% % Author: MJ Schnieders % Date: April 19th, 2013 % Function: vanDerWaalsForces.m % Purpose: Compute the van der Waals energy and forces for Argon atoms. % Input: % x - a vector of x-coordinates ( % y - a vector of y-coordinates (Angstroms) % Output: % energy - the potential energy (Kcal/mole) % fx - the x-component of the force (Kcal/mole/Angstrom) % fy - the y-component of the force (Kcal/mole/Angstrom) % function [energy, fx, fy] = vanderWaals(x, y) eps4 = 0.2824 * 4.0; rmin = 3.361; rmin6 = rmin^6; rmin12 = rmin^12; nAtoms = length(x); % Zero out energy. energy = 0; % Zero out forces. fx = zeros(1,nAtoms); fy = zeros(1,nAtoms); % Loop over atoms to accumulate energy and forces. for i=1:nAtoms xi = x(i); yi = y(i); % Loop over atoms whose index is greater than i. for j=i+1:nAtoms % Compute separation distance (Angstroms). dx = xi - x(j); dy = yi - y(j); r = sqrt(dx*dx + dy*dy); % Compute interaction energy. ir = 1.0/r; ir6 = ir^6; ir12 = ir6*ir6; e = eps4*(rmin12*ir12 - rmin6*ir6); energy = energy + e; % Compute equal and opposite forces, includeing chain rule term. ir7 = ir6*ir; ir13 = ir12*ir; de = eps4*(6.0*rmin6*ir7 - 12.0*rmin12*ir13); dxr = de*dx/r; dyr = de*dy/r; fx(i) = fx(i) - dxr; fy(i) = fy(i) - dyr; fx(j) = fx(j) + dxr; fy(j) = fy(j) + dyr; end end end Part I Initial Energy, Forces and Velocities. Use the supplied Matlab function vanderWaals to compute the initial potential energy and forces on each atom of the Argon system. This approximates atomic interactions by summing the van der Waals energy between all pairs of atoms as: 12 E(X) 60 120 12 dr 13 oxi where r (xi X DT+ (yi-yO2, o 3.361 Angstroms and 0.2824 Kcal/mole. The two inputs are the coordinate vectors 'x' and 'y' and the returned values are the energy (kcal/mole) and forces (kcal/mole/A): [energy, Fx, Fy] vanderWaals (x,y); Print out the returned energy. Finally, compute the initial velocities in the x and y directions using "randn"with mean 0.0 and std. dev. 0.05. HINT: The energy of the Argon cluster for the initial Cartesian coordinates should be exactly -13.8298 Kcal/mole.Explanation / Answer
% x - a vector of x-coordinates (
% y - a vector of y-coordinates (Angstroms)
% Output:
% energy - the potential energy (Kcal/mole)
% fx - the x-component of the force (Kcal/mole/Angstrom)
% fy - the y-component of the force (Kcal/mole/Angstrom)
% function [energy, fx, fy] = vanderWaals(x, y) eps4 = 0.2824 * 4.0; rmin = 3.361; rmin6 = rmin^6; rmin12 = rmin^12; nAtoms = length(x); % Zero out energy. energy = 0; % Zero out forces. fx = zeros(1,nAtoms); fy = zeros(1,nAtoms); % Loop over atoms to accumulate energy and forces. for i=1:nAtoms xi = x(i); yi = y(i); % Loop over atoms whose index is greater than i. for j=i+1:nAtoms % Compute separation distance (Angstroms). dx = xi - x(j); dy = yi - y(j); r = sqrt(dx*dx + dy*dy); % Compute interaction energy. ir = 1.0/r; ir6 = ir^6; ir12 = ir6*ir6; e = eps4*(rmin12*ir12 - rmin6*ir6); energy = energy + e; % Compute equal and opposite forces, includeing chain rule term. ir7 = ir6*ir; ir13 = ir12*ir; de = eps4*(6.0*rmin6*ir7 - 12.0*rmin12*ir13); dxr = de*dx/r; dyr = de*dy/r; fx(i) = fx(i) - dxr; fy(i) = fy(i) - dyr; fx(j) = fx(j) + dxr; fy(j) = fy(j) + dyr; end end end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.