This is code for molucular dynamics, but I am not sure why this code couldn't run. Error message is as belows:
error in untitled (line 4)
sum_Vsq(it) = sum_Vsq(it)+ vhx(k,it)*vhx(k,it)+vhy(k,it)*vhy(k,it);
-----------------------
sum_Vsq(it) = sum_Vsq(it)+ vhx(k,it)*vhx(k,it)+vhy(k,it)*vhy(k,it);
sum_PE=sum_PE + 4*(1/r1^12-1/r1^6);
nonIdealTerm = nonIdealTerm + fx1*dx1 + fy1*dy1;
TE(it) = KE(it) + PE(it);
T(it) = sum_Vsq(it)/( 2*(nP-1));
p(it) = nP*T(it)/(sL*sL);
pNonIdeal(it) = p(it) + (1/(2*sL*sL))*nonIdealTerm;
sum_Vsq(it) = sum_Vsq(it)+ vhx(k,it)*vhx(k,it)+vhy(k,it)*vhy(k,it);
sum_PE=sum_PE + 4*(1/r1^12-1/r1^6);
nonIdealTerm = nonIdealTerm + fx1*dx1 + fy1*dy1;
TE(it) = KE(it) + PE(it);
T(it) = sum_Vsq(it)/( 2*(nP-1));
p(it) = nP*T(it)/(sL*sL);
pNonIdeal(it) = p(it) + (1/(2*sL*sL))*nonIdealTerm;