From 8b71a2f514661d596abc9497488e6e8608a99b4e Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Sun, 8 Sep 2024 09:36:15 +0200 Subject: [PATCH 1/7] Collected all python files that should be used by the build in src/ There were stray files in the root and in a cryptic `developers` folder, now they are all in the same place. --- noxfile.py | 10 +++++----- generate-gallery.py => src/generate-gallery.py | 2 +- {developer => src}/get_examples.py | 0 ipynb-to-gallery.py => src/ipynb-to-gallery.py | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename generate-gallery.py => src/generate-gallery.py (97%) rename {developer => src}/get_examples.py (100%) rename ipynb-to-gallery.py => src/ipynb-to-gallery.py (100%) diff --git a/noxfile.py b/noxfile.py index ca10a1f0..d200d927 100644 --- a/noxfile.py +++ b/noxfile.py @@ -12,7 +12,7 @@ ROOT = os.path.realpath(os.path.dirname(__file__)) sys.path.insert(0, ROOT) -from developer.get_examples import get_examples # noqa: E402 +from src.get_examples import get_examples # noqa: E402 # global nox options @@ -31,11 +31,11 @@ # Files that need to be linted & formatted def get_lint_files(): LINT_FILES = [ - "ipynb-to-gallery.py", - "generate-gallery.py", + "src/ipynb-to-gallery.py", + "src/generate-gallery.py", "noxfile.py", "docs/src/conf.py", - "developer/get_examples.py", + "src/get_examples.py", ] return LINT_FILES + get_example_files() @@ -159,7 +159,7 @@ def example(session, name=name): f"examples/{name}/data", "zip", f"examples/{name}/", "data/" ) - session.run("python", "generate-gallery.py", f"examples/{name}") + session.run("python", "src/generate-gallery.py", f"examples/{name}") os.unlink(f"docs/src/examples/{name}/index.rst") diff --git a/generate-gallery.py b/src/generate-gallery.py similarity index 97% rename from generate-gallery.py rename to src/generate-gallery.py index 850c8e4c..b591f80b 100644 --- a/generate-gallery.py +++ b/src/generate-gallery.py @@ -7,7 +7,7 @@ from chemiscope.sphinx import ChemiscopeScraper -HERE = os.path.realpath(os.path.dirname(__file__)) +HERE = os.path.realpath(os.path.join(os.path.dirname(__file__),'../')) class AttrDict(dict): diff --git a/developer/get_examples.py b/src/get_examples.py similarity index 100% rename from developer/get_examples.py rename to src/get_examples.py diff --git a/ipynb-to-gallery.py b/src/ipynb-to-gallery.py similarity index 100% rename from ipynb-to-gallery.py rename to src/ipynb-to-gallery.py From 47c33b14be3538c4674e26d42e89dae73e66a2a5 Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Sun, 8 Sep 2024 09:37:09 +0200 Subject: [PATCH 2/7] Added (or made more prominent) back-citations to original papers Also link to the plumed masterclass for those in need of a metadynamics recap. --- examples/gaas-map/gaas-map.py | 6 +++++- examples/pi-metad/pi-metad.py | 16 ++++++++++------ examples/roy-gch/roy-gch.py | 14 +++++++++++++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/examples/gaas-map/gaas-map.py b/examples/gaas-map/gaas-map.py index af40440f..af86e86d 100644 --- a/examples/gaas-map/gaas-map.py +++ b/examples/gaas-map/gaas-map.py @@ -1,4 +1,4 @@ -""" +r""" PCA/PCovR Visualization for the rattled GaAs training dataset ============================================================= @@ -12,6 +12,10 @@ description of the dataset, that is then visualized using ``chemiscope``. +This example uses the dataset from +`Imbalzano (2021) `_ +and the principal covariate regression scheme as implemented in +`Helfrecht (2020) `_. """ import os diff --git a/examples/pi-metad/pi-metad.py b/examples/pi-metad/pi-metad.py index 9f54f4d3..1a22591a 100644 --- a/examples/pi-metad/pi-metad.py +++ b/examples/pi-metad/pi-metad.py @@ -49,11 +49,14 @@ # Metadynamics for the Zundel cation # ---------------------------------- # -# Metadynamics is a metnod to accelerate sampling of rare events - microscopic processes +# Metadynamics is a method to accelerate sampling of rare events - microscopic processes # that are too infrequent to be observed over the time scale (ns-µs) accessible to # molecular dynamics simulations. You can read one of the many excellent reviews # on metadynamics (see e.g. -# `Bussi and Branduardi (2015) `_). +# `Bussi and Branduardi (2015) `_), +# or follow a +# `lecture from the PLUMED masterclass +# `_. # In short, during a metadynamics simulation an adaptive biasing potential is # built as a superimposition of Gaussians centered over configurations that have # been previously visited by the trajectory. This discourages the system from remaining @@ -233,6 +236,7 @@ # If you run this in a notebook, you can go ahead and start loading # output files *before* i-PI has finished running by skipping this cell +# wait for simulations to finish if ipi_process is not None: ipi_process.wait() for process in driver_process: @@ -495,8 +499,8 @@ def moving_average(arr, window_size): # is important to distinguish between the free-energy computed # as the logarithm of the probability of observing a given # configuration (that depends on the distribution of the -# replicas) and the free-energy taken as a mean to estimate -# and reaction rates :math:`k` in a transition-state theory +# replicas) and the free-energy taken as a tool to estimate +# reaction rates :math:`k` in a transition-state theory # fashion :math:`k\propto e^{-\Delta E^\ddagger/kT}`, # where the energy barrier :math:`\Delta E^\ddagger` # is better estimated from the distribution of the centroid. @@ -519,7 +523,7 @@ def moving_average(arr, window_size): # # The other changes are purely cosmetic, and the calculation # can be launched very easily, using several drivers to parallelize -# the calculation over the beads (although this kind of calculations +# the energy evaluation over the beads (although this kind of calculations # is not limited by the evaluation of the forces). # don't rerun if the outputs already exist @@ -539,7 +543,7 @@ def moving_average(arr, window_size): # If you run this in a notebook, you can go ahead and start loading # output files _before_ i-PI has finished running by skipping this cell -# don't rerun if the outputs already exist +# wait for simulations to finish if ipi_process is not None: ipi_process.wait() for process in driver_process: diff --git a/examples/roy-gch/roy-gch.py b/examples/roy-gch/roy-gch.py index 94637daf..b3bcb01c 100644 --- a/examples/roy-gch/roy-gch.py +++ b/examples/roy-gch/roy-gch.py @@ -13,6 +13,14 @@ and uses the directional convex hull function from `scikit-matter `__ to make the figure. + +The GCH construction aims at determining structures, among a collection of +candidate configurations, that are stable or have the potential of being stabilized +by appropriate thermodynamic boundary conditions (pressure, doping, external fields, +...). It does so by using microscopic descriptors to determine the diversity of +structures, and assumes that configurations that are stable relative to other +configurations with similar descriptors are those that could be made +"locally" stable by suitable synthesis conditions. """ import chemiscope @@ -45,7 +53,11 @@ # ------------------- # # The Directional Convex Hull routines can be used to compute a -# conventional density-energy hull +# conventional density-energy hull (see +# `Hautier (2014) +# `_ for a pedagogic +# introduction to the convex hull construction in the context +# of atomistic simulations). dch_builder = DirectionalConvexHull(low_dim_idx=[0]) dch_builder.fit(density.reshape(-1, 1), energy) From e9b54c21463655bc03fb2c3c0feef6abe3be239f Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Sun, 8 Sep 2024 21:52:16 +0200 Subject: [PATCH 3/7] Linting --- examples/pi-metad/pi-metad.py | 2 +- examples/roy-gch/roy-gch.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pi-metad/pi-metad.py b/examples/pi-metad/pi-metad.py index 1a22591a..564af493 100644 --- a/examples/pi-metad/pi-metad.py +++ b/examples/pi-metad/pi-metad.py @@ -54,7 +54,7 @@ # molecular dynamics simulations. You can read one of the many excellent reviews # on metadynamics (see e.g. # `Bussi and Branduardi (2015) `_), -# or follow a +# or follow a # `lecture from the PLUMED masterclass # `_. # In short, during a metadynamics simulation an adaptive biasing potential is diff --git a/examples/roy-gch/roy-gch.py b/examples/roy-gch/roy-gch.py index b3bcb01c..bff3121d 100644 --- a/examples/roy-gch/roy-gch.py +++ b/examples/roy-gch/roy-gch.py @@ -53,9 +53,9 @@ # ------------------- # # The Directional Convex Hull routines can be used to compute a -# conventional density-energy hull (see -# `Hautier (2014) -# `_ for a pedagogic +# conventional density-energy hull (see +# `Hautier (2014) +# `_ for a pedagogic # introduction to the convex hull construction in the context # of atomistic simulations). From d9e6ea37caba4382859cc308cd27d66681c471e2 Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Sun, 8 Sep 2024 21:54:18 +0200 Subject: [PATCH 4/7] More linting --- examples/gaas-map/gaas-map.py | 4 ++-- examples/roy-gch/roy-gch.py | 6 +++--- src/generate-gallery.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gaas-map/gaas-map.py b/examples/gaas-map/gaas-map.py index af86e86d..4d6f2e0f 100644 --- a/examples/gaas-map/gaas-map.py +++ b/examples/gaas-map/gaas-map.py @@ -12,10 +12,10 @@ description of the dataset, that is then visualized using ``chemiscope``. -This example uses the dataset from +This example uses the dataset from `Imbalzano (2021) `_ and the principal covariate regression scheme as implemented in -`Helfrecht (2020) `_. +`Helfrecht (2020) `_. """ import os diff --git a/examples/roy-gch/roy-gch.py b/examples/roy-gch/roy-gch.py index bff3121d..fd893561 100644 --- a/examples/roy-gch/roy-gch.py +++ b/examples/roy-gch/roy-gch.py @@ -14,12 +14,12 @@ `scikit-matter `__ to make the figure. -The GCH construction aims at determining structures, among a collection of +The GCH construction aims at determining structures, among a collection of candidate configurations, that are stable or have the potential of being stabilized by appropriate thermodynamic boundary conditions (pressure, doping, external fields, -...). It does so by using microscopic descriptors to determine the diversity of +...). It does so by using microscopic descriptors to determine the diversity of structures, and assumes that configurations that are stable relative to other -configurations with similar descriptors are those that could be made +configurations with similar descriptors are those that could be made "locally" stable by suitable synthesis conditions. """ diff --git a/src/generate-gallery.py b/src/generate-gallery.py index b591f80b..6bd69b0a 100644 --- a/src/generate-gallery.py +++ b/src/generate-gallery.py @@ -7,7 +7,7 @@ from chemiscope.sphinx import ChemiscopeScraper -HERE = os.path.realpath(os.path.join(os.path.dirname(__file__),'../')) +HERE = os.path.realpath(os.path.join(os.path.dirname(__file__), "../")) class AttrDict(dict): From 51944cef1b5e70835f0537c1e4508d0cc96ad31c Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Mon, 9 Sep 2024 21:06:36 +0200 Subject: [PATCH 5/7] s/HERE/ROOT --- src/generate-gallery.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generate-gallery.py b/src/generate-gallery.py index 6bd69b0a..90f07fe4 100644 --- a/src/generate-gallery.py +++ b/src/generate-gallery.py @@ -7,7 +7,7 @@ from chemiscope.sphinx import ChemiscopeScraper -HERE = os.path.realpath(os.path.join(os.path.dirname(__file__), "../")) +ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "../")) class AttrDict(dict): @@ -24,7 +24,7 @@ class PseudoSphinxApp: def __init__(self, example): gallery_dir = os.path.join( - HERE, "docs", "src", "examples", os.path.basename(example) + ROOT, "docs", "src", "examples", os.path.basename(example) ) if os.path.exists(gallery_dir): shutil.rmtree(gallery_dir) @@ -38,7 +38,7 @@ def __init__(self, example): self.config.default_role = "" self.config.sphinx_gallery_conf = { "filename_pattern": ".*", - "examples_dirs": os.path.join(HERE, example), + "examples_dirs": os.path.join(ROOT, example), "gallery_dirs": gallery_dir, "min_reported_time": 60, "copyfile_regex": r".*\.(sh|xyz|cp2k|yml|png|zip)", @@ -48,7 +48,7 @@ def __init__(self, example): } self.builder = AttrDict() - self.builder.srcdir = os.path.join(HERE, "docs", "src") + self.builder.srcdir = os.path.join(ROOT, "docs", "src") self.builder.outdir = "" self.builder.name = os.path.basename(example) From 2c6decb0dc34b2a591c84cd6ccbc2cb048560d29 Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Mon, 9 Sep 2024 21:17:03 +0200 Subject: [PATCH 6/7] Add a downloadable file for the plumed tutorial --- examples/pi-metad/plumed-tutorials.zip | Bin 0 -> 1583 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 examples/pi-metad/plumed-tutorials.zip diff --git a/examples/pi-metad/plumed-tutorials.zip b/examples/pi-metad/plumed-tutorials.zip new file mode 100644 index 0000000000000000000000000000000000000000..b5f4c8bcbd0e46cf80744e49c3470cc14c35830e GIT binary patch literal 1583 zcmZ{kc{tPw7{`ATGmM@w*kQytlA}pXj$B!GT$!es#xc$!awU?hF`1l^BWyW}jAI;8 za$l*?2>1lVL_j#{>zVG|}=R?ACa3TNz;0EIN$ytAS+#i;} z-cEr401BW0LxP^6fg;t@gKQ23IOIcyU2=`bUHk*~10c?3P5}5`^5T_vn~rfCQZkvy zD7rbFCi;mX+{bH?WqNH(OHA2drWXVa__%zCTL#)26%H#)EUK5kWB%Msq5Y=HJ>z8-j#iH^B8l2sixDGIZn@2)MX`lP!yddzAB z(GQNfn3XEjOpWm2-K9h=i1U8AxXoXH>Et5)<7lN2ZJiDmhTE|}Rp15y7~2sMYk@n7 zHOH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`EM3Sp6vXZ|eOh*Ta_kiGgg%|KJ}94~FdB-p39GyHmh>+h0(vu|@y@ literal 0 HcmV?d00001 From 150f91811feb44fc3a45d8d0c76a686864ec8d9e Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Tue, 10 Sep 2024 09:05:20 +0200 Subject: [PATCH 7/7] Updated plumed-tutorials "bindings" --- examples/pi-metad/plumed-tutorials.zip | Bin 1583 -> 1587 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/pi-metad/plumed-tutorials.zip b/examples/pi-metad/plumed-tutorials.zip index b5f4c8bcbd0e46cf80744e49c3470cc14c35830e..8de4f58a4ae5d3883f367c14ec754b29c38f7098 100644 GIT binary patch delta 271 zcmZ3_vzezpz?+#xgn@y9gJFq>R%H14vzn8Eylh4W22KVU23KDvR~Nm?+?>!5P6p;B z@9(F9aA^fM10%~(76t||v9#Zt>#zZj%XiCGeF1CD*q>&bw37m@jV5xveEV8tmXk+# zEXSA1Gd)Zkt{>+bsui=S&fB}Qr%d8l?(*}|UH2}m*>PsV?k2A7#y_f{eKgv6n-F^S4{bTq7agetrpJA2Q_--l-FN)75PheFB`DF4oRx8G9lRvUruvN1H Hz03dr7LRVA delta 267 zcmdnYv!16uz?+#xgn@y9gQ1T}J@V(;>rMSYo);qn11EzFgR8HTtBYP`ZcbV*;M*7VniK~2J3xcYCTge)^ zyu8B5S@GhdGKVVXv8ZT^Mj`!!_teb$Ca+xaVMn-A`Q;Z}x7OTJsfbtL>s-2Nw&!PU zt0ewYQ(ZJm51qfUdcI~?)tv>~njT5>#=pI|W6jn#_FwKAMBEX%&f1l^V5Zp7%GM&j z|K%O;