Skip to content

Commit

Permalink
Merge pull request #177 from shishaochen/fix-randomize_only
Browse files Browse the repository at this point in the history
Update model conf before calculating its clash_penalty.
  • Loading branch information
diogomart authored Jun 7, 2023
2 parents 6ce9d84 + e3348e4 commit 626e6e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build/python/vina/vina.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/lib/vina.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,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) {
Expand Down

0 comments on commit 626e6e9

Please sign in to comment.