Recently, I’ve discovered that fix efield with dipole cannot apply with atom style variables. I’ve planned to addforce and torque manually. However, dipole variables must be obtained via compute command, and compute variables cannot apply with fix addforce. Are there any replacements for this issue?
Best Regards
Not without modifying source code. You can either modify fix_efield.cpp to support variable efield with point dipoles or add code to variable.cpp to access the dipole moment property.
1 Like
A dipole in a non-uniform electric field experiences both a torque and force. To get the force, you need to take the gradient of the electric field. I think it is hard to do this for a general atom-style variable, which isn’t guaranteed to have a simple analytic formula that is easily differentiable, or even be free from discontinuities. I suppose you could use a finite-difference method but that also can have issues with choosing an appropriate step size. So this is why I didn’t do this originally when I added support for dipoles in fix efield. I’m not saying it is impossible, just that it isn’t easy.
1 Like
Another option would be to require the user to supply both the electric field and its derivative as two separate variables into fix efield, then it seems like it would be straightforward to implement support for dipoles in non-uniform field.
1 Like