コード例 #1
0
sys.path.append('../../')
import itre

stride = 20
data = np.loadtxt('LOWD_CVS')
colvars = data[1:, 1:-1]
heights = data[1:, -1]
sigmas = np.ones(colvars.shape) * 0.1

th = np.loadtxt('THETA')
thetas = th[1:, 1:]
wall = np.zeros(len(colvars))

limit = 100

dumb_it = itre.Itre()
dumb_it.use_numba = True
dumb_it.kT = 300
dumb_it.colvars = colvars[:limit]
dumb_it.set_boundaries(np.array([-np.pi, np.pi] * 8))
dumb_it.wall = wall
dumb_it.sigmas = sigmas[:limit]
dumb_it.thetas = thetas[:limit]
dumb_it.has_thetas = True
dumb_it.heights = heights[:limit]
dumb_it.stride = stride
dumb_it.n_evals = int(limit / dumb_it.stride)
dumb_it.calculate_c_t()

new_it = itre.Itre()
new_it.kT = 300
コード例 #2
0
ファイル: use_nb.py プロジェクト: gibertif/ITRE
import itre
import json
import os
import matplotlib.pyplot as plt
import numpy as np
import time

colvars = np.loadtxt('COLVARS')
sigmas = np.loadtxt('SIGMAS')
heights = np.loadtxt('HEIGHTS')

iters = 1
times = []
for ss in range(1000, len(colvars), 100):

    new_it = itre.Itre()
    new_it.use_numba = True
    new_it.colvars = colvars[:ss]
    new_it.kT = 300
    new_it.set_boundaries(np.array([-np.pi, np.pi] * 2))
    new_it.wall = np.zeros(len(colvars[:ss]))
    new_it.sigmas = sigmas[:ss]
    new_it.heights = heights[:ss] / heights[0] * 2.0
    new_it.stride = 10
    new_it.n_evals = int(ss / 10)
    start = time.time()
    new_it.calculate_c_t()
    end = time.time()
    print("{} steps processed in {} s".format(ss, end - start))
    times.append([ss, end - start])
    plt.plot(new_it.ct[-1].T, label="ITRE c (t|T={})".format(ss))
コード例 #3
0
import sys
sys.path.append('../../')
import itre
import json
import os
import matplotlib.pyplot as plt
import numpy as np
import time

if os.path.isfile("pyitre.json"):
    with open("pyitre.json", 'r') as json_file:
        directives = json.load(json_file)

i_bias = np.loadtxt('bias', usecols=1, skiprows=2)

it = itre.Itre()
it.kT = 300
it.from_dict(directives)

start = time.time()

it.calculate_c_t()

end = time.time()
raw_time = end - start
print("execution completed in {}".format(raw_time))

ref_ct = it.ct[-1].T

plt.plot(it.instantaneous_bias, label="V(s,t) itre")
plt.plot(i_bias[::it.stride], label="V(s,t)")