Realize a non-zero net velocity but thermostat for particles

Hi LAMMPS Users and Developers,

I hope this message finds you well!

I am currently trying to simulate a nitrogen flow with a non-zero net velocity while maintaining a thermostat to control the temperature. The goal is to achieve a nitrogen flow with a constant linear velocity at a specific temperature.

After reviewing the “How to thermostat” documentation page, I believe the approach is feasible. However, I have encountered some issues when implementing the dynamics and would greatly appreciate your guidance.

Here are the relevant parts of my code:

fix move n2 move linear 0.1 NULL NULL # Impose a center-of-mass velocity along the x direction, e.g., 1.0 A/ps

compute exclu n2 temp/com # Calculate the temperature of the nitrogen group excluding the center-of-mass velocity

fix 303 n2 temp/rescale 100 100 100 1.0 1.0 # Apply temp/rescale to control the temperature of the nitrogen group

fix_modify 303 temp exclu # Exclude center-of-mass velocity from the temperature calculation

Here are my questions:

  1. Based on your expertise, does this approach seem correct for introducing a center-of-mass velocity using the fix move command? Specifically, will the subsequent commands effectively achieve the following behavior?
  • “The removal of the center-of-mass velocity by this fix is essentially computing the temperature after a ‘bias’ has been removed from the velocity of the atoms. If this compute is used with a fix command that performs thermostatting, then this bias will be subtracted from each atom, thermostatting of the remaining thermal velocity will be performed, and the bias will be added back in.”
  1. In my tests, I noticed a difference between the following two fix move settings:

fix move n2 move linear 0.1 NULL NULL
fix move n2 move linear 0.1 0 0

When using the second setting (0.1 0 0), I encountered an error:The temp/rescale command cannot thermostat zero temperatures.My understanding is that the fix move command imposes a center-of-mass velocity and should not directly affect the thermostat conditions. Could you help me understand why this error occurs with the second setting?

Your advice and insights will be immensely helpful, and I truly appreciate your time and expertise.

Thank you in advance for any assistance you can provide!

Best regards,
Zhijun Tian

First off, using fix temp/rescale is a very bad idea. Don’t use it for anything that should have physical meaning.

The common way to induce a flow is to use fix addforce on the flowing atoms. At some point some dynamic equilibrium will form that limits the final flow velocity. If you want more control over the process, you can consider using fix controller where you monitor the average velocity of the flowing particles versus the added force.

Fix move is not a good choice, it will induce a prescribed motion without any consideration for the computed interactions or thermostats or anything else that would modify per-atom properties.

Fix move 0.1 NULL NULL
and
Fix move 0.1 0 0
have a very different effect. Please study the documentation.

The error from fix temp/rescale is self-explanatory. There is no (finite) scaling factor that when applied to 0 will achieve a finite value.

Thank you so much, Axel!

Your answers truly made my day and helped me clear up the confusion. Even though I’ve gone through some of the documentation, it seems I still have more to learn—there’s always more to dig into, I suppose!

I really appreciate your detailed explanation and the time you took to help me. Thanks again!