[lammps-users] How to define different dielectric constant for different regions

  I want to know how to define a different value of dielectric constant for different regions of the simulation box if its possible.


  In my system the electric field is a variable along x. for e.g:
-100 < x <0 E1
0< x<50 E2
50< x <100 E3
How do I define such an electric field?


From what I understand, LAMMPS is only able to do a time dependent efield. I'm also interested in a spatially varying efield capability. What seems most useful for my purposes would be something like a table file instead of some function. It sounds like that would work for you as well. I've been kicking around the idea for a while and was planning to take a stab at the implementation sometime soon. It shouldn't be to hard.

Quoting Jyoti Mahalik <[email protected]>:

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))


What is the format of using logical && or || operator in if loop. I have tried various formats and I looked it up in the document but I couldn't come across any example.
for e.g. how should I write


in LAMMPS format


You can't do that - the only syntax allowed in the if test is what
is on the doc page - compare a variable to a constant or two variables.
So if you can put your logical expression in a variable, then it
would work.