Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicated calculation of coordinates. #278

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

shishaochen
Copy link
Contributor

@shishaochen shishaochen commented Feb 15, 2024

In function quasi_newton::operator(), the model coordinates are always updated with the conformer searched from BFGS optimization.

void quasi_newton::operator()(model& m, const precalculate_byatom& p, const igrid& ig, output_type& out, change& g, const vec& v, int& evalcount) const { // g must have correct size
quasi_newton_aux aux(&m, &p, &ig, v);
fl res = bfgs(aux, out.c, g, max_steps, average_required_improvement, 10, evalcount);
// Update model a last time after optimization
m.set(out.c);
out.e = res;
}

Thus, there is no need to calculate model coordinates in function monte_carlo::operator().

quasi_newton_par(m, p, ig, candidate, g, hunt_cap, evalcount);
if(step == 0 || metropolis_accept(tmp.e, candidate.e, temperature, generator)) {
tmp = candidate;
m.set(tmp.c); // FIXME? useless?
// FIXME only for very promising ones
if(tmp.e < best_e || out.size() < num_saved_mins) {
quasi_newton_par(m, p, ig, tmp, g, authentic_v, evalcount);
m.set(tmp.c); // FIXME? useless?
tmp.coords = m.get_heavy_atom_movable_coords();
add_to_output_container(out, tmp, min_rmsd, num_saved_mins); // 20 - max size
if(tmp.e < best_e)
best_e = tmp.e;
}
}

To ensure consistency, a test is executed between the base commit and the updated one. Bash commands are pasted below:

cd example/basic_docking/
time vina \
  --receptor solution/1iep_receptor.pdbqt \
  --ligand solution/1iep_ligand.pdbqt \
  --config solution/1iep_receptor_vina_box.txt \
  --exhaustiveness 16 \
  --seed 137 \
  --cpu 6 \
  --no_refine  # Observe the output of Monte-Carlo search

It can be verified that generated files solution/1iep_ligand_out.pdbqt are exactly alike.

With this pull request merged, we are convinced that CPU cost will be reduced slightly. My CPU type is Intel(R) Xeon(R) Platinum 8336C CPU @ 2.30GHz and average time of 10 runs are:

version real user sys
baseline 33.83s 180.47s 0.37s
updated 33.76s 180.20s 0.35s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant