-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf_interaction.m
More file actions
40 lines (32 loc) · 1.22 KB
/
f_interaction.m
File metadata and controls
40 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Copyright (c) 2018, Nadav Avidor.
% All rights reserved.
% This file is part of the PIGLE - Particles Interacting in Generalized Langevin Equation simulator, subject to the
% GNU/GPL-3.0-or-later.
function [ f ] = f_interaction( x,f_func,f_func_params )
%F_INTERACTION computes the inter-particle force
% The force dimensions are expected to be in meV/Angstrom
% Inputs:
% x - a vector. Points along the distance between adsorbed particles at which the force is to be calculated
% f_func - Case number. The type of force to consider.
% f_func_params - Parameters for the force equation.
%
% Output:
% f - the inter-adsorbate force, f(x)
%
switch f_func
case 1
% Simple sum of -A_i*(x.^(-pwr_i)
f = zeros(size(x));
for i=1:2:length(f_func_params)
A = f_func_params(i);
if A < 0, warning('Prefactor of inter-adsorbate force is negative. When multiplied by (dx,dy)/|r| will result attraction'); end
pwr = f_func_params(i+1);
f = f + A*(x.^(-pwr));
end
case 2
%No interactions:
f = 0*x;
otherwise
error('No such force function defind');
end
end