From 57baa8229e9ea91660e56f5776ce0cbe295732b4 Mon Sep 17 00:00:00 2001 From: Shaochen Shi Date: Fri, 17 Feb 2023 17:10:02 +0800 Subject: [PATCH 1/2] Update model conf before calculating its clash_penalty. --- src/lib/vina.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/vina.cpp b/src/lib/vina.cpp index 6205b15..d5a48fe 100644 --- a/src/lib/vina.cpp +++ b/src/lib/vina.cpp @@ -666,6 +666,7 @@ void Vina::randomize(const int max_steps) { VINA_FOR(i, max_steps) { c = init_conf; c.randomize(m_grid.corner1(), m_grid.corner2(), generator); + m_model.set(c); penalty = m_model.clash_penalty(); if (i == 0 || penalty < best_clash_penalty) { From e3348e4e494a6053f56d628e66cbd35e3b95e9a6 Mon Sep 17 00:00:00 2001 From: Shaochen Shi Date: Fri, 17 Feb 2023 17:32:52 +0800 Subject: [PATCH 2/2] Expose argument max_steps of function randomize in Python API. --- build/python/vina/vina.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build/python/vina/vina.py b/build/python/vina/vina.py index 515d8c8..702795f 100644 --- a/build/python/vina/vina.py +++ b/build/python/vina/vina.py @@ -395,9 +395,14 @@ def energies(self, n_poses=9, energy_range=3.0): return np.around(self._vina.get_poses_energies(n_poses, energy_range), decimals=3) - def randomize(self): - """Randomize the input ligand conformation.""" - self._vina.randomize() + def randomize(self, max_steps=10000): + """Randomize the input ligand conformation. + + Args: + max_steps (int): Number of poses to generate for selection of the best one. + + """ + self._vina.randomize(max_steps) def score(self, unbound_energy=None): """Score current pose.