return(sqrt(v3_absolute_square(a)));
}
-int v3_per_bounds(t_3dvec *a,t_3dvec *dim) {
+int v3_per_bound(t_3dvec *a,t_3dvec *dim) {
double x,y,z;
int v3_cmp(t_3dvec *a,t_3dvec *b);
double v3_absolute_square(t_3dvec *a);
double v3_norm(t_3dvec *a);
-int v3_per_bounds(t_3dvec *a,t_3dvec *dim);
+int v3_per_bound(t_3dvec *a,t_3dvec *dim);
#endif
t_3dvec distance;
t_3dvec force;
double d,h1,h2;
+ double eps,sig6,sig12;
atom=moldyn->atom;
count=moldyn->count;
params=moldyn->pot_params;
+ eps=params->epsilon;
+ sig6=params->sigma6;
+ sig12=params->sigma12;
+
+ for(i=0;i<count;i++) v3_zero(&(atom[i].f));
for(i=0;i<count;i++) {
for(j=0;j<i;j++) {
h2=d*d; /* 1/r^8 */
h1*=d; /* 1/r^6 */
h1*=h2; /* 1/r^14 */
+ h1*=sig12;
+ h2*=sig6;
+ d=-12.0*h1+6.0*h2;
+ d*=eps;
+ v3_scale(&force,&distance,d);
+ v3_add(&(atom[j].f),&(atom[j].f),&force);
+ v3_sub(&(atom[i].f),&(atom[i].f),&force);
}
}
}
t_3dvec get_total_p(t_atom *atom,int count);
double potential_lennard_jones(t_moldyn *moldyn);
+int force_lennard_jones(t_moldyn *moldyn);
#endif
md.count=count;
md.atom=si;
md.potential=potential_lennard_jones;
+ md.force=force_lennard_jones;
+ md.cutoff_square=((LC_SI/4.0)*(LC_SI/4.0));
md.pot_params=&lj;
md.force=NULL;
md.status=0;