spatially dependent electric field

Hi,
I am trying to define an electric field with spatial dependence , i.e. electric field gradient.

Hi,
I am trying to define an electric field with spatial dependence , i.e.
electric field gradient.

Actually, as of the 23Apr patch, the fix efield command can
take a variable as an argument that specifies a time- and/or spatially-dependent
efield. I think you could use boolean/logical math operators in the
formula to get the
effect of a field of value E1 within a region, e.g.

variable e1 equal 100.0
variable field1 atom v_e1*((x>0) && (x<100))

Also Lammps documentation reads:

Atom-style variables can specify the same formulas as equal-style
variables but can also include per-atom values, such as atom
coordinates. Thus it is easy to specify a spatially-dependent E-field
with optional time-dependence as well.

Unfortunately these two examples are not clear to me. Could someone
enlighten me on this?

sorry, but you have to be more specific than “it is not clear to me”. i think the examples and documentation you quote are very straightforward and quite obvious and logical. perhaps you need to spend some more time reading the documentation, e.g. about variables.

also, why don’t you make some simple tests, where you define the suggested atom style variable and then output it via a custom dump for a system with just a handful of atoms and compare to what you expect/compute manually? you can then repeat the run with fix efield included and check out the change in forces.

that should allow you to “reverse engineer” the given example and suggestions and confirm/compare with the documentation.

axel.