Is fix bfield compatable with fix langevin

Dear Lammps users and developers,

I am using the non-standard package fix bfield disscussed in this post https://matsci.org/t/discrepency-beween-old-version-and-new-version/50014

I want to use fix bfield with fix langevin command.I had a look at the source code of fix bfield and found initial_integrate () and post_integrate () function. I presume those two function perform the nve-like integrator for this fix. While it seems the standard lammps performs those two functions somewhere else. If it is ture, does it mean that this fix bfield is not compatable with fix langevin?

Thoretically, one can add the force due to magnetic field to the langevin equation. Technically , if this fix bfield is not compatable with fix langevin, if it is possible to make them compatable by further programming?

If it can be done via further programming, which part of the source code in lammps will be a good guideline for it?

Thanks

You are on your own with this one. The fix bfield code is not a supported part of LAMMPS and we only make it available in the lammps-plugins package for the convenience of people wanting to use it. We will not spend any significant amount of energy on supporting it, trying to figure out things and explaining them to people. If you want it bad enough, you have to teach yourself what is needed to implement what you need and test whether this works correctly the way you are using it. Theoretically, the same applies to all of LAMMPS, but here is the additional complication that there is no documentation explaining how this fix is supposed to behave and which features are implemented and what is missing. That is for you to figure out and if you do so, you are encouraged to write the missing documentation and improve the source code, test it, and then contribute the improved code to be included into LAMMPS.

But for all the questions you have, you cannot expect any help from the LAMMPS developers. We have a hard enough time to keep up with supporting the bits and pieces that are in the LAMMPS distribution, and even then, we often have to suggest to contact the original contributor of the code. Being a developer and maintainer of a software does not make one automatically an expert in all the included features.

The LAMMPS documentation is quite detailed about how a timestep works, and it states:

All the active fixes defined in an input script, that are flagged to have an initial_integrate() method, are invoked at the beginning of each timestep. Examples are fix nve or fix nvt or fix npt which perform the start-of-timestep velocity-Verlet integration operations to update velocities by a half-step, and coordinates by a full step.

So, for example, as LAMMPS runs a script with a fix nvt followed by a fix nve (thermostatting some particles while simply integrating others), in each timestep’s “initial integrate” phase, it first executes the initial_integrate() of fix nvt and then that of fix nve.

Hopefully this makes sense to you. However, you can also always verify any MD package’s implementation in a “black box” manner, by

  1. Writing out the equations of motion;
  2. Running a small system for a few timesteps;
  3. Independently confirming that the trajectories from (2) obey the equations of motion from (1).

Anyone working with non-standard equations of motion should either be able to do this themselves, or have access to a mentor or service who can do this for them. After all, you could have a simulation that runs without crashing but have some tiny bug (like plus instead of minus, or multiplying by sqrt(2) instead of dividing) that renders the results useless.