-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAngles.py
58 lines (47 loc) · 2.44 KB
/
Angles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# pyBrown is a bundle of tools useful for Brownian and Stokesian dynamics
# simulations. Copyright (C) 2018 Tomasz Skora ([email protected])
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses.
import click
from pyBrown_tools.input_Lengths import InputDataLengths
from pyBrown_tools.messaging import timestamp
from pyBrown_tools.trajectories import read_trajectories, add_auxiliary_data_multibeads, \
compute_angles, compute_angle_distribution, \
save_angles_to_file
#-------------------------------------------------------------------------------
@click.command()
@click.argument('input_filename',
type = click.Path( exists = True ))
def main(input_filename):
# here the list of keywords that are required for program to work is provided
required_keywords = ["labels", "sizes", "box_size", "input_xyz_template", "input_xyz_range",
"bin_range", "number_of_bins"]
# here the dict of keywords:default values is provided
# if given keyword is absent in JSON, it is added with respective default value
defaults = {"debug": False, "verbose": False, "probing_frequency": 1,
"min_time": 0.0, "float_type": 32}
timestamp( 'Reading input from {} file', input_filename )
i = InputDataLengths(input_filename, required_keywords, defaults)
timestamp( 'Input data:\n{}', i )
timestamp( 'Reading trajectories' )
times, labels, auxiliary_data = read_trajectories(i.input_data)
add_auxiliary_data_multibeads( i.input_data, labels, auxiliary_data )
timestamp( 'Computing angles' )
angle_labels = compute_angles( i.input_data, labels, auxiliary_data )
timestamp( 'Computing angle distribution' )
bins, angle_distribution = compute_angle_distribution( i.input_data, angle_labels, auxiliary_data )
save_angles_to_file( i.input_data, bins, angle_distribution )
#-------------------------------------------------------------------------------
if __name__ == '__main__':
main()