Skip to content

Commit

Permalink
Enable reproducibility
Browse files Browse the repository at this point in the history
  • Loading branch information
arm61 committed Nov 5, 2023
1 parent e2dcee6 commit 54734c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 5 additions & 4 deletions docs/source/vasp_d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"import numpy as np\n",
"from kinisi.analyze import DiffusionAnalyzer\n",
"from pymatgen.io.vasp import Xdatcar\n",
"np.random.seed(42)"
"np.random.seed(42)\n",
"rng = np.random.RandomState(42)"
]
},
{
Expand Down Expand Up @@ -65,7 +66,7 @@
"outputs": [],
"source": [
"xd = Xdatcar('./example_XDATCAR.gz')\n",
"diff = DiffusionAnalyzer.from_Xdatcar(xd, parser_params=p_params, uncertainty_params=b_params)"
"diff = DiffusionAnalyzer.from_Xdatcar(xd, parser_params=p_params, uncertainty_params=u_params)"
]
},
{
Expand Down Expand Up @@ -126,7 +127,7 @@
"metadata": {},
"source": [
"It appears that the non-Gaussian parameter does okay at predicting the of the diffusive regime for this example (it is slightly underestimated), therefore we will set the start of the diffusive regime as the `ngp_max` object. \n",
"If the non-Gaussian parameter gave an incorrect value, the start of the diffusive regim could be set to, say, 4 ps using the keyword argument of `start_dt=4`. \n",
"If the non-Gaussian parameter gave an incorrect value, the start of the diffusive regime could be set to, say, 4 ps using the keyword argument of `start_dt=4`. \n",
"We can then run the diffusion analysis as follows. "
]
},
Expand All @@ -136,7 +137,7 @@
"metadata": {},
"outputs": [],
"source": [
"diff.diffusion(0.4)"
"diff.diffusion(0.4, diffusion_params={'random_state': rng})"
]
},
{
Expand Down
9 changes: 4 additions & 5 deletions docs/source/vasp_dj.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"import numpy as np\n",
"from kinisi.analyze import JumpDiffusionAnalyzer\n",
"from pymatgen.io.vasp import Xdatcar\n",
"np.random.seed(42)"
"np.random.seed(42)\n",
"rng = np.random.RandomState(42)"
]
},
{
Expand Down Expand Up @@ -150,7 +151,7 @@
},
"outputs": [],
"source": [
"diff.jump_diffusion(5)"
"diff.jump_diffusion(5, jump_diffusion_params={'random_state': rng})"
]
},
{
Expand All @@ -166,9 +167,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"metadata": {},
"outputs": [],
"source": [
"diff.D_J.n, diff.D_J.con_int()"
Expand Down

0 comments on commit 54734c6

Please sign in to comment.