Skip to content

Commit b08d6c8

Browse files
committed
firther refinment
1 parent e544529 commit b08d6c8

File tree

13 files changed

+173
-137
lines changed

13 files changed

+173
-137
lines changed

docs/lammpstutorials-inputs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 4e249a6f7a0f8f8057bf72c07d39841a297e69a6

docs/sphinx/source/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ lammpstutorials by Simon Gravelle : LAMMPS courses for beginners
2020
tutorial5/reactive-silicon-dioxide.rst
2121
tutorial6/water-adsorption-in-silica.rst
2222
tutorial7/free-energy-calculation.rst
23-
tutorial8/reactive-molecular-dynamics.rst
2423

2524
.. toctree::
2625
:maxdepth: 2

docs/sphinx/source/tutorial1/tutorial.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ a plateau value of about 1.5.
403403

404404
.. container:: figurelegend
405405

406-
(a) Potential energy, :math:`U`, of the binary mixture as a function of the
406+
Figure: (a) Potential energy, :math:`U`, of the binary mixture as a function of the
407407
step during energy minimization.
408408
(b) Potential energy, :math:`U`, as a function of time, :math:`t`, during molecular dynamics in
409409
the NVT ensemble. (c) Kinetic energy, :math:`K`, during energy minimization.
@@ -749,7 +749,7 @@ over time.
749749

750750
.. container:: figurelegend
751751

752-
Evolution of the system during mixing. The
752+
Figure: Evolution of the system during mixing. The
753753
three snapshots show respectively the system at :math:`t = 0` (left panel),
754754
:math:`t = 75` (middle panel), and :math:`t = 1500` (right panel). The atoms of type
755755
1 are represented as small green spheres and the atoms of type 2 as large cyan spheres.
@@ -775,7 +775,7 @@ expected during mixing. This can be observed using the entry
775775

776776
.. container:: figurelegend
777777

778-
a) Evolution of the numbers :math:`N_\text{1, in}$` and :math:`N_\text{2, in}` of atoms
778+
Figure: a) Evolution of the numbers :math:`N_\text{1, in}$` and :math:`N_\text{2, in}` of atoms
779779
of types 1 and 2, respectively, within the ``cyl_in`` region as functions
780780
of time :math:`t`. b) Evolution of the coordination number :math:`C_{1-2}`
781781
(compute ``sumcoor12``) between atoms of types 1 and 2.
Loading
Loading

docs/sphinx/source/tutorial2/figures/breakable.ipynb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
"execution_count": 1,
66
"id": "7c8c9669",
77
"metadata": {},
8-
"outputs": [],
8+
"outputs": [
9+
{
10+
"name": "stderr",
11+
"output_type": "stream",
12+
"text": [
13+
"/home/simon/.local/lib/python3.12/site-packages/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available.\n",
14+
" warnings.warn(\"Unable to import Axes3D. This may be due to multiple versions of \"\n"
15+
]
16+
}
17+
],
918
"source": [
1019
"import numpy as np\n",
1120
"import sys, os, git, lammps_logfile\n",

docs/sphinx/source/tutorial2/figures/unbreakable.ipynb

Lines changed: 49 additions & 40 deletions
Large diffs are not rendered by default.

docs/sphinx/source/tutorial2/tutorial.rst

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,6 @@ which makes the average temperature of the entire system less relevant.
308308
The ``thermo_modify`` command also imposes the use of the YAML format that can easily be read by
309309
Python (see below).
310310

311-
.. figure:: figures/colored-edge-def-dark.png
312-
:class: only-dark
313-
:alt: Evolution of the CNT energy
314-
315-
.. figure:: figures/colored-edge-def-light.png
316-
:class: only-light
317-
:alt: Evolution of the CNT energy
318-
319-
The unbreakable CNT before (top) and after deformation (bottom).
320-
321311
Let us impose a constant velocity deformation on the CNT
322312
by combining the ``velocity set`` command with previously defined
323313
``fix setforce``. Add the following lines in the **unbreakable.lmp**
@@ -331,12 +321,23 @@ file, right after the last ``run 5000`` command:
331321
run 10000
332322
333323
The chosen velocity for the deformation is :math:`100\,\text{m/s}`, or
334-
:math:`0.001\,\text{Å/fs}`.
335-
336-
Run the simulation using LAMMPS. As can be seen from the variable :math:`L_\text{cnt}`, the length
324+
:math:`0.001\,\text{Å/fs}`. Run the simulation using LAMMPS. As can be seen
325+
from the variable :math:`L_\text{cnt}`, the length
337326
of the CNT increases linearly over time for :math:`t > 5\,\text{ps}`,
338-
as expected from the imposed constant velocity. What you observe in the :guicmd{Slide Show}
339-
windows should resemble Fig.~\ref{fig:CNT-unbreakable}. The total energy of the system
327+
as expected from the imposed constant velocity. What you observe in the `Slide Show`
328+
windows should resemble the figure below.
329+
330+
.. figure:: figures/colored-edge-def-dark.png
331+
:class: only-dark
332+
:alt: Evolution of the CNT energy
333+
334+
.. figure:: figures/colored-edge-def-light.png
335+
:class: only-light
336+
:alt: Evolution of the CNT energy
337+
338+
The unbreakable CNT before (top) and after deformation (bottom).
339+
340+
The total energy of the system
340341
shows a non-linear increase with :math:`t` once the deformation starts, which is expected
341342
from the typical dependency of bond energy with bond distance,
342343
:math:`U_\text{b} = k_\text{b} \left( r - r_0 \right)^2`.
@@ -351,7 +352,7 @@ from the typical dependency of bond energy with bond distance,
351352

352353
.. container:: figurelegend
353354

354-
a) Evolution of the length :math:`L_\text{cnt}` of the CNT with time.
355+
Figure: a) Evolution of the length :math:`L_\text{cnt}` of the CNT with time.
355356
The CNT starts deforming at :math:`t = 5\,\text{ps}`, and :math:`L_\text{cnt-0}` is the
356357
CNT initial length. b) Evolution of the total energy :math:`E` of the system with time :math:`t`.
357358
Here, the potential is OPLS-AA, and the CNT is unbreakable.
@@ -383,11 +384,21 @@ the **unbreakable.yaml** file can then be used to plot the stress-strain curve.
383384

384385
<a href="../../../../../.dependencies/lammpstutorials-inputs/tutorial2/unbreakable-yaml-reader.py" target="_blank">unbreakable-yaml-reader.py</a>
385386

386-
ADD FIGURE CNT-unbreakable-stress-strain -- Stress applied on the CNT during deformation, :math:`F_\text{cnt}/A_\text{cnt}`,
387-
where :math:`F_\text{cnt}` is the force and :math:`A_\text{cnt}` the CNT surface area,
388-
as a function of the strain, :math:`\Delta L_\text{cnt} = (L_\text{cnt}-L_\text{cnt-0})/L_\text{cnt-0}`,
389-
where :math:`L_\text{cnt}` is the CNT length and :math:`L_\text{cnt-0}` the CNT initial length.
390-
Here, the potential is OPLS-AA, and the CNT is unbreakable.
387+
.. figure:: figures/CNT-unbreakable-stress-strain-dm.png
388+
:class: only-dark
389+
:alt: Evolution of the carbon nanotube stress strain as calculated with LAMMPS
390+
391+
.. figure:: figures/CNT-unbreakable-stress-strain.png
392+
:class: only-light
393+
:alt: Evolution of the carbon nanotube stress strain as calculated with LAMMPS
394+
395+
.. container:: figurelegend
396+
397+
Figure: Stress applied on the CNT during deformation, :math:`F_\text{cnt}/A_\text{cnt}`,
398+
where :math:`F_\text{cnt}` is the force and :math:`A_\text{cnt}` the CNT surface area,
399+
as a function of the strain, :math:`\Delta L_\text{cnt} = (L_\text{cnt}-L_\text{cnt-0})/L_\text{cnt-0}`,
400+
where :math:`L_\text{cnt}` is the CNT length and :math:`L_\text{cnt-0}` the CNT initial length.
401+
Here, the potential is OPLS-AA, and the CNT is unbreakable.
391402

392403
Breakable bonds
393404
===============
@@ -510,8 +521,18 @@ previously. Add the following lines into **breakable.lmp**:
510521
Run the simulation. Some bonds are expected to break before the end of the
511522
simulation.
512523

513-
ADD FIGURE CNT-deformed-breakable -- CNT with broken bonds. This image was generated using
514-
VMD :cite:`vmd_home,humphrey1996vmd` ``DynamicBonds`` representation.
524+
.. figure:: figures/deformed-dark.png
525+
:class: only-dark
526+
:alt: Carbon nanotube deformed using LAMMPS
527+
528+
.. figure:: figures/deformed-light.png
529+
:class: only-light
530+
:alt: Carbon nanotube deformed using LAMMPS
531+
532+
.. container:: figurelegend
533+
534+
Figure: Figure: CNT with broken bonds. This image was generated using
535+
VMD :cite:`vmd_home,humphrey1996vmd` ``DynamicBonds`` representation.
515536

516537
Looking at the evolution of the energy, one can see that the total
517538
energy :math:`E` is initially increasing with the deformation. When bonds
@@ -538,7 +559,7 @@ curve reveals a linear (elastic) regime where
538559

539560
.. container:: figurelegend
540561

541-
a) Evolution of the total energy :math:`E` of the CNT with time :math:`t`. b) Stress applied on the CNT
562+
Figure: Figure: a) Evolution of the total energy :math:`E` of the CNT with time :math:`t`. b) Stress applied on the CNT
542563
during deformation, :math:`F_\text{cnt}/A_\text{cnt}`,
543564
where :math:`F_\text{cnt}` is the force and :math:`A_\text{cnt}` the CNT surface area,
544565
as a function of the strain, :math:`\Delta L_\text{cnt} = (L_\text{cnt}-L_\text{cnt-0}/L_\text{cnt-0})`, where

docs/sphinx/source/tutorial3/tutorial.rst

Lines changed: 59 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,6 @@ The ``fix npt`` allows us to impose both a temperature of :math:`300\,\text{K}`
151151
(with a damping constant of :math:`1000\,\text{fs}`). With the ``iso`` keyword,
152152
the three dimensions of the box will be re-scaled simultaneously.
153153

154-
.. figure:: figures/water-light.png
155-
:alt: Water reservoir from molecular dynamics simulations
156-
:class: only-light
157-
158-
.. figure:: figures/water-dark.png
159-
:alt: Water reservoir from molecular dynamics simulations
160-
:class: only-dark
161-
162-
.. container:: figurelegend
163-
164-
Figure: The water reservoir after equilibration. Oxygen atoms are in red, and
165-
hydrogen atoms are in white.
166-
167154
Let us output the system into images by adding the following commands to **water.lmp**:
168155

169156
.. code-block:: lammps
@@ -212,9 +199,20 @@ adding the following lines into **water.lmp**:
212199
The final state is saved in a binary file named **water.restart**.
213200
Run the input using LAMMPS. The system reaches its equilibrium temperature
214201
after just a few picoseconds, and its equilibrium density after approximately
215-
10 picoseconds (Fig.~\ref{fig:PEG-density}). A snapshot of the equilibrated
216-
system can also be seen in Fig.~\ref{fig:PEG-water}.
202+
10 picoseconds.
217203

204+
.. figure:: figures/water-light.png
205+
:alt: Water reservoir from molecular dynamics simulations
206+
:class: only-light
207+
208+
.. figure:: figures/water-dark.png
209+
:alt: Water reservoir from molecular dynamics simulations
210+
:class: only-dark
211+
212+
.. container:: figurelegend
213+
214+
Figure: The water reservoir after equilibration. Oxygen atoms are in red, and
215+
hydrogen atoms are in white.
218216

219217
.. admonition:: Note
220218
:class: non-title-info
@@ -330,19 +328,6 @@ Let us create images of the systems:
330328
acolor OAlc darkred adiam OAlc 2.6
331329
thermo 500
332330
333-
.. figure:: figures/solvatedPEG_light.png
334-
:alt: PEG in water as simulated with LAMMPS
335-
:class: only-light
336-
337-
.. figure:: figures/solvatedPEG_dark.png
338-
:alt: PEG in water as simulated with LAMMPS
339-
:class: only-dark
340-
341-
.. container:: figurelegend
342-
343-
Figure : The PEG molecule solvated in water. Water is represented as a
344-
transparent field for clarity.
345-
346331
Finally, to perform a short equilibration and save the final state to
347332
a **.restart** file, add the following lines to the input:
348333

@@ -358,7 +343,19 @@ sure that the temperature remains close to the
358343
target value of :math:`300~\text{K}` throughout the entire simulation, and that
359344
the volume and total energy are almost constant, indicating
360345
that the system was in a reasonable configuration from the start.
361-
See a snapshot of the system in Fig.~\ref{fig:PEG-solvated}.
346+
347+
.. figure:: figures/solvatedPEG_light.png
348+
:alt: PEG in water as simulated with LAMMPS
349+
:class: only-light
350+
351+
.. figure:: figures/solvatedPEG_dark.png
352+
:alt: PEG in water as simulated with LAMMPS
353+
:class: only-dark
354+
355+
.. container:: figurelegend
356+
357+
Figure : The PEG molecule solvated in water. Water is represented as a
358+
transparent field for clarity.
362359

363360
Stretching the PEG molecule
364361
===========================
@@ -389,22 +386,10 @@ following lines to **pull.lmp**:
389386
390387
These lines identify the oxygen atoms (type OAlc) at the ends of the PEG
391388
molecule and calculates their center of mass along the :math:`x`-axis. It then
392-
divides these atoms into two groups, ``end1`` (i.e.,~the OAlc atom to
393-
the right of the center) and ``end2`` (i.e.,~the OAlc atom to the right
389+
divides these atoms into two groups, ``end1`` (i.e., the OAlc atom to
390+
the right of the center) and ``end2`` (i.e., the OAlc atom to the right
394391
of the center), for applying force during the stretching process.
395392

396-
.. figure:: figures/pulled_peg_light.png
397-
:alt: PEG in water as simulated with LAMMPS
398-
:class: only-light
399-
400-
.. figure:: figures/pulled_peg_dark.png
401-
:alt: PEG in water as simulated with LAMMPS
402-
:class: only-dark
403-
404-
.. container:: figurelegend
405-
406-
Figure: PEG molecule stretched along the :math:`x` direction in water.
407-
408393
Add the following ``dump`` command to create images of the system:
409394

410395
.. code-block:: lammps
@@ -424,20 +409,6 @@ the following lines to **pull.lmp**:
424409
fix mynvt all nvt temp 300 300 100
425410
fix myrct PEG recenter 0 0 0 shift all
426411
427-
.. figure:: figures/PEG-distance-dm.png
428-
:class: only-dark
429-
:alt: Evolution of the polymer radius of gyration
430-
431-
.. figure:: figures/PEG-distance.png
432-
:class: only-light
433-
:alt: Evolution of the polymer radius of gyration
434-
435-
.. container:: figurelegend
436-
437-
Figure: a) Evolution of the radius of gyration :math:`R_\text{gyr}` of the PEG molecule,
438-
with the force applied starting at :math:`t = 15\,\text{ps}`. b) Histograms of
439-
the dihedral angles of type 1 in the absence (orange) and in the presence (blue) of the applied force.
440-
441412
To investigate the stretching of the PEG molecule, let us compute its radius of
442413
gyration :cite:`fixmanRadiusGyrationPolymer1962a` and the angles of its dihedral
443414
constraints using the following commands:
@@ -481,15 +452,40 @@ Each applied force has a magnitude of :math:`10 \, \text{kcal/mol/Å}`, correspo
481452
This value was chosen to be sufficiently large to overcome both the thermal agitation and
482453
the entropic contributions from the molecules.
483454

455+
.. figure:: figures/pulled_peg_light.png
456+
:alt: PEG in water as simulated with LAMMPS
457+
:class: only-light
458+
459+
.. figure:: figures/pulled_peg_dark.png
460+
:alt: PEG in water as simulated with LAMMPS
461+
:class: only-dark
462+
463+
.. container:: figurelegend
464+
465+
Figure: PEG molecule stretched along the :math:`x` direction in water.
466+
484467
Run the **pull.lmp** file using LAMMPS. From the generated images of the system,
485-
you should observe that the PEG molecule eventually aligns
486-
in the direction of the applied force (as seen in Fig.~\ref{fig:PEG-in-water}).
487-
The evolutions of the radius of gyration over
488-
time indicates that the PEG quickly adjusts to the external force
489-
(Fig.~\ref{fig:PEG-distance}\,a). Additionally, from the values of the dihedral angles
468+
you should observe that the PEG molecule eventually aligns in the direction of
469+
the applied force. The evolutions of the radius of gyration over
470+
time indicates that the PEG quickly adjusts to the external force. Additionally,
471+
from the values of the dihedral angles
490472
printed in the **pull.dat** file, you can create a histogram
491473
of dihedral angles for a specific type. For example, the angle :math:`\phi` for dihedrals
492-
of type 1 (C-C-OE-C) is shown in Fig.~\ref{fig:PEG-distance}\,b.
474+
of type 1 (C-C-OE-C) is shown below.
475+
476+
.. figure:: figures/PEG-distance-dm.png
477+
:class: only-dark
478+
:alt: Evolution of the polymer radius of gyration
479+
480+
.. figure:: figures/PEG-distance.png
481+
:class: only-light
482+
:alt: Evolution of the polymer radius of gyration
483+
484+
.. container:: figurelegend
485+
486+
Figure: a) Evolution of the radius of gyration :math:`R_\text{gyr}` of the PEG molecule,
487+
with the force applied starting at :math:`t = 15\,\text{ps}`. b) Histograms of
488+
the dihedral angles of type 1 in the absence (orange) and in the presence (blue) of the applied force.
493489

494490
Tip: using external visualization tools
495491
---------------------------------------

docs/sphinx/source/tutorial4/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ the two walls. Add the following lines to **equilibrate.lmp**:
399399
400400
The first two variables extract the centers of mass of the two walls. The
401401
``deltaz`` variable is then used to calculate the difference between the two
402-
variables ``walltopz`` and ``wallbotz``, i.e.~the distance between the
402+
variables ``walltopz`` and ``wallbotz``, i.e. the distance between the
403403
two centers of mass of the walls.
404404

405405
Finally, let us run the simulation for 30 ps by adding a ``run`` command

0 commit comments

Comments
 (0)