Question

Is the function being called correctly? format shorteng r = linspace(0.1,4,500); % Distance in Angstrom re...

Is the function being called correctly?

format shorteng

r = linspace(0.1,4,500); % Distance in Angstrom
re = 0.7414; % Equilibrium Seperation
D = 38292; % Dissoc Enrgey [cm^-1]
twoBeta = 1.4426;

Vm = morse_potential(D, twoBeta, re, r); % Call Morse Potential Function

plot(r,Vm, 'g-','Linewidth',2)
xlabel('Distance [A]')
ylabel('Potential Energy [cm^-1]')
title('Morse Potential of Hydrogens')
ylim([0,5e4])
grid 'on'
hold on

D2 = 38292; % Equiibrium distance
re2 = 0.7413; % Width of the potential well for H2
twoBeta2 = 1.4433;
r = linspace(0.4,4,500); % Seperation distances

Vm2 = morse_potential(D2, twoBeta2, re2, r);
plot(r,Vm)
hold on

D3 = 38292; % Equiibrium distance
re3 = 0.7417; % Width of the potential well for H2
twoBeta3 = 1.4446;
r = linspace(0,4,500); % Seperation distances
Vm3 = morse_potential(D3, twoBeta3, re3, r);
plot(r,Vm,'r--', 'Linewidth', 1)

x1 = [0.29,4];
y1 = [3.82e4,3.82e4];
plot(x1,y1,':r','linewidth', 2)

legend('Hydrogen','Hydrogen Deuteride','Deuterium','DissEnergy')
hold off

%% Metal Hydrides
figure(2)
format SHORTENG
r = linspace(0.1,4,500); % Distance in Angstrom
re = 1.5947; % Equilibrium Seperation
D = 7660; % Dissoc Enrgey [cm^-1]
twoBeta = 3.5536;

Vm = morse_potential(D, twoBeta, re, r); % Call Morse Potential Function

plot(r,Vm, 'g-','Linewidth',2)
xlabel('Distance [A]')
ylabel('Potential Energy [cm^-1]')
title('Potential of Metal Hydrides')
ylim([0,1e4])
grid 'on'
hold on

D2 = 6184; % Equiibrium distance
re2 = 1.762; % Width of the potential well
twoBeta2 = 3.901;
r = linspace(0.1,4,500); % Seperation distances

Vm2 = morse_potential(D2, twoBeta2, re2, r);
plot(r,Vm2, 'b-','Linewidth',2)
hold on

D3 = 3695; % Equiibrium distance
re3 = 1.741; % Width of the potential well for H2
twoBeta3 = 4.844;
r = linspace(0,4,500); % Seperation distances
Vm3 = morse_potential(D3, twoBeta3, re3, r);
plot(r,Vm3,'r--', 'Linewidth', 1.5)
hold on
x1 = [1.3,4];
y1 = [7.65e3,7.65e3];
plot(x1,y1,':r','linewidth', 2)
x2 = [1.46,4];
y2 = [6.1e3,6.1e3];
plot(x2,y2,':r','linewidth', 2)
x3 = [1.5,4];
y3 = [3.7e3,3.7e3];
plot(x3,y3,':r','linewidth', 2)
legend('Zinc Hydride','Cadium Hydride','Mercury Hydride','DissEnergy')
hold off

function [Vm] = morse_potential(D,twoBeta, re, r)
%-----------------------------------------------------------------------
% Function Description: Computes the Morse Potential for a diatomic
% molecule
% ---Inputs---
% Input1: D - Energy required to break the moclecuar bond
% Input2: twoBeta - Morse potential parameter [Controls width of well]
% Input3: re - Equilibrium seperatin distance
% Input4: r - Seperation distance
% ---Outputs---
% Output1: Vm - Potential energy as a function of seperation distance


%% Morse Potential
% Compute xi
xi = (r - re)./re;
%[R, Re] = meshgrid(r,re);
%xi = (R - Re)./Re;
% Compute x
x = twoBeta.* xi;

% Compute Vm
Vm = D'.*(1-exp(-x)).^2;

am i calling the morse_potential function correctly? the code is not consistent from hyrogens to metal hydrides

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Vm2 and Vm3, are not getting plotted, you were plotting Vm only three times

format shorteng;

r = linspace(0.1,4,500); % Distance in Angstrom
re = 0.7414; % Equilibrium Seperation
D = 38292; % Dissoc Enrgey [cm^-1]
twoBeta = 1.4426;

Vm = morse_potential(D, twoBeta, re, r); % Call Morse Potential Function

figure(1);
plot(r,Vm, 'g-','Linewidth',2)
xlabel('Distance [A]')
ylabel('Potential Energy [cm^-1]')
title('Morse Potential of Hydrogens')
ylim([0,5e4])
grid 'on'
hold on

D2 = 38292; % Equiibrium distance
re2 = 0.7413; % Width of the potential well for H2
twoBeta2 = 1.4433;
r = linspace(0.4,4,500); % Seperation distances

Vm2 = morse_potential(D2, twoBeta2, re2, r);
plot(r,Vm2)
hold on

D3 = 38292; % Equiibrium distance
re3 = 0.7417; % Width of the potential well for H2
twoBeta3 = 1.4446;
r = linspace(0,4,500); % Seperation distances
Vm3 = morse_potential(D3, twoBeta3, re3, r);
plot(r,Vm3,'r--', 'Linewidth', 1)

x1 = [0.29,4];
y1 = [3.82e4,3.82e4];
plot(x1,y1,':r','linewidth', 2)

legend('Hydrogen','Hydrogen Deuteride','Deuterium','DissEnergy')
hold off

%% Metal Hydrides
figure(2)
format SHORTENG
r = linspace(0.1,4,500); % Distance in Angstrom
re = 1.5947; % Equilibrium Seperation
D = 7660; % Dissoc Enrgey [cm^-1]
twoBeta = 3.5536;

Vm = morse_potential(D, twoBeta, re, r); % Call Morse Potential Function

plot(r,Vm, 'g-','Linewidth',2)
xlabel('Distance [A]')
ylabel('Potential Energy [cm^-1]')
title('Potential of Metal Hydrides')
ylim([0,1e4])
grid 'on'
hold on

D2 = 6184; % Equiibrium distance
re2 = 1.762; % Width of the potential well
twoBeta2 = 3.901;
r = linspace(0.1,4,500); % Seperation distances

Vm2 = morse_potential(D2, twoBeta2, re2, r);
plot(r,Vm2, 'b-','Linewidth',2)
hold on

D3 = 3695; % Equiibrium distance
re3 = 1.741; % Width of the potential well for H2
twoBeta3 = 4.844;
r = linspace(0,4,500); % Seperation distances
Vm3 = morse_potential(D3, twoBeta3, re3, r);
plot(r,Vm3,'r--', 'Linewidth', 1.5)
hold on
x1 = [1.3,4];
y1 = [7.65e3,7.65e3];
plot(x1,y1,':r','linewidth', 2)
x2 = [1.46,4];
y2 = [6.1e3,6.1e3];
plot(x2,y2,':r','linewidth', 2)
x3 = [1.5,4];
y3 = [3.7e3,3.7e3];
plot(x3,y3,':r','linewidth', 2)
legend('Zinc Hydride','Cadium Hydride','Mercury Hydride','DissEnergy')
hold off

function [Vm] = morse_potential(D,twoBeta, re, r)
%-----------------------------------------------------------------------
% Function Description: Computes the Morse Potential for a diatomic
% molecule
% ---Inputs---
% Input1: D - Energy required to break the moclecuar bond
% Input2: twoBeta - Morse potential parameter [Controls width of well]
% Input3: re - Equilibrium seperatin distance
% Input4: r - Seperation distance
% ---Outputs---
% Output1: Vm - Potential energy as a function of seperation distance


%% Morse Potential
% Compute xi
xi = (r - re)./re;
%[R, Re] = meshgrid(r,re);
%xi = (R - Re)./Re;
% Compute x
x = twoBeta.* xi;

% Compute Vm
Vm = D'.*(1-exp(-x)).^2;
end

Add a comment
Know the answer?
Add Answer to:
Is the function being called correctly? format shorteng r = linspace(0.1,4,500); % Distance in Angstrom re...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT