Skip to content

Commit 0e4b6c0

Browse files
skfeganharryswift01
authored andcommitted
fixing indexing issue for start and end parameters affecting timesteps
1 parent bfb0b77 commit 0e4b6c0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CodeEntropy/calculations/ConformationFunctions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ def assign_conformation(
3838
# get the values of the angle for the dihedral
3939
# dihedral angle values have a range from -180 to 180
4040
for timestep in data_container.trajectory[start:end:step]:
41+
timestep_index = timestep.frame - start
4142
value = dihedral.value()
4243
# we want postive values in range 0 to 360 to make the peak assignment work
4344
# using the fact that dihedrals have circular symetry
4445
# (i.e. -15 degrees = +345 degrees)
4546
if value < 0:
4647
value += 360
47-
phi[timestep.frame] = value
48+
phi[timestep_index] = value
4849

4950
# create a histogram using numpy
5051
number_bins = int(360 / bin_width)

CodeEntropy/calculations/LevelFunctions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ def get_matrices(
9494
trans_axes, rot_axes = GF.get_axes(data_container, level, bead_index)
9595

9696
# Sort out coordinates, forces, and torques for each atom in the bead
97-
weighted_forces[bead_index][timestep.frame] = GF.get_weighted_forces(
97+
timestep_index = timestep.frame - start
98+
weighted_forces[bead_index][timestep_index] = GF.get_weighted_forces(
9899
data_container, list_of_beads[bead_index], trans_axes, highest_level
99100
)
100-
weighted_torques[bead_index][timestep.frame] = GF.get_weighted_torques(
101+
weighted_torques[bead_index][timestep_index] = GF.get_weighted_torques(
101102
data_container, list_of_beads[bead_index], rot_axes
102103
)
103104

0 commit comments

Comments
 (0)