Dear Axel and Steve, thanks for the discussion about how to apply a force and thanks to Axel for gimme a new fix.
In fix_spring_pull I found a bug due to this fact
xc += xv * update->dt;
yc += yv * update->dt;
zc += zv * update->dt;
domain->minimum_image(xc,yc,zc);
dx = xcm[0] - xc;
dy = xcm[1] - yc;
dz = xcm[2] - xc;
domain->minimum_image(dx,dy,dz);
because, due to minimum_image procedure, it’s possible that xc<xcm[0] and this is wrong. So I found that instead do this:
xc += xv * update->dt;
yc += yv * update->dt;
zc += zv * update->dt;
//domain->minimum_image(xc,yc,zc);
check = xcm[0] - xcm_old[0] + boxlength/2.0;
if(check < 0.0) counter+=1;
check = xcm[0] - xcm_old[0] - boxlength/2.0;
if(check > 0.0) counter-=1;
dx = xcm[0] + counterboxlength - xc;
dy = xcm[1] + counterboxlength - yc;
dz = xcm[2] + counter*boxlength - xc;
work properly. Of course this work only if the pulling direction is along x-axis but it’s straight to extend to other directions.
Secondly I found some difference in the medium force between rigid and rigid/nve. I attach the some files.
-in is the lammps input script
-out_lammps_rigid is the output of lammps using rigid in the input script
-out_lammps_rigid is the output of lammps using rigid/nve in the input script
-out_MD_code is the ouput of a reference serial MD code
in lammps output the force is in the column 7 while in the other output is in 2 column
the only difference between the two code is the fact that in lammps the langevin thermostat is applied by using a uniform distribution while in the other code is applied by using a gaussian distribution.
Do you think that fix spring pull style can be useful also for other users?
Thanks for discussion.
N.
2010/11/30 nicola varini <nicola.varini@…24…>
lammps_files.tar.gz (402 KB)