@@ -117,6 +117,9 @@ slab geometries.
117
117
118
118
<a href="https://docs.lammps.org" target="_blank">documentation</a>
119
119
120
+ System definition
121
+ -----------------
122
+
120
123
The next step is to create the simulation box and populate it with
121
124
atoms. Modify the ``System definition `` category of
122
125
**initial.lmp ** as shown below:
@@ -134,14 +137,18 @@ The first line, ``region simbox (...)``, defines a region named
134
137
from -20 to 20 units along all three spatial dimensions. The second
135
138
line, ``create_box 2 simbox ``, initializes a simulation box based
136
139
on the region ``simbox `` and reserves space for two types of atoms.
137
- In LAMMPS, an atom *type * represents a group of atoms that
138
- interact using the same set of force field parameters (here, the Lennard-Jones
139
- parameters).
140
+ In LAMMPS, every atom is assigned an atom type property. This property selects which force
141
+ field parameters (here, the Lennard-Jones parameters, :math: `\epsilon _{ij}`
142
+ and :math: `\sigma _{ij}`) are applied to each pair of atoms via the pair_coeff
143
+ command (see below). We discuss in :ref: `carbon-nanotube-label ` how this applies to
144
+ many-body pair styles, and in :ref: `all-atoms-label ` how this applies to
145
+ Coulomb interactions.
140
146
141
147
.. admonition :: Note
142
148
:class: non-title-info
143
149
144
- From this point on, any command referencing an atom type larger than 2
150
+ From this point on, the number of atom types is *locked
151
+ in *, and any command referencing an atom type larger than 2
145
152
will trigger an error. While it is possible to allocate more atom
146
153
types than needed, you must assign a mass and provide force field
147
154
parameters for each atom type. Failing to do so will cause LAMMPS to
@@ -154,14 +161,15 @@ can be changed to produce different sequences of random numbers and,
154
161
consequently, different initial atom positions. The fourth line adds
155
162
100 atoms of type 2. Both ``create_atoms `` commands use the
156
163
optional argument ``overlap 0.3 ``, which enforces a minimum
157
- distance of 0.3 units between the randomly placed atoms. This
164
+ distance of 0.3 length units between the randomly placed atoms. This
158
165
constraint helps avoid close contacts between atoms, which can lead
159
- to excessively large forces and simulation instability. Each atom created in
160
- LAMMPS is automatically assigned a unique atom ID, which serves as a numerical
161
- identifier to distinguish individual atoms throughout the simulation.
162
- Atom IDs by default have the range from 1 to the total number of atoms,
163
- but this is not enforced. Deleting atoms, for example, causes *holes * in the list
164
- of atom IDs.
166
+ to excessively large forces and simulation instability.
167
+ Each created atom in LAMMPS is automatically
168
+ assigned a unique atom ID, which serves as a numerical
169
+ identifier to distinguish individual atoms throughout the
170
+ simulation. Atom IDs by default have the range from 1 to
171
+ the total number of atoms, but this is not enforced.Deleting atoms, for example,
172
+ causes *holes * in the list of atom IDs.
165
173
166
174
.. admonition :: Note
167
175
:class: non-title-info
@@ -204,19 +212,19 @@ to :math:`r_c = 4.0` length units :cite:`wang2020lennard,fischer2023history`:
204
212
where :math: `r` is the inter-particle distance, :math: `\epsilon _{ij}` is
205
213
the depth of the potential well that determines the interaction strength, and
206
214
:math: `\sigma _{ij}` is the distance at which the potential energy equals zero.
207
- The indexes :math: `i` and :math: `j` refer to pairs of particle types.
215
+ The indices :math: `i` and :math: `j` refer to pairs atoms with the corresponding atom types.
208
216
The fourth line, ``pair_coeff 1 1 1.0 1.0 ``, specifies the
209
217
Lennard-Jones coefficients for interactions between pairs of atoms
210
- of type 1: the energy parameter :math: `\epsilon _{11 } = 1.0 ` and
218
+ that both have atom type 1: the energy parameter :math: `\epsilon _{11 } = 1.0 ` and
211
219
the distance parameter :math: `\sigma _{11 } = 1.0 `. Similarly, the last line
212
220
sets the Lennard-Jones coefficients for interactions between atoms
213
221
of type 2, :math: `\epsilon _{22 } = 0.5 `, and :math: `\sigma _{22 } = 3.0 `.
214
222
215
223
.. admonition :: Note
216
224
:class: non-title-info
217
225
218
- By default, LAMMPS calculates the cross coefficients for different atom
219
- types using geometric average : :math: `\epsilon _{ij} = \sqrt {\epsilon _{ii} \epsilon _{jj}}`,
226
+ By default, LAMMPS calculates the mixed force field coefficients for different
227
+ atom types using geometric averages : :math: `\epsilon _{ij} = \sqrt {\epsilon _{ii} \epsilon _{jj}}`,
220
228
:math: `\sigma _{ij} = \sqrt {\sigma _{ii} \sigma _{jj}}`. In the present case,
221
229
:math: `\epsilon _{12 } = \sqrt {1.0 \times 0.5 } = 0.707 `, and
222
230
:math: `\sigma _{12 } = \sqrt {1.0 \times 3.0 } = 1.732 `. Other rules
@@ -249,11 +257,16 @@ the post-run summary and statistics output.
249
257
.. admonition :: Note
250
258
:class: non-title-info
251
259
252
- The *thermodynamic information * printed by LAMMPS refers to instantaneous values
253
- of thermodynamic properties at the specified steps, not cumulative averages.
260
+ The *thermodynamic information * printed by LAMMPS
261
+ using ``thermo_style custom `` keywords refers to instanta-
262
+ neous values of the specified thermodynamic properties
263
+ at each output step, not cumulative averages. However,
264
+ LAMMPS also allows to reference a wide variety of custom data from
265
+ compute styles, fix styles, and variables.
266
+ These can be used for on-the-fly analysis, including cumulative and sliding-window averages.
254
267
255
268
You can now run LAMMPS (basic commands for running LAMMPS
256
- are provided in :ref: `running-lammps-label `.
269
+ are provided in :ref: `running-lammps-label `) .
257
270
The simulation should finish quickly.
258
271
259
272
With the default settings, LAMMPS--GUI will open two windows: one
@@ -283,18 +296,19 @@ following ``minimize`` command:
283
296
# 5) Run
284
297
minimize 1.0e-6 1.0e-6 1000 10000
285
298
286
- This tells LAMMPS to perform an energy minimization of the system.
299
+ This tells LAMMPS to perform an iterative energy minimization of the system.
287
300
Specifically, LAMMPS will compute the forces on all atoms and then update their
288
301
positions according to a selected algorithm, aiming to reduce
289
302
the potential energy. By default, LAMMPS uses the conjugate gradient (CG)
290
303
algorithm :cite: `hestenes1952methods `. The simulation will stop as soon
291
- as the minimizer algorithm cannot find a way to lower the potential
292
- energy. Note that, except for trivial systems, minimization algorithms will find a
304
+ as one of the four minimizer criteria is met. LAMMPS will then report which stopping criterion
305
+ was satisfied, along with selected system properties at both the initial
306
+ and final steps. Note that, except for trivial systems, minimization algorithms will find a
293
307
local minimum rather than the global minimum.
294
308
295
309
Run the minimization and observe that LAMMPS-GUI captures the output
296
310
and updates the chart in real time. This run executes quickly (depending
297
- on your computer's capabilities), but LAMMPS-GUI may fail to capture some
311
+ on your computer's capabilities), and thus LAMMPS-GUI may fail to capture some
298
312
of the thermodynamic data. In that
299
313
case, use the ``Preferences `` dialog to reduce the data update
300
314
interval and switch to single-threaded, unaccelerated execution in the
@@ -377,14 +391,14 @@ the value of the ``timestep`` and the number of steps for the
377
391
this ensemble, the system does not exchange energy with anything
378
392
outside the simulation box.
379
393
380
- Run the simulation using LAMMPS. Initially, there is no equilibrium
381
- between potential and kinetic energy , as the potential energy
394
+ Run the simulation using LAMMPS. Initially, the system is
395
+ not equilibrated , as the potential energy
382
396
decreases while the kinetic energy increases. After approximately
383
397
40000 steps, the values for both kinetic and potential energy
384
398
plateau, indicating that the system has reached equilibrium, with
385
399
the total energy fluctuating around a certain constant value.
386
400
387
- Now, we change the ``Run `` section to (note the smaller number of
401
+ Now, we change the second ``Run `` section to (note the smaller number of
388
402
MD steps):
389
403
390
404
.. code-block :: lammps
@@ -658,7 +672,7 @@ have noticed that some atoms left their original region during
658
672
minimization. To start the simulation from a clean slate, with only
659
673
atoms of type 2 inside the cylinder and atoms of type 1 outside the
660
674
cylinder, let us delete the misplaced atoms by adding the following
661
- commands to **improved.md.lmp **:
675
+ commands to the `` System definition `` category to **improved.md.lmp **:
662
676
663
677
.. code-block :: lammps
664
678
@@ -743,13 +757,26 @@ in a ``thermo_style custom`` command (see below).
743
757
.. admonition :: Note
744
758
:class: non-title-info
745
759
746
- LAMMPS ``compute `` commands can produce three kinds of data: scalars (single values),
747
- vectors (one-dimensional arrays), or arrays (two-dimensional tables).
748
- When referencing results of a compute, you can use indices: for example,
749
- ``c\_mycompute `` refers to the entire scalar, vector, or array, and
750
- ``c\_mycompute[1] `` refers to its first element (in case of vector or array).
751
- In general, *consumer * commands can only work with certain data types,
752
- check the documentation of each command to ensure compatibility.
760
+ LAMMPS ``compute `` commands can produce
761
+ a wide variety of data and one can identify the category from the
762
+ name of the compute style: global data (no suffix), local data
763
+ (/local suffix), per-atom data (/atom suffix), per-chunk data
764
+ (/chunk suffix), per-gridpoint data (/grid suffix). In the example
765
+ above, the ``compute coord/atom `` produces per-atom data, which
766
+ is used as input for ``compute reduce `` which returns global
767
+ data. For global data three kinds of data exists: scalars (single
768
+ values), vectors (one-dimensional arrays), or arrays
769
+ (two-dimensional tables). When referencing results of a compute,
770
+ you can use indices: for example, ``c_mycompute `` refers to
771
+ the entire scalar, vector, or array, and ``c_mycompute[1] ``
772
+ refers to its first element (in case of vector or array). In some
773
+ cases also wildcards like "*" can be used to, for instance, refer to all elements
774
+ of a vector instead of having specify all elements individually.
775
+ In general, *consumer * commands (fix styles or dump styles,
776
+ variables, or other compute styles) can only work with certain data
777
+ types or need to have keywords set to select which data to use.
778
+ You need to check the documentation of each command to ensure
779
+ compatibility.
753
780
754
781
.. admonition :: Note
755
782
:class: non-title-info
0 commit comments