Skip to content

Commit

Permalink
Revert "Addded string-to-kernel helper functions to facilitate GPs fr…
Browse files Browse the repository at this point in the history
…om Dicts"

This reverts commit 956e3a3.
  • Loading branch information
stevetorr committed Sep 22, 2019
1 parent 1e6fb32 commit 781a074
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions flare/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,34 +869,3 @@ def triplet_force_en_kernel(ci1, ci2, ri1, ri2, ri3, rj1, rj2, rj3,
print(kern_finite_diff)
print(kern_analytical)
assert(np.isclose(kern_finite_diff, kern_analytical, atol=tol))

_str_to_kernel = {'two_body': two_body,
'two_body_en': two_body_en,
'two_body_force_en': two_body_force_en,
'three_body': three_body,
'three_body_en': three_body_en,
'three_body_force_en': three_body_force_en,
'two_plus_three_body': two_plus_three_body,
'two_plus_three_en': two_plus_three_en,
'two_plus_three_force_en': two_plus_three_force_en
}


def str_to_kernel(string: str, include_grad: bool=False):

if string not in _str_to_kernel.keys():
raise ValueError("Kernel {} not found in list of available "
"kernels{}:".format(string,_str_to_kernel.keys()))

if not include_grad:
return _str_to_kernel[string]
else:
if 'two' in string and 'three' in string:
return _str_to_kernel[string], two_plus_three_body_grad
elif 'two' in string and 'three' not in string:
return _str_to_kernel[string], two_body_grad
elif 'two' not in string and 'three' in string:
return _str_to_kernel[string], three_body_grad
else:
raise ValueError("Gradient callable for {} not found".format(
string))

0 comments on commit 781a074

Please sign in to comment.