Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions docs/source/tutorials/cli/geomopt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"source": [
"# import locale\n",
"# locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"# !python3 -m pip install janus-core[all] data-tutorials"
"\n",
"# ! pip uninstall torch torchaudio torchvision numpy -y\n",
"# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system\n",
"# get_ipython().kernel.do_shutdown(restart=True)"
]
},
{
Expand Down Expand Up @@ -84,10 +87,14 @@
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"from ase.build import bulk\n",
"from ase.io import write\n",
"from weas_widget import WeasWidget\n",
"\n",
"Path(\"data\").mkdir(exist_ok=True)\n",
"\n",
"NaCl = bulk(\"NaCl\", \"rocksalt\", a=5.63, cubic=True)\n",
"NaCl[0].position = [1.5, 1.5, 1.5]\n",
"\n",
Expand Down Expand Up @@ -375,7 +382,7 @@
"<div class=\"alert alert-block alert-info\">\n",
"<b>Tip:</b> This is equivalent to:\n",
"\n",
"--struct data/NaCl-deformed.xyz --opt-cell-fully --filter-func ExpCellFilter --minimize-kwargs \"{'filter_kwargs': {'constant_volume' : True} --no-tracker\n",
"--struct data/NaCl-deformed.xyz --opt-cell-fully --filter-func ExpCellFilter --minimize-kwargs \"{'filter_kwargs': {'constant_volume' : True}\" --no-tracker\n",
"</div>\n"
]
},
Expand Down Expand Up @@ -494,33 +501,14 @@
"tracker: False"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%writefile geomopt_config_sevennet.yml\n",
"\n",
"struct: data/NaCl-deformed.xyz\n",
"arch: sevennet\n",
"opt_cell_fully: True\n",
"minimize_kwargs:\n",
" filter_kwargs:\n",
" constant_volume: True\n",
"pressure: 10\n",
"file_prefix: janus_results/NaCl-sevennet\n",
"tracker: False"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"! janus geomopt --config geomopt_config_mace.yml\n",
"! janus geomopt --config geomopt_config_sevennet.yml"
"! janus geomopt --config geomopt_config_mace.yml --arch sevennet --file-prefix janus_results/NaCl-sevennet"
]
},
{
Expand Down
16 changes: 10 additions & 6 deletions docs/source/tutorials/cli/md.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"source": [
"# import locale\n",
"# locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"# !python3 -m pip install janus-core[all] data-tutorials"
"\n",
"# ! pip uninstall torch torchaudio torchvision numpy -y\n",
"# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system\n",
"# get_ipython().kernel.do_shutdown(restart=True)"
]
},
{
Expand Down Expand Up @@ -121,6 +124,8 @@
"traj_every: 10\n",
"restart_every: 50\n",
"\n",
"tracker: False\n",
"\n",
"# If you have an Nvidia GPU.\n",
"#device: cuda"
]
Expand Down Expand Up @@ -373,6 +378,8 @@
" a_kwargs: {'components': ['xy', 'yz', 'zx']}\n",
" points: 250\n",
"\n",
"tracker: False\n",
"\n",
"# If you have an Nvidia GPU.\n",
"#device: cuda"
]
Expand Down Expand Up @@ -491,6 +498,8 @@
"stats_every: 10\n",
"traj_every: 10\n",
"\n",
"tracker: False\n",
"\n",
"# If you have an Nvidia GPU.\n",
"#device: cuda"
]
Expand Down Expand Up @@ -543,11 +552,6 @@
"\n",
"Experimentally NaCl melts at about 1074 Kelvin at atmospheric pressure."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
27 changes: 8 additions & 19 deletions docs/source/tutorials/cli/neb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
"source": [
"# import locale\n",
"# locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"# !python3 -m pip install janus-core[all] data-tutorials"
"\n",
"# ! pip uninstall torch torchaudio torchvision numpy -y\n",
"# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system\n",
"# get_ipython().kernel.do_shutdown(restart=True)"
]
},
{
Expand All @@ -77,7 +80,7 @@
"from data_tutorials.data import get_data\n",
"\n",
"get_data(\n",
" url=\"https://raw.githubusercontent.com/stfc/janus-tutorials/main/data/\",\n",
" url=\"https://raw.githubusercontent.com/stfc/janus-core/main/docs/source/tutorials/data/\",\n",
" filename=[\"ethanol_reactants.extxyz\", \"ethanol_products.extxyz\",\"ethanol_reactants_1water.extxyz\",\"ethanol_products_1water.extxyz\",\"ethanol_reactants_2water.extxyz\",\"ethanol_products_2water.extxyz\"],\n",
" folder=\"data\",\n",
")"
Expand Down Expand Up @@ -131,9 +134,10 @@
"minimize: True\n",
"plot_band: True\n",
"write_band: True\n",
"calc-kwargs:\n",
"calc_kwargs:\n",
" dispersion: True\n",
" model: medium-omat-0"
" model: medium-omat-0\n",
"tracker: False"
]
},
{
Expand Down Expand Up @@ -302,11 +306,6 @@
"w2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -317,16 +316,6 @@
"- analyse the barrier height trend.\n",
"- consider redoing the same exercise with a different potential... remember if you use mace-off dispersion needs to be off.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
29 changes: 13 additions & 16 deletions docs/source/tutorials/cli/phonons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
"source": [
"# import locale\n",
"# locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"# !python3 -m pip install janus-core[all] data-tutorials"
"\n",
"# ! pip uninstall torch torchaudio torchvision numpy -y\n",
"# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system\n",
"# get_ipython().kernel.do_shutdown(restart=True)"
]
},
{
Expand Down Expand Up @@ -153,7 +156,7 @@
"calc-kwargs:\n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand Down Expand Up @@ -243,7 +246,7 @@
" skin: 0 \n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand Down Expand Up @@ -316,7 +319,7 @@
" skin: 0 \n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand Down Expand Up @@ -380,7 +383,7 @@
" skin: 0 \n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand Down Expand Up @@ -419,7 +422,7 @@
"outputs": [],
"source": [
"get_data(\n",
" url=\"https://raw.githubusercontent.com/stfc/janus-tutorials/main/data/\",\n",
" url=\"https://raw.githubusercontent.com/stfc/janus-core/main/docs/source/tutorials/data/\",\n",
" filename=[\"mof-5.cif\",\"paths.yaml\"],\n",
" folder=\"data\",\n",
")"
Expand All @@ -431,7 +434,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"mof5 = read(\"data/mof-5.cif\")\n",
"v=WeasWidget()\n",
"v.from_ase(mof5)\n",
Expand Down Expand Up @@ -471,7 +473,7 @@
" skin: 0 \n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand Down Expand Up @@ -506,7 +508,7 @@
"outputs": [],
"source": [
"from IPython.display import SVG, display\n",
"display(SVG(\"janus_results/mof-5-bs-dos.svg\"))\n"
"display(SVG(\"janus_results/mof-5-bs-dos.svg\"))"
]
},
{
Expand Down Expand Up @@ -542,7 +544,7 @@
" skin: 0 \n",
" model: medium-mpa-0\n",
"device: cpu\n",
"\n"
"tracker: False"
]
},
{
Expand All @@ -569,7 +571,7 @@
"metadata": {},
"outputs": [],
"source": [
"display(SVG(\"janus_results/mof-5-bs-dos.svg\"))\n"
"display(SVG(\"janus_results/mof-5-bs-dos.svg\"))"
]
},
{
Expand All @@ -584,11 +586,6 @@
"\n",
"this is part of this paper if you want to know more: https://arxiv.org/abs/2412.02877"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
49 changes: 41 additions & 8 deletions docs/source/tutorials/cli/singlepoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"source": [
"# import locale\n",
"# locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"# !python3 -m pip install janus-core[all] data-tutorials"
"\n",
"# ! pip uninstall torch torchaudio torchvision numpy -y\n",
"# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system\n",
"# get_ipython().kernel.do_shutdown(restart=True)"
]
},
{
Expand Down Expand Up @@ -214,11 +217,11 @@
"metadata": {},
"outputs": [],
"source": [
"print(f\"Energy: {results.info[\"mace_mp_energy\"]}\")\n",
"print(f\"Energy: {results.info['mace_mp_energy']}\")\n",
"print()\n",
"print(f\"Stress: {results.info[\"mace_mp_stress\"]}\")\n",
"print(f\"Stress: {results.info['mace_mp_stress']}\")\n",
"print()\n",
"print(f\"Forces: {results.arrays[\"mace_mp_forces\"]}\")"
"print(f\"Forces: {results.arrays['mace_mp_forces']}\")"
]
},
{
Expand Down Expand Up @@ -284,6 +287,15 @@
"tracker: False"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"! cat singlepoint_config_1.yml"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -341,7 +353,8 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> In the CLI, arguments are separated by \"-\", while in configuration files, they are specified by \"_\"\n",
"<b>Note:</b> In the CLI, multi-word arguments must be separated by \"-\".\n",
"In configuration files, they are preferably separated by \"_\", although \"-\" should be converted automatically.\n",
"</div>"
]
},
Expand Down Expand Up @@ -619,7 +632,7 @@
"metadata": {},
"outputs": [],
"source": [
"! janus singlepoint --config singlepoint_config_1.yml --calc-kwargs \"{'dispersion': True}\""
"! janus singlepoint --config singlepoint_config_1.yml --calc-kwargs \"{'dispersion': True}\" --out janus_results/NaCl-dispersion-results.extxyz"
]
},
{
Expand All @@ -640,7 +653,24 @@
"struct: data/NaCl.xyz\n",
"tracker: False\n",
"calc_kwargs:\n",
" dispersion: True"
" dispersion: True\n",
"out: janus_results/NaCl-dispersion-results.extxyz"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"! janus singlepoint --config singlepoint_config_4.yml"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Comparing the results before and after the correction:"
]
},
{
Expand All @@ -649,7 +679,10 @@
"metadata": {},
"outputs": [],
"source": [
"! janus singlepoint --config singlepoint_config_4.yml --calc-kwargs \"{'dispersion': True}\""
"dispersion_results = read(\"janus_results/NaCl-dispersion-results.extxyz\")\n",
"\n",
"print(f\"Original results: {results.info['mace_mp_energy']}\")\n",
"print(f\"Results with dispersion correction: {dispersion_results.info['mace_mp_energy']}\")"
]
}
],
Expand Down
Loading