git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@16053 f3b2605a-c512-4ea7-a41b...
[lammps.git] / doc / src / fix_efield.txt
blob9e3d7797d858f1470caf0f20d14e0e322b10f603
1 "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
3 :link(lws,http://lammps.sandia.gov)
4 :link(ld,Manual.html)
5 :link(lc,Section_commands.html#comm)
7 :line
9 fix efield command :h3
11 [Syntax:]
13 fix ID group-ID efield ex ey ez keyword value ... :pre
15 ID, group-ID are documented in "fix"_fix.html command :ulb,l
16 efield = style name of this fix command :l
17 ex,ey,ez = E-field component values (electric field units) :l
18 any of ex,ey,ez can be a variable (see below) :l
19 zero or more keyword/value pairs may be appended to args :l
20 keyword = {region} or {energy} :l
21   {region} value = region-ID
22     region-ID = ID of region atoms must be in to have added force
23   {energy} value = v_name
24     v_name = variable with name that calculates the potential energy of each atom in the added E-field :pre
25 :ule
27 [Examples:]
29 fix kick external-field efield 1.0 0.0 0.0
30 fix kick external-field efield 0.0 0.0 v_oscillate :pre
32 [Description:]
34 Add a force F = qE to each charged atom in the group due to an
35 external electric field being applied to the system.  If the system
36 contains point-dipoles, also add a torque on the dipoles due to the
37 external electric field.
39 For charges, any of the 3 quantities defining the E-field components
40 can be specified as an equal-style or atom-style
41 "variable"_variable.html, namely {ex}, {ey}, {ez}.  If the value is a
42 variable, it should be specified as v_name, where name is the variable
43 name.  In this case, the variable will be evaluated each timestep, and
44 its value used to determine the E-field component.
46 For point-dipoles, equal-style variables can be used, but atom-style
47 variables are not currently supported, since they imply a spatial
48 gradient in the electric field which means additional terms with
49 gradients of the field are required for the force and torque on
50 dipoles.
52 Equal-style variables can specify formulas with various mathematical
53 functions, and include "thermo_style"_thermo_style.html command
54 keywords for the simulation box parameters and timestep and elapsed
55 time.  Thus it is easy to specify a time-dependent E-field.
57 Atom-style variables can specify the same formulas as equal-style
58 variables but can also include per-atom values, such as atom
59 coordinates.  Thus it is easy to specify a spatially-dependent E-field
60 with optional time-dependence as well.
62 If the {region} keyword is used, the atom must also be in the
63 specified geometric "region"_region.html in order to have force added
64 to it.
66 :line
68 Adding a force or torque to atoms implies a change in their potential
69 energy as they move or rotate due to the applied E-field.
71 For dynamics via the "run" command, this energy can be optionally
72 added to the system's potential energy for thermodynamic output (see
73 below).  For energy minimization via the "minimize" command, this
74 energy must be added to the system's potential energy to formulate a
75 self-consistent minimization problem (see below).
77 The {energy} keyword is not allowed if the added field is a constant
78 vector (ex,ey,ez), with all components defined as numeric constants
79 and not as variables.  This is because LAMMPS can compute the energy
80 for each charged particle directly as E = -x dot qE = -q (x*ex + y*ey
81 + z*ez), so that -Grad(E) = F.  Similarly for point-dipole particles
82 the energy can be computed as E = -mu dot E = -(mux*ex + muy*ey +
83 muz*ez).
85 The {energy} keyword is optional if the added force is defined with
86 one or more variables, and if you are performing dynamics via the
87 "run"_run.html command.  If the keyword is not used, LAMMPS will set
88 the energy to 0.0, which is typically fine for dynamics.
90 The {energy} keyword is required if the added force is defined with
91 one or more variables, and you are performing energy minimization via
92 the "minimize" command for charged particles.  It is not required for
93 point-dipoles, but a warning is issued since the minimizer in LAMMPS
94 does not rotate dipoles, so you should not expect to be able to
95 minimize the orientation of dipoles in an applied electric field.
97 The {energy} keyword specifies the name of an atom-style
98 "variable"_variable.html which is used to compute the energy of each
99 atom as function of its position.  Like variables used for {ex}, {ey},
100 {ez}, the energy variable is specified as v_name, where name is the
101 variable name.
103 Note that when the {energy} keyword is used during an energy
104 minimization, you must insure that the formula defined for the
105 atom-style "variable"_variable.html is consistent with the force
106 variable formulas, i.e. that -Grad(E) = F.  For example, if the force
107 due to the electric field were a spring-like F = kx, then the energy
108 formula should be E = -0.5kx^2.  If you don't do this correctly, the
109 minimization will not converge properly.
111 :line
113 [Restart, fix_modify, output, run start/stop, minimize info:]
115 No information about this fix is written to "binary restart
116 files"_restart.html.
118 The "fix_modify"_fix_modify.html {energy} option is supported by this
119 fix to add the potential "energy" inferred by the added force due to
120 the electric field to the system's potential energy as part of
121 "thermodynamic output"_thermo_style.html.  This is a fictitious
122 quantity but is needed so that the "minimize"_minimize.html command
123 can include the forces added by this fix in a consistent manner.
124 I.e. there is a decrease in potential energy when atoms move in the
125 direction of the added force due to the electric field.
127 The "fix_modify"_fix_modify.html {respa} option is supported by this
128 fix. This allows to set at which level of the "r-RESPA"_run_style.html
129 integrator the fix adding its forces. Default is the outermost level.
131 This fix computes a global scalar and a global 3-vector of forces,
132 which can be accessed by various "output
133 commands"_Section_howto.html#howto_15.  The scalar is the potential
134 energy discussed above.  The vector is the total force added to the
135 group of atoms.  The scalar and vector values calculated by this fix
136 are "extensive".
138 No parameter of this fix can be used with the {start/stop} keywords of
139 the "run"_run.html command.
141 The forces due to this fix are imposed during an energy minimization,
142 invoked by the "minimize"_minimize.html command.  You should not
143 specify force components with a variable that has time-dependence for
144 use with a minimizer, since the minimizer increments the timestep as
145 the iteration count during the minimization.
147 NOTE: If you want the fictitious potential energy associated with the
148 added forces to be included in the total potential energy of the
149 system (the quantity being minimized), you MUST enable the
150 "fix_modify"_fix_modify.html {energy} option for this fix.
152 [Restrictions:]
154 This fix is part of the MISC package.  It is only enabled if LAMMPS
155 was built with that package.  See the "Making
156 LAMMPS"_Section_start.html#start_3 section for more info.
158 [Related commands:]
160 "fix addforce"_fix_addforce.html
162 [Default:] none