From 6c3326cbc0069aae6a0c9b47eb3f57a4e5eb1ab6 Mon Sep 17 00:00:00 2001 From: Alan Grossfield Date: Tue, 23 Jan 2024 16:36:47 -0500 Subject: [PATCH] small modernization --- Packages/PyLOOS/protein_tilt.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Packages/PyLOOS/protein_tilt.py b/Packages/PyLOOS/protein_tilt.py index fbb2ef6c4..2677a4072 100755 --- a/Packages/PyLOOS/protein_tilt.py +++ b/Packages/PyLOOS/protein_tilt.py @@ -12,13 +12,11 @@ print(" points in the +z direction") sys.exit() -#print len(sys.argv) print("#", " ".join(sys.argv)) system_filename = sys.argv[1] traj_filename = sys.argv[2] selections = sys.argv[3:] - system = loos.createSystem(system_filename) traj = loos.pyloos.Trajectory(traj_filename, system) @@ -26,22 +24,24 @@ for s in selections: helices.append(loos.selectAtoms(system, s)) +to_degrees = 180.0/math.pi + print("#Frame\tAngle\tCosine") -for frame in traj: +for _ in traj: - vec = loos.GCoord(0., 0., 0.) + vec = loos.GCoord(0.0, 0.0, 0.0) for h in helices: pca = h.principalAxes() v = pca[0] if v.z() < 0: - v *= -1. + v *= -1.0 vec += v cosine = vec.z() / vec.length() cosine = max(-1.0, cosine) cosine = min(1.0, cosine) - ang = math.acos(cosine) * 180./math.pi + ang = math.acos(cosine) * to_degrees print(traj.index(), ang, cosine)