From aedbdd9093e64274e34f7b558bc63d4b25c691ed Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Fri, 21 Sep 2018 13:23:49 -0500
Subject: [PATCH] Added missing angle potential file

---
 mrdna/config.py               |  4 ++--
 mrdna/model/spring_from_lp.py | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 mrdna/model/spring_from_lp.py

diff --git a/mrdna/config.py b/mrdna/config.py
index ec7f2f2..4c8c40e 100644
--- a/mrdna/config.py
+++ b/mrdna/config.py
@@ -47,11 +47,11 @@ Do you agree to allow the mrdna package can send the information
 described above to the Aksimentiev group webserver? [y/N]""")
         response = input()
         if response in 'y Y yes Yes YES'.split():
-            print("Permission granted")
+            # print("Permission granted")
             config['reporting_allowed'] = True
             break
         elif response in 'n N no No NO'.split() + [""]:
-            print("Permission denied")
+            # print("Permission denied")
             config['reporting_allowed'] = False
             break
     with open(_USER_CONF,'w') as ch:
diff --git a/mrdna/model/spring_from_lp.py b/mrdna/model/spring_from_lp.py
new file mode 100644
index 0000000..5702c96
--- /dev/null
+++ b/mrdna/model/spring_from_lp.py
@@ -0,0 +1,16 @@
+import numpy as np
+_kT = 0.58622522         # kcal/mol
+_k = np.logspace(-8,3,1000)
+
+def _integrate( fn ):
+    t = np.linspace(0,np.pi,10000)
+    return np.trapz( fn(t), t[np.newaxis,:], axis = -1 )
+
+_integral = _integrate( lambda t: np.cos(t[np.newaxis,:])*np.sin(t[np.newaxis,:])* np.exp((-0.5*_k[:,np.newaxis]*(t[np.newaxis,:])**2 )/_kT) ) / \
+            _integrate( lambda t: np.sin(t[np.newaxis,:]) * np.exp((-0.5*_k[:,np.newaxis]*(t[np.newaxis,:])**2 )/_kT) )
+
+
+assert( (np.diff(_integral) <= 0).sum() == 0 )
+def k_angle(sep,Lp):
+    val = np.exp(-sep/Lp)
+    return np.interp(val,_integral,_k) * 0.00030461742 # convert to degree^2
-- 
GitLab