-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdihedral_angle_avg_std.py
More file actions
executable file
·42 lines (38 loc) · 1.02 KB
/
dihedral_angle_avg_std.py
File metadata and controls
executable file
·42 lines (38 loc) · 1.02 KB
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
# Requires Python2.7
from string import digits
import math
import sys
# READS THE XVG FILE
# Need to put script file in same directory as the avg
# Reads an multiple .xvg files and returns the average and dihedral angle across all .xvg files
# Name of file name to read
fileread = str(sys.argv[1])
# Name of filename to output to
file = str(sys.argv[3])
filewrite = open(file,'w')
for i in range(1,54):
linecount = 0
secondlinecount = 0
total = 0
mean = 0
summation = 0
summationsmaller = 0
standarddeviation = 0
standarderror = 0
numbers = 0
numberstwo = 0
total = 0
with open(fileread+str(i) + ".dat") as f:
# YOU WILL NEED TO EDIT THIS FOR YOUR FILE
# What xvg stuff its reading
for line in f:
if "@" not in line:
if "#" not in line:
linesplit = line.split()
linecount = linecount + 1
if len(linesplit) > 1:
numbers = numbers + 1
total = total + float(linesplit[2])
mean = float(total/(numbers))
print "mean is: " + str(mean)
filewrite.write(str(float(i)) + " " + str(mean) + "\n")