From 7e40fcd8f24ae259d55d1c51ef834b7bf2490f74 Mon Sep 17 00:00:00 2001 From: yihengwuKP Date: Tue, 10 Sep 2024 12:17:00 -0500 Subject: [PATCH] refactorizing Q calculation for easy understanding --- pysages/colvars/contacts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pysages/colvars/contacts.py b/pysages/colvars/contacts.py index edd75c97..9c6c1869 100644 --- a/pysages/colvars/contacts.py +++ b/pysages/colvars/contacts.py @@ -136,10 +136,10 @@ def native_contact_fraction(r, contact_pairs, references, gamma, lambda_d, clip, distances_contacts = distances[contact_pairs[:, 0], contact_pairs[:, 1]] reference_distances_contacts = reference_distances[contact_pairs[:, 0], contact_pairs[:, 1]] - diff = distances_contacts - lambda_d * reference_distances_contacts + diff = gamma * (distances_contacts - lambda_d * reference_distances_contacts) if clip: - diff = np.clip(diff, None, clip_val / gamma) - Q_contribution = 1 / (1 + np.exp(gamma * diff)) + diff = np.clip(diff, None, clip_val) + Q_contribution = 1 / (1 + np.exp(diff)) N_contacts = contact_pairs.shape[0]