Mercurial > repos > chemteam > biomd_extract_clusters
annotate NEQGamma.py @ 2:e0ecaf2d05fb draft default tip
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
author | chemteam |
---|---|
date | Fri, 13 Nov 2020 19:39:27 +0000 |
parents | 078dfd7fb26d |
children |
rev | line source |
---|---|
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
1 #!/usr/bin/env python |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
2 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
3 # coding: utf-8 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
4 # This script is a modified version of a script written |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
5 # by Steffen Wolf under the GPL v3.0. |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
6 # The original version can be accessed at |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
7 # https://github.com/moldyn/dcTMD/blob/master/NEQGamma.py |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
8 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
9 import argparse |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
10 import json |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
11 import sys |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
12 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
13 import numpy as np |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
14 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
15 import pandas as pd |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
16 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
17 import scipy |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
18 import scipy.integrate |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
19 from scipy.ndimage.filters import gaussian_filter |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
20 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
21 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
22 def get_file_names(list_file): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
23 with open(list_file) as f: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
24 return [line for line in f.read().split('\n') if line] |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
25 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
26 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
27 def NEQGamma(file_names, output, output_frict, vel, T, av, sigma): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
28 N = len(file_names) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
29 RT = 0.0083144598 * T |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
30 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
31 sys.stdout.write("reading data...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
32 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
33 # read in initial data to get length of necessary array |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
34 test_file = pd.read_csv(file_names[0], delim_whitespace=True, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
35 header=None, skiprows=17, dtype=float) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
36 length_data = len(test_file[0].values) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
37 full_force_set = np.zeros((N, length_data)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
38 x = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
39 t = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
40 t = test_file[0].values |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
41 x = test_file[0].values * vel |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
42 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
43 # read in data |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
44 for i in range(0, N): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
45 current_file_name = file_names[i] |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
46 sys.stdout.write("reading file {}\n".format(current_file_name)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
47 input_file_data = pd.read_csv(current_file_name, delim_whitespace=True, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
48 header=None, skiprows=17, dtype=float) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
49 full_force_set[i, :] = input_file_data[1].values |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
50 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
51 # preprocessing |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
52 # * force average: calculate $\left< f_c (t)\right>_N$. |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
53 # **Important:** this is an ensemble average over the trajectory ensemble |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
54 # $N$, not the time average over $t$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
55 av_force = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
56 av_forceintegral = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
57 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
58 av_force[i] = np.mean(full_force_set[:, i]) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
59 av_forceintegral[1:] = scipy.integrate.cumtrapz(av_force, x) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
60 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
61 # calculate $\delta f_c(t) = f_c(t) - \left< f_c (t) \right>_N$ for all $t$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
62 sys.stdout.write("calculating fluctuations...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
63 delta_force_set = np.zeros((N, length_data)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
64 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
65 delta_force_set[:, i] = full_force_set[:, i] - av_force[i] |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
66 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
67 # evaluation |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
68 # * optimized algorithm for numerical evaluation: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
69 # * integrate: $\int_0^t dt' \delta f_c(t')$ for all $t'$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
70 # * multiply by $\delta f_c(t)$ to yield |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
71 # $\int_0^t dt'\delta f_c(t) \delta f_c(t')$ for $t$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
72 # with all $t' \leq t$ each |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
73 # * then calculate the ensemble average |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
74 # $\left< \int_0^t dt' \delta f_c(t) \delta f_c(t') \right>$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
75 int_delta_force_set = np.zeros((N, length_data)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
76 for n in range(N): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
77 int_delta_force_set[n, 1:] = scipy.integrate.cumtrapz( |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
78 delta_force_set[n, :], t) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
79 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
80 sys.stdout.write("averaging and integrating...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
81 intcorr = np.zeros((N, length_data)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
82 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
83 for n in range(N): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
84 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
85 intcorr[n, i] = delta_force_set[n, i] * int_delta_force_set[n, i] |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
86 if i % 1000 == 0: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
87 sys.stdout.write("Trajectory {:2d} {:3.1f} % done\r".format( |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
88 n + 1, (i / length_data) * 100)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
89 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
90 # shape of $\int_0^t dt' \delta f_c(t) \delta f_c(t')$: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
91 sys.stdout.write("final average...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
92 av_intcorr = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
93 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
94 av_intcorr[i] = np.mean(intcorr[:, i]) / RT |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
95 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
96 # autocorrelation function evaluation: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
97 # * calculate $\left< \delta f_c(t) \delta f_c(t') \right>$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
98 # for the last $t$ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
99 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
100 corr_set = np.zeros((N, length_data)) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
101 autocorr_set = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
102 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
103 sys.stdout.write("calculating and processing ACF...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
104 for n in range(N): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
105 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
106 corr_set[n, i] = delta_force_set[ |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
107 n, i] * delta_force_set[n, length_data - 1] |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
108 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
109 for i in range(length_data): |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
110 autocorr_set[i] = np.mean(corr_set[:, i]) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
111 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
112 # * Gauss filter: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
113 sys.stdout.write("applying Gauss filter...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
114 blurr = sigma |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
115 blurred = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
116 blurred = gaussian_filter(av_intcorr, sigma=blurr) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
117 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
118 # * sliding window average: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
119 sys.stdout.write("applying sliding window average...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
120 window = av |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
121 runn_av = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
122 runn_av = np.convolve(av_intcorr, np.ones((window,)) / window, mode='same') |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
123 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
124 # * $W_{diss}$ from integration: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
125 wdiss = np.zeros(length_data) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
126 wdiss[1:] = scipy.integrate.cumtrapz(av_intcorr, x) * vel |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
127 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
128 sys.stdout.write("writing output...\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
129 dist = open(output, "w") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
130 frict = open(output_frict, "w") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
131 |
2
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
132 dist.write('\t'.join(('#x', 'force_integral', 'frict_coeff', |
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
133 'wdiss', 'corrected_force_integral\n'))) |
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
134 for i in range(length_data): |
2
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
135 dist.write("{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\n".format( |
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
136 x[i], av_forceintegral[i], av_intcorr[i], wdiss[i], |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
137 av_forceintegral[i] - wdiss[i])) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
138 |
2
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
139 frict.write('\t'.join(('#x', 'ACF', 'frict_coeff', |
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
140 'gauss_filtered_frict_coeff', |
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
141 'av_window_frict_coeff\n'))) |
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
142 for i in range(length_data): |
2
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
143 frict.write("{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\n".format( |
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
144 x[i], autocorr_set[i], av_intcorr[i], blurred[i], runn_av[i])) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
145 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
146 dist.close() |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
147 frict.close() |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
148 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
149 sys.stdout.write("Done!\n") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
150 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
151 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
152 def main(): |
2
e0ecaf2d05fb
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents:
1
diff
changeset
|
153 parser = argparse.ArgumentParser(description="""dcTMD friction correction |
1
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
154 (please cite: Wolf, S., Stock, G. Targeted Molecular Dynamics |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
155 Calculations of Free Energy Profiles Using a Nonequilibrium |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
156 Friction Correction. J. Chem. Theory Comput. 2018, 14(12), 6175-6182, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
157 DOI: 10.1021/acs.jctc.8b00835). Integrates a constraint force file via |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
158 trapezoid rule, calculates the NEQ memory friction kernel and friction |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
159 factors, and performs a friction correction. First column: reaction |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
160 coordinate in nm calculated via t * vel. Second column: force integral, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
161 i.e. the work profile. Third column: friction factors. Fourth column: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
162 trapezoid integral (final value) of friction work along reaction |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
163 coordinate. Fourth column: friction corrected work profile. ATTENTION: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
164 Use with python3 or higher!""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
165 parser.add_argument('-i', metavar='<xvg force file>', type=str, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
166 help="""List of xvg constraint force files prefix |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
167 as given by Gromacs mdrun -pf option before running |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
168 number.""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
169 parser.add_argument('-o', metavar='<combined results>', type=str, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
170 help="""file to write x, dG(x), friction coefficeint by |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
171 integration (time resolved), and the friction-corrected |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
172 dG(x).""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
173 parser.add_argument('-ofrict', metavar='<combined friction results>', |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
174 type=str, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
175 help="""file to write x, ACF, friction coefficeint by |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
176 integration (time resolved), gauss filtered friction |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
177 coefficient, and slide window averaged friction.""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
178 parser.add_argument('-vel', metavar='<pull velocity>', type=float, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
179 help="""pull velocity in nm/ps for converting simulation |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
180 time t into distance x""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
181 parser.add_argument('-T', metavar='<temperature>', type=float, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
182 help='temperature in K') |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
183 parser.add_argument('-av', metavar='<average window>', type=int, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
184 help="""size of averaging window for displaying |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
185 Gamma(x) (recommended: 4 to 20 per 100 data points)""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
186 parser.add_argument('-sigma', metavar='<gauss blurr>', type=int, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
187 help="""sigma value for Gauss filter for displaying |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
188 Gamma(x) (recommended: 4 per 100 data points)""") |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
189 parser.add_argument('-json', metavar='<json>', type=str, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
190 help='JSON file defining cluster membership') |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
191 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
192 args = parser.parse_args() |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
193 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
194 file_names = get_file_names(args.i) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
195 if args.json: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
196 with open(args.json) as f: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
197 j = json.load(f) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
198 file_names_dct = {n: [file_names[int(m)] for m in j[n]] for n in j} |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
199 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
200 for cluster in file_names_dct: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
201 NEQGamma(file_names_dct[cluster], |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
202 'cluster{}_{}'.format(cluster, args.o), |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
203 'cluster{}_{}'.format(cluster, args.ofrict), |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
204 args.vel, args.T, args.av, args.sigma) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
205 else: |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
206 NEQGamma(file_names, args.o, args.ofrict, args.vel, |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
207 args.T, args.av, args.sigma) |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
208 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
209 |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
210 if __name__ == "__main__": |
078dfd7fb26d
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff
changeset
|
211 main() |