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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Atomistic simulation hands on tutorial on [Matlantis](https://matlantis.com/)

Please refer the document page:

- https://docs.matlantis.com/atomistic-simulation-tutorial/ja/index.html

Currently, only Japanese version is available.
- English: https://docs.matlantis.com/atomistic-simulation-tutorial/en/index.html
- Japanese: https://docs.matlantis.com/atomistic-simulation-tutorial/ja/index.html

## LICENSE
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
99 changes: 99 additions & 0 deletions docs/_static/css/cookie-consent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.cookie-consent-root.svelte-8pd0rh.svelte-8pd0rh {
font-size: 13px;
line-height: 1.5;
}

.cookie-consent-root.svelte-8pd0rh a {
color: rgb(13, 49, 143);
text-decoration: none;
}

.cookie-consent-root.svelte-8pd0rh a:hover {
text-decoration: underline;
}

.cookie-consent-root.svelte-8pd0rh h1 {
font-size: 150%;
}

.cookie-consent-root.svelte-8pd0rh p {
margin: 1em 0;
}

.cookie-consent-popup.svelte-8pd0rh.svelte-8pd0rh, .cookie-consent-settings-popup.svelte-8pd0rh.svelte-8pd0rh {
position: fixed;
z-index: 100000000;
padding: 0.5em 1.5em;
color: #333;
background-color: white;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cookie-consent-popup.svelte-8pd0rh.svelte-8pd0rh {
right: 0;
bottom: 0;
left: 0;
}

.cookie-consent-settings-popup.svelte-8pd0rh.svelte-8pd0rh {
top: 0;
bottom: 0;
left: 0;
max-width: 575px;
overflow: auto;
}

.cookie-consent-actions.svelte-8pd0rh button, .cookie-consent-settings-actions.svelte-8pd0rh button, .cookie-consent-settings-choices-actions.svelte-8pd0rh button {
display: inline-block;
margin: 0;
font-family: inherit;
font-size: 100%;
line-height: inherit;
cursor: pointer;
outline: none;
appearance: none;
padding: 0.25em 0.5em;
color: #fff;
background-color: rgb(13, 49, 143);
border: 2px solid transparent;
}

.cookie-consent-actions.svelte-8pd0rh button:hover, .cookie-consent-settings-actions.svelte-8pd0rh button:hover, .cookie-consent-settings-choices-actions.svelte-8pd0rh button:hover {
background-color: rgba(13, 49, 143, 0.8);
}

.cookie-consent-actions.svelte-8pd0rh.svelte-8pd0rh {
text-align: right;
}

.cookie-consent-actions.svelte-8pd0rh .cookie-consent-settings-button.svelte-8pd0rh {
color: rgb(13, 49, 143);
background-color: #fff;
border-color: rgb(13, 49, 143);
}

.cookie-consent-actions.svelte-8pd0rh .cookie-consent-settings-button.svelte-8pd0rh:hover {
color: #fff;
background-color: rgba(13, 49, 143, 0.8);
border-color: transparent;
}

.cookie-consent-close.svelte-8pd0rh.svelte-8pd0rh, .cookie-consent-settings-close.svelte-8pd0rh.svelte-8pd0rh {
display: inline-block;
margin: 0;
font-family: inherit;
font-size: 100%;
line-height: inherit;
cursor: pointer;
outline: none;
appearance: none;
display: inline;
padding: 0;
color: inherit;
text-align: start;
background-color: transparent;
border: 0 none;
float: right;
padding: 0.5em;
font-size: 150%;
}
1 change: 1 addition & 0 deletions docs/_static/js/cookie-consent-init.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/_static/js/cookie-consent.umd.js

Large diffs are not rendered by default.

31 changes: 19 additions & 12 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
{% extends "!layout.html" %}

{% block extrahead %}
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W7Q4ZJV');</script>
<!-- End Google Tag Manager -->
{% block htmltitle %}
{{ super() }}
<!-- Workaround: need to import cookie-consent library before importing require.js -->
<script src="_static/js/cookie-consent.umd.js"></script>
<script src="_static/js/cookie-consent-init.umd.js"></script>
{% endblock %}

{% block relbar1 %}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W7Q4ZJV"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<script>
const cc = cookieConsentInit(cookieConsent)({
onChange(result) {
console.log(result);
},
gtmid: 'GTM-W7Q4ZJV',
consentCookieOptions: {
domain: "matlantis.com"
}
});

function showSettings() {
cc.$set({ settingsShown: true });
}
</script>
{{ super()}}
{% endblock %}
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@

html_css_files = [
'css/custom.css',
'css/cookie-consent.css',
]

# Avoid to plotly error
Expand Down
118 changes: 118 additions & 0 deletions docs/misc/split_notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import argparse
import os
import pathlib
import shutil
from typing import Union

import nbformat
from nbformat.notebooknode import NotebookNode
from distutils.util import strtobool

parser = argparse.ArgumentParser()
parser.add_argument("--tutorials-dir", default="tutorials")
parser.add_argument("--tutorials-bilingual-dir", default="tutorials/bilingual")
parser.add_argument("--remove-bilingual-dir", type=strtobool, default="false")
args = parser.parse_args()


def split_notebook(
notebook: Union[str, pathlib.Path],
jp_notebook: Union[str, pathlib.Path],
en_notebook: Union[str, pathlib.Path],
strict: bool = True,
) -> None:
# When `strict=True`, all cell must be annotated by [JP], [EN] or [ALL].
with open(notebook, "r") as f:
text = f.read().replace("\n", "")
notebook = nbformat.reads(text, as_version=4)

JP_cell = []
EN_cell = []

for i, cell in enumerate(notebook.cells):
if cell["cell_type"] == "markdown":
if cell["source"][:5] == "[EN]\n":
cell["source"] = cell["source"][5:]
if cell["source"].startswith("\n"):
cell["source"] = cell["source"][1:]
EN_cell.append(cell)
elif cell["source"][:5] == "[JP]\n":
cell["source"] = cell["source"][5:]
if cell["source"].startswith("\n"):
cell["source"] = cell["source"][1:]
JP_cell.append(cell)
elif cell["source"][:6] == "[ALL]\n":
cell["source"] = cell["source"][6:]
if cell["source"].startswith("\n"):
cell["source"] = cell["source"][1:]
JP_cell.append(cell)
EN_cell.append(cell)
else:
if strict:
raise RuntimeError(f"INFO : cannot find language annotation for cell {i}")
else:
print(f"INFO : cannot find language annotation for cell {i}, considered as both JP & EN")
JP_cell.append(cell)
EN_cell.append(cell)
else:
JP_cell.append(cell)
EN_cell.append(cell)

if len(JP_cell) != len(EN_cell):
if strict:
raise RuntimeError(f"The number of cell is different! JP {len(JP_cell)} != EN {len(EN_cell)}.")
else:
print(f"WARNING: the number of cell is different! JP {len(JP_cell)} != EN {len(EN_cell)}.")

with open(en_notebook, mode="wt") as f:
EN_nb = NotebookNode(
{
"cells": EN_cell,
"metadata": notebook["metadata"],
"nbformat": notebook["nbformat"],
"nbformat_minor": notebook["nbformat_minor"],
}
)
nbformat.write(EN_nb, f)

with open(jp_notebook, mode="wt") as f:
JP_nb = NotebookNode(
{
"cells": JP_cell,
"metadata": notebook["metadata"],
"nbformat": notebook["nbformat"],
"nbformat_minor": notebook["nbformat_minor"],
}
)
nbformat.write(JP_nb, f)


project_root_dir = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent
tutorials = project_root_dir / args.tutorials_dir
tutorials_bilingual = project_root_dir / args.tutorials_bilingual_dir
print(f"project_root_dir : {project_root_dir}")
print(f"tutorials : {tutorials}")
print(f"tutorials_bilingual: {tutorials_bilingual}")
file_names = sorted([f.name.replace("".join(f.suffixes), "") for f in tutorials_bilingual.glob("*.ipynb")])
print(f"file_names: {file_names}")
tutorials_jp = tutorials / "ja"
tutorials_en = tutorials / "en"

tutorials.mkdir(exist_ok=True, parents=True)
tutorials_jp.mkdir(exist_ok=True, parents=True)
tutorials_en.mkdir(exist_ok=True, parents=True)

for f in file_names:
print(f)
split_notebook(
notebook=tutorials_bilingual / f"{f}.ipynb",
jp_notebook=tutorials_jp / f"{f}.ipynb",
en_notebook=tutorials_en / f"{f}.ipynb",
)

# Copy `output` directory
shutil.copytree(tutorials_bilingual / "output", tutorials_jp / "output")
shutil.copytree(tutorials_bilingual / "output", tutorials_en / "output")

if args.remove_bilingual_dir:
shutil.rmtree(tutorials_bilingual)
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_1_welcome.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_1_welcome.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_2_atomistic_simulation_intro.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_2_atomistic_simulation_intro.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_3_ase_basic.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_3_ase_basic.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_4_ase_structure.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_4_ase_structure.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_5_ase_calculator.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_5_ase_calculator.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_6_ase_playground.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_6_ase_playground.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_7_ase_playground2.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_7_ase_playground2.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/1_8_diatomic_potential.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/1_8_diatomic_potential.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/2_1_opt.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/2_1_opt.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/2_2_opt_symmetry.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/2_2_opt_symmetry.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/2_3_opt-algorithm.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/2_3_opt-algorithm.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/3_1_bulk_energy.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/3_1_bulk_energy.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/3_2_slab_energy.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/3_2_slab_energy.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
7 changes: 7 additions & 0 deletions docs/tutorials/en/3_3_slab_adsorption_energy.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"path": "../../../tutorials/en/3_3_slab_adsorption_energy.ipynb",
"extra-media": [
"../../../tutorials/assets",
"../../../tutorials/en/output"
]
}
Loading