%***********************************************************************
%  function ModifiedMasterForceForDBC
%
%  Modify the global load vector impose homogeneous displacement BCs
%***********************************************************************

function F = ModifiedMasterForceForDBC(pdof, pval, F, K)

np = length(pdof);  % number of prescribed displacement BCs 

u=zeros(6,1);

for i = 1 :np
    u(pdof(i))=u(pdof(i))+pval(i);
end

F = F - K * u;

for k = 1:np
    constr_dof = pdof(k);
    F(constr_dof) = pval(k);
end
