@@ -5,10 +5,11 @@ To run a simulation using LAMMPS, you need to write an input script
55containing a series of commands for LAMMPS to execute, similar to Python
66or Bash scripts. For clarity, the input scripts for this tutorial will
77be divided into five categories, which will be filled out step by step.
8- To set up this tutorial, navigate to the directory
9- where you want to store your files. Create a folder if needed and
10- place the initial input file, **initial.lmp **, into it. Then, open the
11- file in a text editor of your choice, and copy the following into it:
8+ To set up this tutorial using LAMMPS graphical user interface
9+ (LAMMPS--GUI) :cite: `lammps_gui_docs `, select ``Start LAMMPS Tutorial 1 ``
10+ from the ``Tutorials `` menu and follow the instructions. This will
11+ select (or create, if needed) a folder, place the initial input
12+ file **initial.lmp ** in it, and open the file in the LAMMPS--GUI Editor window:
1213
1314.. code-block :: lammps
1415
@@ -17,18 +18,15 @@ file in a text editor of your choice, and copy the following into it:
1718 # 2) System definition
1819 # 3) Settings
1920 # 4) Visualization
20- # 5) Run
21+ # 5) Run
2122
22- .. admonition :: Optional: follow this tutorial using LAMMPS-GUI
23+ .. admonition :: If you are not using LAMMPS-GUI
2324 :class: gui
2425
25- This tutorial can also be followed using LAMMPS graphical
26- user interface (LAMMPS--GUI) :cite: `lammps_gui_docs `.
27- Select ``Start LAMMPS Tutorial 1 `` from
28- the ``Tutorials `` menu of LAMMPS--GUI, and follow the
29- instructions. This will select (or create, if needed) a folder, place
30- the initial input file **initial.lmp ** in it, and open the file in
31- the LAMMPS--GUI Editor window.
26+ All tutorials can be followed without using LAMMPS-GUI. To
27+ do so, create a new folder and add a file named **initial.lmp **
28+ inside it. Open the file in a text editor of your choice and
29+ copy the previous lines into it.
3230
3331Everything that appears after a hash symbol (#) is a comment
3432and ignored by LAMMPS. These five categories are not required in every input script an do not
@@ -96,15 +94,11 @@ slab geometries.
9694
9795Each LAMMPS command is accompanied by extensive online documentation
9896that details the different options for that command :cite: `lammps_docs `.
99-
100- .. admonition :: If you are using LAMMPS-GUI
101- :class: gui
102-
103- From the LAMMPS--GUI editor buffer, you can access the documentation by
104- right-clicking on a line containing a command (e.g., ``units lj ``)
105- and selecting ``View Documentation for `units' ``. This action
106- should prompt your web browser to open the corresponding URL for the
107- online manual.
97+ From the LAMMPS--GUI editor buffer, you can access the documentation by
98+ right-clicking on a line containing a command (e.g., ``units lj ``)
99+ and selecting ``View Documentation for `units' ``. This action
100+ should prompt your web browser to open the corresponding URL for the
101+ online manual.
108102
109103The next step is to create the simulation box and populate it with
110104atoms. Modify the ``System definition `` category of
@@ -220,24 +214,21 @@ You can now run LAMMPS (basic commands for running LAMMPS
220214are provided in Ref. :cite: `lammps_run_basics `).
221215The simulation should finish quickly.
222216
223- .. admonition :: If you are using LAMMPS-GUI
224- :class: gui
225-
226- With the default settings, LAMMPS--GUI will open two windows: one
227- displaying the console output and another with a chart. The ``Output `` window
228- will display information from the executed commands, including the
229- total energy and pressure at step 0,
230- as specified by the thermodynamic data request. Since no actual simulation
231- steps were performed, the ``Charts `` window will be empty.
232-
233- **Snapshot image -- ** At this point, you can create a snapshot image of the current system
234- using the ``Image Viewer `` window, which can be accessed by
235- clicking the ``Create Image `` button in the ``Run `` menu. The
236- image viewer works by instructing LAMMPS to render an image of the
237- current system using its internal rendering library via the ``dump image ``
238- command. The resulting image is then displayed, with various
239- buttons available to adjust the view and rendering style. This will always
240- capture the current state of the system.
217+ With the default settings, LAMMPS--GUI will open two windows: one
218+ displaying the console output and another with a chart. The ``Output `` window
219+ will display information from the executed commands, including the
220+ total energy and pressure at step 0,
221+ as specified by the thermodynamic data request. Since no actual simulation
222+ steps were performed, the ``Charts `` window will be empty.
223+
224+ **Snapshot image -- ** At this point, you can create a snapshot image of the current system
225+ using the ``Image Viewer `` window, which can be accessed by
226+ clicking the ``Create Image `` button in the ``Run `` menu. The
227+ image viewer works by instructing LAMMPS to render an image of the
228+ current system using its internal rendering library via the ``dump image ``
229+ command. The resulting image is then displayed, with various
230+ buttons available to adjust the view and rendering style. This will always
231+ capture the current state of the system.
241232
242233Energy minimization
243234-------------------
@@ -259,17 +250,14 @@ as the minimizer algorithm cannot find a way to lower the potential
259250energy. Note that, except for trivial systems, minimization algorithms will find a
260251local minimum rather than the global minimum.
261252
262- .. admonition :: If you are using LAMMPS-GUI
263- :class: gui
264-
265- Run the minimization and observe that LAMMPS-GUI captures the output
266- and updates the chart in real time. This run executes quickly (depending
267- on your computer's capabilities), but LAMMPS-GUI may fail to capture some
268- of the thermodynamic data. In that
269- case, use the ``Preferences `` dialog to reduce the data update
270- interval and switch to single-threaded, unaccelerated execution in the
271- ``Accelerators `` tab. You can repeat the run; each new attempt will start
272- fresh, resetting the system and re-executing the script from the beginning.
253+ Run the minimization and observe that LAMMPS-GUI captures the output
254+ and updates the chart in real time. This run executes quickly (depending
255+ on your computer's capabilities), but LAMMPS-GUI may fail to capture some
256+ of the thermodynamic data. In that
257+ case, use the ``Preferences `` dialog to reduce the data update
258+ interval and switch to single-threaded, unaccelerated execution in the
259+ ``Accelerators `` tab. You can repeat the run; each new attempt will start
260+ fresh, resetting the system and re-executing the script from the beginning.
273261
274262Run the minimization. The potential energy, :math: `U`, decreases
275263from a positive value to a negative value
@@ -286,11 +274,10 @@ decreases - first rapidly - then more gradually, before plateauing at a
286274negative value. This indicates that the atoms have moved to reasonable
287275distances from one another.
288276
289- ..
290- Create and save a snapshot image of the simulation state after the
291- minimization, and compare it to the initial image. You should observe
292- that the atoms are *clumping together* as they move toward positions
293- of lower potential energy.
277+ Create and save a snapshot image of the simulation state after the
278+ minimization, and compare it to the initial image. You should observe
279+ that the atoms are *clumping together * as they move toward positions
280+ of lower potential energy.
294281
295282Molecular dynamics
296283------------------
@@ -394,20 +381,17 @@ it reaches a plateau value of about -0.25. The kinetic energy,
394381increases rapidly during molecular dynamics until it reaches
395382a plateau value of about 1.5.
396383
397- .. admonition :: If you are using LAMMPS-GUI
398- :class: gui
399-
400- From the information
401- printed in the ``Output `` window, one can see that the temperature
402- starts from 0 but rapidly reaches the requested value and
403- stabilizes itself near :math: `T=1 ` temperature units. One can also observe that
404- the potential energy, :math: `U`, rapidly decreases during energy
405- minimization (see the figure below). After
406- the molecular dynamics simulation starts, :math: `U` increases until
407- it reaches a plateau value of about -0.25. The kinetic energy,
408- :math: `K`, is equal to zero during energy minimization and then
409- increases rapidly during molecular dynamics until it reaches
410- a plateau value of about 1.5.
384+ From the information
385+ printed in the ``Output `` window, one can see that the temperature
386+ starts from 0 but rapidly reaches the requested value and
387+ stabilizes itself near :math: `T=1 ` temperature units. One can also observe that
388+ the potential energy, :math: `U`, rapidly decreases during energy
389+ minimization (see the figure below). After
390+ the molecular dynamics simulation starts, :math: `U` increases until
391+ it reaches a plateau value of about -0.25. The kinetic energy,
392+ :math: `K`, is equal to zero during energy minimization and then
393+ increases rapidly during molecular dynamics until it reaches
394+ a plateau value of about 1.5.
411395
412396.. figure :: figures/LJ-energy-dm.png
413397 :class: only-dark
@@ -444,42 +428,38 @@ Run the **initial.lmp** file using LAMMPS again. A file named **dump.lammpstrj**
444428must appear alongside **initial.lmp **. The **.lammpstrj ** file can be opened
445429using VMD :cite: `vmd_home, humphrey1996vmd ` or OVITO :cite: `ovito_home, ovito_paper `.
446430
447- .. admonition :: If you are using LAMMPS-GUI
448- :class: gui
431+ Use the ``dump image `` command to create snapshot images during the simulation. We
432+ have already explored the ``Image Viewer `` window. Open it again
433+ and adjust the visualization to your liking using the available buttons.
434+ Now you can copy the commands used to create this visualization to the
435+ clipboard by either using the ``Ctrl-D `` keyboard shortcut or
436+ selecting ``Copy dump image command `` from the ``File `` menu.
437+ This text can be pasted into the ``Visualization `` section
438+ of ``PART B `` of the **initial.lmp ** file. This may look like
439+ the following:
440+
441+ .. code-block :: lammps
449442
450- Use the ``dump image ``
451- command to create snapshot images during the simulation. We
452- have already explored the ``Image Viewer `` window. Open it again
453- and adjust the visualization to your liking using the available buttons.
454- Now you can copy the commands used to create this visualization to the
455- clipboard by either using the ``Ctrl-D `` keyboard shortcut or
456- selecting ``Copy dump image command `` from the ``File `` menu.
457- This text can be pasted into the ``Visualization `` section
458- of ``PART B `` of the **initial.lmp ** file. This may look like
459- the following:
460-
461- .. code-block :: lammps
462-
463- dump viz all image 100 myimage-*.ppm type type size 800 800 zoom 1.452 shiny 0.7 fsaa yes &
464- view 80 10 box yes 0.025 axes no 0.0 0.0 center s 0.483725 0.510373 0.510373
465- dump_modify viz pad 9 boxcolor royalblue backcolor white adiam 1 1.6 adiam 2 4.8
466-
467- This command tells LAMMPS to generate NetPBM format images every 100
468- steps. The two ``type `` keywords are for *color * and
469- *diameter *, respectively. Run the **initial.lmp ** using
470- LAMMPS again, and a new window named ``Slide Show `` will pop up.
471- It will show each image created by the ``dump image `` as it is
472- created. After the simulation is finished (or stopped), the slideshow
473- viewer allows you to animate the trajectory by cycling through the
474- images. The window also allows you to export the animation to a movie
475- (provided the FFMpeg program is installed) and to bulk delete those
476- image files.
477-
478- The rendering of the system can be further adjusted using the many
479- options of the ``dump image `` command. For instance, the value for the
480- ``shiny `` keyword is used to adjust the shininess of the atoms, the
481- ``box `` keyword adds or removes a representation of the box, and
482- the ``view `` and ``zoom `` keywords adjust the camera (and so on).
443+ dump viz all image 100 myimage-*.ppm type type size 800 800 zoom 1.452 shiny 0.7 fsaa yes &
444+ view 80 10 box yes 0.025 axes no 0.0 0.0 center s 0.483725 0.510373 0.510373
445+ dump_modify viz pad 9 boxcolor royalblue backcolor white adiam 1 1.6 adiam 2 4.8
446+
447+ This command tells LAMMPS to generate NetPBM format images every 100
448+ steps. The two ``type `` keywords are for *color * and
449+ *diameter *, respectively. Run the **initial.lmp ** using
450+ LAMMPS again, and a new window named ``Slide Show `` will pop up.
451+ It will show each image created by the ``dump image `` as it is
452+ created. After the simulation is finished (or stopped), the slideshow
453+ viewer allows you to animate the trajectory by cycling through the
454+ images. The window also allows you to export the animation to a movie
455+ (provided the FFMpeg program is installed) and to bulk delete those
456+ image files.
457+
458+ The rendering of the system can be further adjusted using the many
459+ options of the ``dump image `` command. For instance, the value for the
460+ ``shiny `` keyword is used to adjust the shininess of the atoms, the
461+ ``box `` keyword adds or removes a representation of the box, and
462+ the ``view `` and ``zoom `` keywords adjust the camera (and so on).
483463
484464Improving the script
485465====================
@@ -556,12 +536,9 @@ the ``minimize`` command:
556536Run the **improved.min.lmp ** file using LAMMPS--GUI. At the end
557537of the simulation, a file called **improved.min.data ** is created.
558538
559- .. admonition :: If you are using LAMMPS-GUI
560- :class: gui
561-
562- You can view the contents of **improved.min.data ** from LAMMPS--GUI, by
563- right-clicking on the file name in the editor and selecting the entry
564- ``View file improved.min.data ``.
539+ You can view the contents of **improved.min.data ** from LAMMPS--GUI, by
540+ right-clicking on the file name in the editor and selecting the entry
541+ ``View file improved.min.data ``.
565542
566543The created **.data ** file contains all the information necessary
567544to restart the simulation, such as the number of atoms, the box size,
0 commit comments