I have a problem to initially give a negative force to "fix smd" with "cvel"
mode.

sorry, i don't get this. the sign of the smd force depends on
the position of the center of mass of the pulled group relative
to the target location of the spring.

If the initial force is positive, there is no problem. I just put R0 with
the value of "Initial_Force/Spring_constant".

But when the Initial_Force<0, I would have a negative R0. So I got the
message

ERROR: R0 < 0 for fix smd command

r0 _has_ to be zero or positive. i suspect you are mistaken about
what r0 does. please re-read the documentation carefully.
in most cases r0 is likely to be 0.

Does anyone know how to fix this problem? Any suggestion would be most
appreciated.

Thank you so much for your reply. I get you and understand better about fix smd now.

Probably, I didn’t express my meaning exactly last time. Yes, you are right. The sign of the smd force depends on the displacement vector between the mass center of the tethered group and the reference point of the spring, i.e., dx, dy and dz.

Here I only talk about the “tether” type. In the code, it gives us

fx = k_spring * dr * dx/r
fy = k_spring * dr * dy/r
fz = k_spring * dr * dz/r

and

dr = r - r0 - r_old

At the most beginning, r = r_old, because no velocity to update r_old. Therefore, at that time, the smd force is decided by r0 and dx/r, dy/r and dz/r (k_spring is a constant). If for one-dimension case(say x direction), namely, the value of the initial force is depended on r0 and the sing of the force is depended on dx/r ( -1 or +1).

Yes, in most case, r0 =0 to give us a zero initial smd force. While I need a non-zero one, I could evaluate r0 and adjust the position of the tether point to change the sign of the initial force.

Yes, in most case, r0 =0 to give us a zero initial smd force. While I need a
non-zero one,

sorry, but i don't get, why you would want to do this. AFAIK, you
always need the tethered object to be "dragged behind" you to get
meaningful results.

non-zero one, I could evaluate r0 and adjust the position of the tether
point to change the sign of the initial force.

no. r0 is something else. with r0 > 0, you change the reference
point for the spring into the surface of sphere with radius r0
around the provided x, y, and z value. in a 1d case this does not
seem to make sense, but in 2d and 3d it does. r0 is basically only
available in fix smd, since it was already in in fix spring (from
which fix smd is derived) and it was no extra effort to keep it in.

Is my understanding correct?

Any instruction would be most appreciated.

well, you have the source code and can in principle tweak it any
which way you like. please note, that i'm planning to send in an
updated version with some enhancements and cleaning up that is needed
for some applications in our group. so if you can make a good case
for why you need what kind of modification, i may take that under
consideration and include it in the updated version.