Floating Point Exception during Single-Molecule Stretching Using fix smd

Dear Lammps users,

I am currently working on a single-molecule stretching simulation using LAMMPS. My goal is to mimic an AFM-based pulling experiment, where one end of a polymer is fixed, and the other end is pulled at a constant velocity using the fix smd command with cvel mode and tether style.

Here is a simplified version of the command I’m using:

‘’‘fix 1 mobile nvt temp 300 300 10.0
fix pmf na smd cvel 7 -0.00001 tether NULL NULL 670.9190 0.0
variable dt equal 1.0
variable step equal 5000000
variable tt equal dt*step
variable distance equal 500
variable dr equal f_pmf[6]
fix 2 nomoving move linear 0 0 0
velocity mobile create 300 1746710975 mom yes rot yes dist gaussian’‘’

The group na is the atom being pulled (one end of the polymer).
The opposite end is held fixed using a separate group (nomoving).

Although the simulation runs fine initially, it eventually crashes with a Floating Point Exception after about 500,000 steps. I’ve verified that the system is stable at the beginning (temperature, pressure, and energy all behave normally).

I’ve reviewed the documentation and other forum posts related to fix smd, particularly focusing on parameters like R0, spring constant, and tether handling, but haven’t yet identified the root cause.

Has anyone experienced a similar issue when using fix smd in this type of single-molecule stretching setup?
Any guidance on how to correctly define R0, or how to better control the numerical stability during long pulling simulations, would be much appreciated.

Best regards,
SuShi

My guess is on the fact that your distance to the target become exactly zero and that causes a division by zero. This can be avoided by using fewer steps, you don’t really need the last few.

Please note that fix smd is very old and effectively unmaintained these days. A similar functionality is available in both the COLVARS and the PLUMED package.

Thank you very much for your response and valuable insights.

That explanation regarding division by zero, caused by the distance reaching exactly zero, makes a lot of sense—I hadn’t considered that possibility. I will definitely try stopping the simulation earlier to avoid that condition.

Also, I appreciate the suggestion to explore COLVARS or PLUMED for this type of simulation. I will investigate both options to determine which one is best suited for my system.

Thank you once again for taking the time to help. I greatly appreciate your advice!

Best regards,
SuShi