Scilab的L-J势

问题描述 投票:0回答:1

我实际上是绘制sigma = 2.74和epsilon = 0.0031的lj电位曲线。下面是我的代码。

function [V,r]=lj(si,e)
     for i=1:3
            si=si*(1+(i-1)*0.1)
        r=linspace(0.75,8,1000)*si;
        V=4*e*((si./r).^12-(si./r).^6);
            subplot(2,2,1)
        plot((r/si),(V/e),'o')
            h = gca(); // get current axes
    h.data_bounds = [0.75, -2 ; 2.5, 2]
    end
    for i=1:3
            e=e*(1+(i-1)*0.3)
        r=linspace(0.75,8,1000)*si;
        V=4*e*((si./r).^12-(si./r).^6);
        subplot(2,2,2)
        plot((r/si),(V/e),'r')
        h = gca(); // get current axes
    h.data_bounds = [0.75, -2 ; 2.5, 2]
    end 
    endfunction

实际上,在上述情况下,我已经针对不同的sigma和epsilon值执行了此操作,但是我只能得到一条曲线,如下面的代码所示,它工作得很好(即,仅在x和y上轴图有变化的地方)轴)。如果有人在我的第一个代码中进行了一些更改以运行各种值,那将是很好的。我的工作代码如下。

function [V,r]=lj(si,e)
    for i=1:3
        si=si*(1+(i-1)*0.1)
    r=linspace(0.75,8,1000);
    V=4*e*((si./r).^12-(si./r).^6);
        subplot(2,2,1)
    plot(r,V,'o')
        h = gca(); // get current axes
h.data_bounds = [2, -0.01 ; 6, 0.01]
end
    for i=1:3
        e=e*(1+(i-1)*0.3)
    r=linspace(0.75,8,1000);
    V=4*e*((si./r).^12-(si./r).^6);
    subplot(2,2,2)
    plot(r,V,'r')
    h = gca(); // get current axes
h.data_bounds = [2, -0.01 ; 6, 0.01]
end 
endfunction
scilab computation-theory computation
1个回答
0
投票

实际上,在您的第一个代码中,si。/ r等于1./linspace(0.75,8,1000),并且不依赖于i,而对于V和r / si则相同!您只是在绘制相同数据的3倍

© www.soinside.com 2019 - 2024. All rights reserved.