Skip to content

Commit 1edebe0

Browse files
committed
updated tutorial 1
1 parent 7d9b560 commit 1edebe0

13 files changed

Lines changed: 302 additions & 21 deletions

.dependencies/pyplot-perso

Submodule pyplot-perso added at 0cedb1c

.gitmodules

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[submodule ".dependencies/gromacstutorials-inputs"]
22
path = .dependencies/gromacstutorials-inputs
33
url = git@github.com:gromacstutorials/gromacstutorials-inputs.git
4+
branch = main
5+
[submodule ".dependencies/pyplot-perso"]
6+
path = .dependencies/pyplot-perso
7+
url = git@github.com:simongravelle/pyplot-perso.git
8+
branch = LAMMPS-livecom

docs/sphinx/compile.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import subprocess
2+
import re
3+
4+
# Define ANSI escape codes for colors
5+
RED = '\033[91m'
6+
GREEN = '\033[92m'
7+
GRAY = '\033[90m'
8+
RESET = '\033[0m'
9+
10+
def filter_make_output():
11+
12+
# Define multiple patterns to ignore
13+
ignore_patterns = [
14+
"Pygments lexer name 'bw' is not known",
15+
"Pygments lexer name 'lammps' is not known",
16+
".. label:: start_",
17+
".. label:: end_",
18+
"Unknown directive type"
19+
]
20+
21+
# Define a pattern to identify warnings (example pattern, adjust as needed)
22+
warning_pattern = re.compile('|'.join(re.escape(p) for p in ["WARNING:", "ERROR:"]))
23+
24+
# Combine ignore patterns into a single regex pattern
25+
ignore_pattern = re.compile('|'.join(re.escape(p) for p in ignore_patterns))
26+
27+
# Run 'make clean'
28+
subprocess.run(['make', 'clean'], check=True)
29+
30+
# Run 'make html' and capture output
31+
process = subprocess.Popen(['make', 'html'],
32+
stdout=subprocess.PIPE,
33+
stderr=subprocess.STDOUT, text=True)
34+
35+
# Read and filter output
36+
output_lines = []
37+
for line in process.stdout:
38+
if len(line) > 1:
39+
if not ignore_pattern.search(line):
40+
# Determine the color based on whether the line matches the warning pattern
41+
if warning_pattern.search(line):
42+
output_lines.append(RED + line + RESET)
43+
else:
44+
output_lines.append(GRAY + line + RESET)
45+
46+
# Wait for the process to complete
47+
process.wait()
48+
49+
# Print the filtered output
50+
print(''.join(output_lines), end='')
51+
52+
if __name__ == "__main__":
53+
filter_make_output()

docs/sphinx/source/tutorials/tutorial1/bulk-solution.rst

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Bulk salt solution
77

88
The very basics of GROMACS through a simple example
99

10-
.. figure:: ../figures/level1/bulk-solution/video-solution-white.webp
10+
.. figure:: figures/video-solution-white.webp
1111
:alt: Water solution of SO\ :sub:`4`\ :sup:`2-` and Na\ :sup:`+` ions visualized with VMD
1212
:class: only-light
1313
:height: 250
1414
:align: right
1515

16-
.. figure:: ../figures/level1/bulk-solution/video-solution-dark.webp
16+
.. figure:: figures/video-solution-dark.webp
1717
:alt: Water solution of SO\ :sub:`4`\ :sup:`2-` and Na\ :sup:`+` ions visualized with VMD
1818
:class: only-dark
1919
:height: 250
@@ -79,7 +79,7 @@ into it:
7979

8080
The first line, *Cubic box*, is a comment, the second line is the
8181
total number of atoms (0), and the last line is the box dimension in nanometer,
82-
here 3.5 nm by 3.5 nm by 3.5 nm. This **.gro** file is written in |Gromos87 format.
82+
here 3.5 nm by 3.5 nm by 3.5 nm. This **.gro** file is written in Gromos87 format.
8383

8484
.. |Gromos87| raw:: html
8585

@@ -496,12 +496,12 @@ minimization step using VMD by typing in the terminal:
496496
497497
vmd conf.gro min.trr
498498
499-
.. figure:: ../figures/level1/bulk-solution/solution-light.webp
499+
.. figure:: figures/solution-light.webp
500500
:alt: Gromacs tutorial : Movie showing the motion of the atoms during the energy minimization.
501501
:class: only-light
502502
:height: 330
503503

504-
.. figure:: ../figures/level1/bulk-solution/solution-dark.webp
504+
.. figure:: figures/solution-dark.webp
505505
:alt: Gromacs tutorial : Movie showing the motion of the atoms during the energy minimization.
506506
:class: only-dark
507507
:height: 330
@@ -548,11 +548,11 @@ can be oppened with the Grace software (or equivalent) :cite:`grace`:
548548
549549
xmgrace min-pe.xvg
550550
551-
.. figure:: ../figures/level1/bulk-solution/potential-energy-min-light.png
551+
.. figure:: figures/potential-energy-min-light.png
552552
:alt: Gromacs tutorial : plot of the energy versus time.
553553
:class: only-light
554554

555-
.. figure:: ../figures/level1/bulk-solution/potential-energy-min-dark.png
555+
.. figure:: figures/potential-energy-min-dark.png
556556
:alt: Gromacs tutorial : plot of the energy versus time.
557557
:class: only-dark
558558

@@ -720,16 +720,14 @@ thermostat that is removing the extra energy from the system,
720720
the temperature reaches the requested temperature of
721721
:math:`360~\text{K}` after a duration of a few picoseconds.
722722

723-
..
724-
725723
In general, it is better to perform a longer equilibration, but simulation
726724
durations are kept as short as possible for these tutorials.
727725

728-
.. figure:: ../figures/level1/bulk-solution/temperature-nvt-light.png
726+
.. figure:: figures/temperature-nvt-light.png
729727
:alt: Gromacs tutorial : temperature versus time.
730728
:class: only-light
731729

732-
.. figure:: ../figures/level1/bulk-solution/temperature-nvt-dark.png
730+
.. figure:: figures/temperature-nvt-dark.png
733731
:alt: Gromacs tutorial : temperature versus time.
734732
:class: only-dark
735733

@@ -821,11 +819,11 @@ command 3 consecutive times:
821819
Choose respectively ``temperature`` (10), ``pressure`` (11) and
822820
``density`` (16).
823821

824-
.. figure:: ../figures/level1/bulk-solution/temperature-npt-light.png
822+
.. figure:: figures/temperature-npt-light.png
825823
:alt: Gromacs tutorial : NPT equilibration
826824
:class: only-light
827825

828-
.. figure:: ../figures/level1/bulk-solution/temperature-npt-dark.png
826+
.. figure:: figures/temperature-npt-dark.png
829827
:alt: Gromacs tutorial : NPT equilibration
830828
:class: only-dark
831829

@@ -938,6 +936,20 @@ and then by typing 2 and 4.
938936

939937
The results show...
940938

939+
.. figure:: figures/rdf-plain.png
940+
:alt: Gromacs tutorial RDF radial distribution function
941+
:class: only-light
942+
943+
.. figure:: figures/rdf-plain-dm.png
944+
:alt: Gromacs tutorial RDF radial distribution function
945+
:class: only-dark
946+
947+
.. container:: figurelegend
948+
949+
Figure: Radial distribution functions (RDF) as calculated between sodium
950+
and water (:math:`\text{Na}^+ - \text{H}_2\text{O}`), between sulfate and
951+
water (:math:`\text{SO}_4^{2-} - \text{H}_2\text{O}`).
952+
941953
The main issue with the calculated rdf, is that it includes all the atoms from
942954
thr :math:`\text{H}_2\text{O}` molecules (including the hydrogen atoms) and all
943955
the atoms from the :math:`\text{SO}_4^{2-}`, leading to more peaks and dephts
@@ -993,19 +1005,20 @@ and select 3 and 7.
9931005
9941006
and select 8 and 7.
9951007

996-
997-
.. figure:: ../figures/level1/bulk-solution/rdf-production-light.png
1008+
.. figure:: figures/rdf-filtered.png
9981009
:alt: Gromacs tutorial RDF radial distribution function
9991010
:class: only-light
10001011

1001-
.. figure:: ../figures/level1/bulk-solution/rdf-production-dark.png
1012+
.. figure:: figures/rdf-filtered-dm.png
10021013
:alt: Gromacs tutorial RDF radial distribution function
10031014
:class: only-dark
10041015

10051016
.. container:: figurelegend
10061017

10071018
Figure: Radial distribution functions (RDF) as calculated between sodium
1008-
and water, between sulfate and water, and finally between water and water.
1019+
and water oxygens (:math:`\text{Na}^+ - \text{OW1}`), between sulfur and
1020+
water oxygens (:math:`\text{S1} - \text{OW1}`), and in between water oxygens
1021+
(:math:`\text{OW1} - \text{OW1}`),.
10091022

10101023
The radial distribution functions highlight the typical distance between
10111024
the different species of the fluid. For instance, it can be seen that
@@ -1014,9 +1027,6 @@ distance of :math:`2.4 ~ \text{Å}` from the center of the sodium ion.
10141027

10151028
.. include:: ../../non-tutorials/accessfile.rst
10161029

1017-
1018-
1019-
10201030
..
10211031
Mean square displacement
10221032
========================
140 KB
Loading

docs/sphinx/source/tutorials/tutorial1/figures/rdf-filtered.ipynb

Lines changed: 108 additions & 0 deletions
Large diffs are not rendered by default.
140 KB
Loading
135 KB
Loading

docs/sphinx/source/tutorials/tutorial1/figures/rdf-plain.ipynb

Lines changed: 104 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)