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

[Q] Inconsistency in bulk solvent scaling fitting? #643

Open
sizmailov opened this issue Aug 20, 2021 · 1 comment · May be fixed by #693
Open

[Q] Inconsistency in bulk solvent scaling fitting? #643

sizmailov opened this issue Aug 20, 2021 · 1 comment · May be fixed by #693

Comments

@sizmailov
Copy link

sizmailov commented Aug 20, 2021

I have a question about recent change in bulk solvent scaling by @pafonine

In the k_mask_grid_search() we find new k_mask and corresponding k_isotropic in resolution shells via grid search.
Next we try to improve r-factor by linear interpolation of k_mask via populate_bin_to_individual_k_mask_linear_interpolation().
Finally we accept k_mask and k_isotropic if they improve r-factor.

The problem is that populate_bin_to_individual_k_mask_linear_interpolation() always use old k_isotropic to compute r-factor. Is there a rationale behind it? Shouldn't it use new k_isotropic instead?

def k_mask_grid_search(self, r_start):
if(self.verbose):
print(" k_mask_grid_search:", file=self.log)
print(" r_start: %6.4f (r_low: %6.4f)"%(r_start,self._r_low()))
#k_mask_trial_range = flex.double([i/1000. for i in range(0,650,50)])
k_mask_trial_range = flex.double([i/1000. for i in range(0,1010,10)])
k_mask = flex.double(self.f_obs.size(), 0)
k_mask_bin = flex.double()
k_isotropic = flex.double(self.f_obs.size(), 0)
k_total = self.get_k_total()
for i_cas, cas in enumerate(self.cores_and_selections):
selection, core, selection_use, sel_work = cas
f_obs = self.f_obs.select(selection)
k_total_ = k_total.select(selection)
k_mask_bin_, k_isotropic_bin_ = \
bulk_solvent.k_mask_and_k_overall_grid_search(
f_obs.data()/k_total_,
core.f_calc.data(),
core.f_mask().data(),
k_mask_trial_range,
selection_use)
k_mask_bin.append(k_mask_bin_)
k_mask.set_selected(selection, k_mask_bin_)
k_isotropic.set_selected(selection, k_isotropic_bin_)
k_mask_bin_smooth = self.smooth(k_mask_bin)
k_mask = self.populate_bin_to_individual_k_mask_linear_interpolation(
k_mask_bin = k_mask_bin_smooth)
r_try = self.try_scale(k_mask = k_mask, k_isotropic = k_isotropic)

@sizmailov
Copy link
Author

sizmailov commented Sep 24, 2021

Sorry for confusion, now I see. Actual old k_isotropic values are effectively ignored by populate_bin_to_individual_k_mask_linear_interpolation() since trial r-factor calculation is done in resolution bin with adjusted overall scale factor (inside of try_scale()). So, please scratch initial question.

Let me ask another one here about same piece of code. Next two snippets are final parts of k_mask_grid_search and bulk_solvent_scaling(). Both functions optimize k_bulk and update k_isotropic in accordance.

k_mask_bin_smooth = self.smooth(k_mask_bin)
k_mask = self.populate_bin_to_individual_k_mask_linear_interpolation(
k_mask_bin = k_mask_bin_smooth)
r_try = self.try_scale(k_mask = k_mask, k_isotropic = k_isotropic)

k_mask_bin_smooth = self.smooth(k_mask_bin)
k_mask = self.populate_bin_to_individual_k_mask_linear_interpolation(
k_mask_bin = k_mask_bin_smooth)
k_isotropic = self._k_isotropic_as_scale_k1(r_start=r_start,k_mask = k_mask)
r_try = self.try_scale(k_mask = k_mask, k_isotropic = k_isotropic)

Shouldn't they be exactly the same?

sizmailov added a commit to sizmailov/cctbx_project that referenced this issue Dec 1, 2021
@sizmailov sizmailov linked a pull request Dec 1, 2021 that will close this issue
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 a pull request may close this issue.

1 participant