Skip to content

Commit

Permalink
Remove translation and rotational modes, sample w/ replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
WardLT committed Dec 4, 2023
1 parent ba9766e commit 34e5e1d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,27 @@
"evalues, emodes = np.linalg.eigh(vib_data.get_hessian_2d())"
]
},
{
"cell_type": "markdown",
"id": "31bada31-2ea3-47b0-80d4-5bc98a4115ae",
"metadata": {},
"source": [
"Remove the six smallest eignvalues, which should be zero"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c3ca6eb-dca1-4bab-8f7d-6c42ce429400",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"evalues = evalues[6:]\n",
"emodes = emodes[6:, :]"
]
},
{
"cell_type": "markdown",
"id": "78563dd5-c6da-46d8-9b99-4928187023da",
Expand Down Expand Up @@ -270,6 +291,24 @@
"print(f'Need to run {to_compute} calculations for full accuracy.')"
]
},
{
"cell_type": "markdown",
"id": "ed1742cd-45a7-44e4-8a38-ebf3d0ed321d",
"metadata": {},
"source": [
"Reduce the number of perturbations if too large"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "09e27062-59c4-421c-9de5-f5457bf0ad32",
"metadata": {},
"outputs": [],
"source": [
"perturbs_per_evaluation = min(scaled_modes.shape[0], perturbs_per_evaluation)"
]
},
{
"cell_type": "markdown",
"id": "ad4c5d8e-96d4-4bb6-9bf2-6474d7563448",
Expand Down Expand Up @@ -381,7 +420,7 @@
"iterator = tqdm(range(to_compute - num_done))\n",
"for i in iterator:\n",
" # Choose a number of perturbation vectors\n",
" to_disp = rng.choice(scaled_modes.shape[0], size=(perturbs_per_evaluation,))\n",
" to_disp = rng.choice(scaled_modes.shape[0], size=(perturbs_per_evaluation,), replace=False)\n",
" \n",
" # Pick a random magnitude for each\n",
" disp = (scaled_modes[to_disp, :] * rng.uniform(-1, 1, size=(perturbs_per_evaluation, 1))).sum(axis=0)\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/1_explore-sampling-methods/run-all-methods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ done
# Test with the vibrational modes
notebook=3_displace-along-vibrational-modes.ipynb
for step_size in 0.001 0.002; do
for n in 8 16 32; do
for n in 16 32 64; do
papermill -p starting_geometry $xyz -p perturbs_per_evaluation $n -p step_size $step_size $notebook last.ipynb
done
done

0 comments on commit 34e5e1d

Please sign in to comment.