Skip to content

Commit

Permalink
Fix assignment of g_vec for MTREXEE
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriedman22 committed Oct 15, 2024
1 parent 21139ef commit 2890b2e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ensemble_md/replica_exchange_EE.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,16 @@ def combine_weights(self, weights, weights_err=None, print_values=True):
dg_vec.append(utils.weighted_mean(dg_list, dg_err_list)[0])

dg_vec.insert(0, 0)
g_vec = np.array([sum(dg_vec[:(i + 1)]) for i in range(len(dg_vec))])
nan_loc = [i for i, x in enumerate(dg_vec) if np.isnan(x)]
if len(nan_loc) != 0:
g_vec = np.zeros(len(dg_vec))
for i in range(1, len(dg_vec)):
if i in nan_loc:
continue
else:
g_vec[i] = g_vec[i-1] + dg_vec[i]
else:
g_vec = np.array([sum(dg_vec[:(i + 1)]) for i in range(len(dg_vec))])

# (3) Determine the vector of alchemical weights for each replica
weights_modified = np.zeros_like(weights)
Expand Down

0 comments on commit 2890b2e

Please sign in to comment.