X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=moldyn.c;h=7f9745ad29ef2f8e7dd52a52301a4f0a05ad0283;hb=bdb198c5a5fe38361d10f98e7db366b0915e56fb;hp=0fd1aca88d3b7243ee58cbe2d219cf0e4e2190f9;hpb=512390ceb93a2dd630943165b35bba683e0ffcfc;p=physik%2Fposic.git diff --git a/moldyn.c b/moldyn.c index 0fd1aca..7f9745a 100644 --- a/moldyn.c +++ b/moldyn.c @@ -33,7 +33,7 @@ int moldyn_usage(char **argv) { printf("-V (rasmol file)\n"); printf("--- physics options ---\n"); printf("-T [K] (%f)\n",MOLDYN_TEMP); - printf("-t [s] (%f)\n",MOLDYN_TAU); + printf("-t [s] (%.15f)\n",MOLDYN_TAU); printf("-R (%d)\n",MOLDYN_RUNS); printf("\n"); @@ -520,7 +520,7 @@ int force_harmonic_oscillator(t_moldyn *moldyn) { d=v3_norm(&distance); if(d<=moldyn->cutoff) { v3_scale(&force,&distance, - (-sc*(1.0-(equi_dist/d)))); + -sc*(1.0-(equi_dist/d))); v3_add(&(atom[i].f),&(atom[i].f),&force); v3_sub(&(atom[j].f),&(atom[j].f),&force); } @@ -547,19 +547,19 @@ double potential_lennard_jones(t_moldyn *moldyn) { params=moldyn->pot_params; atom=moldyn->atom; count=moldyn->count; - eps=params->epsilon; + eps=params->epsilon4; sig6=params->sigma6; sig12=params->sigma12; u=0.0; for(i=0;iatom; count=moldyn->count; params=moldyn->pot_params; - eps=params->epsilon; - sig6=params->sigma6; - sig12=params->sigma12; + eps=params->epsilon4; + sig6=6*params->sigma6; + sig12=12*params->sigma12; for(i=0;idim)); d=v3_absolute_square(&distance); if(d<=moldyn->cutoff_square) { @@ -598,11 +598,13 @@ int force_lennard_jones(t_moldyn *moldyn) { h1*=h2; /* 1/r^14 */ h1*=sig12; h2*=sig6; - d=12.0*h1-6.0*h2; + /* actually there would be a '-', * + * but f=-d/dr potential */ + d=h1+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); + v3_add(&(atom[i].f),&(atom[i].f),&force); + v3_sub(&(atom[j].f),&(atom[j].f),&force); } } }