Skip to content

Commit

Permalink
Scale perturbations by number of atoms involved
Browse files Browse the repository at this point in the history
  • Loading branch information
WardLT committed Nov 16, 2023
1 parent 62fa41b commit 77cbe07
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
" # Sample a perturbation\n",
" disp = np.random.normal(0, 1, size=(n_atoms * 3))\n",
" disp /= np.linalg.norm(disp)\n",
" disp *= step_size\n",
" disp *= step_size * len(atoms) \n",
" disp = disp.reshape((-1, 3))\n",
" \n",
" # Subtract off any translation\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
" disp = np.random.normal(0, 1, size=(n_atoms * 3))\n",
" disp /= np.linalg.norm(disp)\n",
" my_step_dist = np.random.exponential(scale=step_size)\n",
" disp *= my_step_dist\n",
" disp *= my_step_dist * len(atoms)\n",
" disp = disp.reshape((-1, 3))\n",
" \n",
" # Subtract off any translation\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
" # Create the perturbation vector\n",
" disp = np.zeros((n_coords,))\n",
" for d in perturb:\n",
" disp[abs(d) - 1] = (1 if abs(d) > 0 else -1) * step_size\n",
" disp[abs(d) - 1] = (1 if abs(d) > 0 else -1) * step_size / perturbs_per_evaluation\n",
" disp = disp.reshape((-1, 3))\n",
" \n",
" # Make the new atoms\n",
Expand Down
4 changes: 2 additions & 2 deletions notebooks/1_explore-sampling-methods/run-all-methods.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#! /bin/bash

xyz=../data/exact/caffeine_pm7_None.xyz
for step_size in 0.04 0.02 0.01 0.005; do
for step_size in 0.02; do
# Do the randomized methods
for method in 0_random-directions-same-distance.ipynb 1_random-directions-variable-distance.ipynb; do
papermill -p starting_geometry $xyz -p step_size $step_size $method last.ipynb
done

# Test with different reductions for "along axes"
notebook=2_displace-along-axes.ipynb
for n in 1 2 4; do
for n in 2 4 8; 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 77cbe07

Please sign in to comment.