annotate NEQGamma.py @ 1:afcb925def69 draft default tip

"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
author chemteam
date Fri, 13 Nov 2020 19:38:28 +0000
parents 4f3222cb5cf6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
1 #!/usr/bin/env python
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
2
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
3 # coding: utf-8
4f3222cb5cf6 "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
4f3222cb5cf6 "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.
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
8
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
9 import argparse
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
10 import json
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
11 import sys
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
12
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
13 import numpy as np
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
14
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
15 import pandas as pd
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
16
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
17 import scipy
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
18 import scipy.integrate
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
20
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
21
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
22 def get_file_names(list_file):
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
23 with open(list_file) as f:
4f3222cb5cf6 "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]
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
25
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
26
4f3222cb5cf6 "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):
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
28 N = len(file_names)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
29 RT = 0.0083144598 * T
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
30
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
31 sys.stdout.write("reading data...\n")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
32
4f3222cb5cf6 "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
4f3222cb5cf6 "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,
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
35 header=None, skiprows=17, dtype=float)
4f3222cb5cf6 "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)
4f3222cb5cf6 "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))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
38 x = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
39 t = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
40 t = test_file[0].values
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
41 x = test_file[0].values * vel
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
42
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
43 # read in data
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
44 for i in range(0, N):
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
45 current_file_name = file_names[i]
4f3222cb5cf6 "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))
4f3222cb5cf6 "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,
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
48 header=None, skiprows=17, dtype=float)
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
50
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
51 # preprocessing
4f3222cb5cf6 "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$.
4f3222cb5cf6 "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
4f3222cb5cf6 "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$
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
55 av_force = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
56 av_forceintegral = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
57 for i in range(length_data):
4f3222cb5cf6 "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])
4f3222cb5cf6 "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)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
60
4f3222cb5cf6 "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$
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
62 sys.stdout.write("calculating fluctuations...\n")
4f3222cb5cf6 "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))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
64 for i in range(length_data):
4f3222cb5cf6 "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]
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
66
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
67 # evaluation
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
68 # * optimized algorithm for numerical evaluation:
4f3222cb5cf6 "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'$
4f3222cb5cf6 "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
4f3222cb5cf6 "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$
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
72 # with all $t' \leq t$ each
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
73 # * then calculate the ensemble average
4f3222cb5cf6 "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>$
4f3222cb5cf6 "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))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
76 for n in range(N):
4f3222cb5cf6 "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(
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
78 delta_force_set[n, :], t)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
79
4f3222cb5cf6 "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")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
81 intcorr = np.zeros((N, length_data))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
82
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
83 for n in range(N):
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
84 for i in range(length_data):
4f3222cb5cf6 "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]
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
86 if i % 1000 == 0:
4f3222cb5cf6 "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(
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
88 n + 1, (i / length_data) * 100))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
89
4f3222cb5cf6 "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')$:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
91 sys.stdout.write("final average...\n")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
92 av_intcorr = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
93 for i in range(length_data):
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
95
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
96 # autocorrelation function evaluation:
4f3222cb5cf6 "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>$
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
98 # for the last $t$
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
99
4f3222cb5cf6 "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))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
101 autocorr_set = np.zeros(length_data)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
102
4f3222cb5cf6 "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")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
104 for n in range(N):
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
105 for i in range(length_data):
4f3222cb5cf6 "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[
4f3222cb5cf6 "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]
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
108
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
109 for i in range(length_data):
4f3222cb5cf6 "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])
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
111
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
112 # * Gauss filter:
4f3222cb5cf6 "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")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
114 blurr = sigma
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
115 blurred = np.zeros(length_data)
4f3222cb5cf6 "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)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
117
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
118 # * sliding window average:
4f3222cb5cf6 "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")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
120 window = av
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
121 runn_av = np.zeros(length_data)
4f3222cb5cf6 "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')
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
123
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
124 # * $W_{diss}$ from integration:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
125 wdiss = np.zeros(length_data)
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
127
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
128 sys.stdout.write("writing output...\n")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
129 dist = open(output, "w")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
130 frict = open(output_frict, "w")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
131
1
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
132 dist.write('\t'.join(('#x', 'force_integral', 'frict_coeff',
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
133 'wdiss', 'corrected_force_integral\n')))
0
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
134 for i in range(length_data):
1
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
135 dist.write("{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\n".format(
0
4f3222cb5cf6 "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],
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
137 av_forceintegral[i] - wdiss[i]))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
138
1
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
139 frict.write('\t'.join(('#x', 'ACF', 'frict_coeff',
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
140 'gauss_filtered_frict_coeff',
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
141 'av_window_frict_coeff\n')))
0
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
142 for i in range(length_data):
1
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
143 frict.write("{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\t{:.8f}\n".format(
0
4f3222cb5cf6 "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]))
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
145
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
146 dist.close()
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
147 frict.close()
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
148
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
149 sys.stdout.write("Done!\n")
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
150
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
151
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
152 def main():
1
afcb925def69 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
chemteam
parents: 0
diff changeset
153 parser = argparse.ArgumentParser(description="""dcTMD friction correction
0
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "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,
4f3222cb5cf6 "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:
4f3222cb5cf6 "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
4f3222cb5cf6 "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:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
164 Use with python3 or higher!""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
168 number.""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
172 dG(x).""")
4f3222cb5cf6 "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>',
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
174 type=str,
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
176 integration (time resolved), gauss filtered friction
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
177 coefficient, and slide window averaged friction.""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
180 time t into distance x""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
182 help='temperature in K')
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "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)""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "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
4f3222cb5cf6 "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)""")
4f3222cb5cf6 "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,
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
190 help='JSON file defining cluster membership')
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
191
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
192 args = parser.parse_args()
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
193
4f3222cb5cf6 "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)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
195 if args.json:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
196 with open(args.json) as f:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
197 j = json.load(f)
4f3222cb5cf6 "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}
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
199
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
200 for cluster in file_names_dct:
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
201 NEQGamma(file_names_dct[cluster],
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
202 'cluster{}_{}'.format(cluster, args.o),
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
203 'cluster{}_{}'.format(cluster, args.ofrict),
4f3222cb5cf6 "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)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
205 else:
4f3222cb5cf6 "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,
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
207 args.T, args.av, args.sigma)
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
208
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
209
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
210 if __name__ == "__main__":
4f3222cb5cf6 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 79589d149a8ff2791d4f71d28b155011672db827"
chemteam
parents:
diff changeset
211 main()