Skip to content

Commit 16b2fac

Browse files
authored
Merge pull request #2 from matlantis-pfcc/v1.2.0
v1.2.0
2 parents 617a986 + ff2ed0e commit 16b2fac

File tree

113 files changed

+210747
-64767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+210747
-64767
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ Atomistic simulation hands on tutorial on [Matlantis](https://matlantis.com/)
66

77
Please refer the document page:
88

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

1312
## LICENSE
1413
<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>.

docs/_static/css/cookie-consent.css

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
.cookie-consent-root.svelte-8pd0rh.svelte-8pd0rh {
2+
font-size: 13px;
3+
line-height: 1.5;
4+
}
5+
6+
.cookie-consent-root.svelte-8pd0rh a {
7+
color: rgb(13, 49, 143);
8+
text-decoration: none;
9+
}
10+
11+
.cookie-consent-root.svelte-8pd0rh a:hover {
12+
text-decoration: underline;
13+
}
14+
15+
.cookie-consent-root.svelte-8pd0rh h1 {
16+
font-size: 150%;
17+
}
18+
19+
.cookie-consent-root.svelte-8pd0rh p {
20+
margin: 1em 0;
21+
}
22+
23+
.cookie-consent-popup.svelte-8pd0rh.svelte-8pd0rh, .cookie-consent-settings-popup.svelte-8pd0rh.svelte-8pd0rh {
24+
position: fixed;
25+
z-index: 100000000;
26+
padding: 0.5em 1.5em;
27+
color: #333;
28+
background-color: white;
29+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
30+
}
31+
32+
.cookie-consent-popup.svelte-8pd0rh.svelte-8pd0rh {
33+
right: 0;
34+
bottom: 0;
35+
left: 0;
36+
}
37+
38+
.cookie-consent-settings-popup.svelte-8pd0rh.svelte-8pd0rh {
39+
top: 0;
40+
bottom: 0;
41+
left: 0;
42+
max-width: 575px;
43+
overflow: auto;
44+
}
45+
46+
.cookie-consent-actions.svelte-8pd0rh button, .cookie-consent-settings-actions.svelte-8pd0rh button, .cookie-consent-settings-choices-actions.svelte-8pd0rh button {
47+
display: inline-block;
48+
margin: 0;
49+
font-family: inherit;
50+
font-size: 100%;
51+
line-height: inherit;
52+
cursor: pointer;
53+
outline: none;
54+
appearance: none;
55+
padding: 0.25em 0.5em;
56+
color: #fff;
57+
background-color: rgb(13, 49, 143);
58+
border: 2px solid transparent;
59+
}
60+
61+
.cookie-consent-actions.svelte-8pd0rh button:hover, .cookie-consent-settings-actions.svelte-8pd0rh button:hover, .cookie-consent-settings-choices-actions.svelte-8pd0rh button:hover {
62+
background-color: rgba(13, 49, 143, 0.8);
63+
}
64+
65+
.cookie-consent-actions.svelte-8pd0rh.svelte-8pd0rh {
66+
text-align: right;
67+
}
68+
69+
.cookie-consent-actions.svelte-8pd0rh .cookie-consent-settings-button.svelte-8pd0rh {
70+
color: rgb(13, 49, 143);
71+
background-color: #fff;
72+
border-color: rgb(13, 49, 143);
73+
}
74+
75+
.cookie-consent-actions.svelte-8pd0rh .cookie-consent-settings-button.svelte-8pd0rh:hover {
76+
color: #fff;
77+
background-color: rgba(13, 49, 143, 0.8);
78+
border-color: transparent;
79+
}
80+
81+
.cookie-consent-close.svelte-8pd0rh.svelte-8pd0rh, .cookie-consent-settings-close.svelte-8pd0rh.svelte-8pd0rh {
82+
display: inline-block;
83+
margin: 0;
84+
font-family: inherit;
85+
font-size: 100%;
86+
line-height: inherit;
87+
cursor: pointer;
88+
outline: none;
89+
appearance: none;
90+
display: inline;
91+
padding: 0;
92+
color: inherit;
93+
text-align: start;
94+
background-color: transparent;
95+
border: 0 none;
96+
float: right;
97+
padding: 0.5em;
98+
font-size: 150%;
99+
}

docs/_static/js/cookie-consent-init.umd.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/_static/js/cookie-consent.umd.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/_templates/layout.html

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
{% extends "!layout.html" %}
22

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

1410
{% block relbar1 %}
15-
<!-- Google Tag Manager (noscript) -->
16-
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W7Q4ZJV"
17-
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
18-
<!-- End Google Tag Manager (noscript) -->
11+
<script>
12+
const cc = cookieConsentInit(cookieConsent)({
13+
onChange(result) {
14+
console.log(result);
15+
},
16+
gtmid: 'GTM-W7Q4ZJV',
17+
consentCookieOptions: {
18+
domain: "matlantis.com"
19+
}
20+
});
21+
22+
function showSettings() {
23+
cc.$set({ settingsShown: true });
24+
}
25+
</script>
1926
{{ super()}}
2027
{% endblock %}

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103

104104
html_css_files = [
105105
'css/custom.css',
106+
'css/cookie-consent.css',
106107
]
107108

108109
# Avoid to plotly error

docs/misc/split_notebook.py

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import argparse
2+
import os
3+
import pathlib
4+
import shutil
5+
from typing import Union
6+
7+
import nbformat
8+
from nbformat.notebooknode import NotebookNode
9+
from distutils.util import strtobool
10+
11+
parser = argparse.ArgumentParser()
12+
parser.add_argument("--tutorials-dir", default="tutorials")
13+
parser.add_argument("--tutorials-bilingual-dir", default="tutorials/bilingual")
14+
parser.add_argument("--remove-bilingual-dir", type=strtobool, default="false")
15+
args = parser.parse_args()
16+
17+
18+
def split_notebook(
19+
notebook: Union[str, pathlib.Path],
20+
jp_notebook: Union[str, pathlib.Path],
21+
en_notebook: Union[str, pathlib.Path],
22+
strict: bool = True,
23+
) -> None:
24+
# When `strict=True`, all cell must be annotated by [JP], [EN] or [ALL].
25+
with open(notebook, "r") as f:
26+
text = f.read().replace("\n", "")
27+
notebook = nbformat.reads(text, as_version=4)
28+
29+
JP_cell = []
30+
EN_cell = []
31+
32+
for i, cell in enumerate(notebook.cells):
33+
if cell["cell_type"] == "markdown":
34+
if cell["source"][:5] == "[EN]\n":
35+
cell["source"] = cell["source"][5:]
36+
if cell["source"].startswith("\n"):
37+
cell["source"] = cell["source"][1:]
38+
EN_cell.append(cell)
39+
elif cell["source"][:5] == "[JP]\n":
40+
cell["source"] = cell["source"][5:]
41+
if cell["source"].startswith("\n"):
42+
cell["source"] = cell["source"][1:]
43+
JP_cell.append(cell)
44+
elif cell["source"][:6] == "[ALL]\n":
45+
cell["source"] = cell["source"][6:]
46+
if cell["source"].startswith("\n"):
47+
cell["source"] = cell["source"][1:]
48+
JP_cell.append(cell)
49+
EN_cell.append(cell)
50+
else:
51+
if strict:
52+
raise RuntimeError(f"INFO : cannot find language annotation for cell {i}")
53+
else:
54+
print(f"INFO : cannot find language annotation for cell {i}, considered as both JP & EN")
55+
JP_cell.append(cell)
56+
EN_cell.append(cell)
57+
else:
58+
JP_cell.append(cell)
59+
EN_cell.append(cell)
60+
61+
if len(JP_cell) != len(EN_cell):
62+
if strict:
63+
raise RuntimeError(f"The number of cell is different! JP {len(JP_cell)} != EN {len(EN_cell)}.")
64+
else:
65+
print(f"WARNING: the number of cell is different! JP {len(JP_cell)} != EN {len(EN_cell)}.")
66+
67+
with open(en_notebook, mode="wt") as f:
68+
EN_nb = NotebookNode(
69+
{
70+
"cells": EN_cell,
71+
"metadata": notebook["metadata"],
72+
"nbformat": notebook["nbformat"],
73+
"nbformat_minor": notebook["nbformat_minor"],
74+
}
75+
)
76+
nbformat.write(EN_nb, f)
77+
78+
with open(jp_notebook, mode="wt") as f:
79+
JP_nb = NotebookNode(
80+
{
81+
"cells": JP_cell,
82+
"metadata": notebook["metadata"],
83+
"nbformat": notebook["nbformat"],
84+
"nbformat_minor": notebook["nbformat_minor"],
85+
}
86+
)
87+
nbformat.write(JP_nb, f)
88+
89+
90+
project_root_dir = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent
91+
tutorials = project_root_dir / args.tutorials_dir
92+
tutorials_bilingual = project_root_dir / args.tutorials_bilingual_dir
93+
print(f"project_root_dir : {project_root_dir}")
94+
print(f"tutorials : {tutorials}")
95+
print(f"tutorials_bilingual: {tutorials_bilingual}")
96+
file_names = sorted([f.name.replace("".join(f.suffixes), "") for f in tutorials_bilingual.glob("*.ipynb")])
97+
print(f"file_names: {file_names}")
98+
tutorials_jp = tutorials / "ja"
99+
tutorials_en = tutorials / "en"
100+
101+
tutorials.mkdir(exist_ok=True, parents=True)
102+
tutorials_jp.mkdir(exist_ok=True, parents=True)
103+
tutorials_en.mkdir(exist_ok=True, parents=True)
104+
105+
for f in file_names:
106+
print(f)
107+
split_notebook(
108+
notebook=tutorials_bilingual / f"{f}.ipynb",
109+
jp_notebook=tutorials_jp / f"{f}.ipynb",
110+
en_notebook=tutorials_en / f"{f}.ipynb",
111+
)
112+
113+
# Copy `output` directory
114+
shutil.copytree(tutorials_bilingual / "output", tutorials_jp / "output")
115+
shutil.copytree(tutorials_bilingual / "output", tutorials_en / "output")
116+
117+
if args.remove_bilingual_dir:
118+
shutil.rmtree(tutorials_bilingual)

docs/tutorials/en/1_1_welcome.nblink

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_1_welcome.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_2_atomistic_simulation_intro.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_3_ase_basic.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_4_ase_structure.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_5_ase_calculator.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_6_ase_playground.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_7_ase_playground2.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/1_8_diatomic_potential.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}

docs/tutorials/en/2_1_opt.nblink

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/2_1_opt.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/2_2_opt_symmetry.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/2_3_opt-algorithm.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/3_1_bulk_energy.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/3_2_slab_energy.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "../../../tutorials/en/3_3_slab_adsorption_energy.ipynb",
3+
"extra-media": [
4+
"../../../tutorials/assets",
5+
"../../../tutorials/en/output"
6+
]
7+
}

0 commit comments

Comments
 (0)