I think the solvent masking is not estimated correctly if only a PDB file is provided (i.e. no experimental data) to SFcalculator.
This is observable in the real space electron density (e.g if loaded in Coot).
I believe the issue is that the scales are not initialized to good enough values when data is not provided.
In _set_scales, currently:
kiso=1.0,
kmask=0.35,
uaniso=[0.01, 0.01, 0.01, 1e-4, 1e-4, 1e-4]
But at the very least kmask should be resolution dependent with some average values. The following seems to work well and gives good real space density for a few test cases:
kiso=1.0,
kmask=0.00,
uaniso=[1e-4, 1e-4, 1e-4, 1e-4, 1e-4, 1e-4]
with added resolution dependence
self.kmasks = []
for bin_i in np.sort(np.unique(self.bins)):
index_i = self.bins == bin_i
s_squared = 1 / np.mean(self.dHasu[index_i])
kmask = 0.85 * np.exp(-250 * s_squared / 4)
kmask_tensor = (
torch.tensor(kmask).to(self.atom_pos_frac).requires_grad_(requires_grad)
)
self.kmasks.append(kmask_tensor)
I use the kmask expression:
kmask = ksol * exp( -Bsol * s**2 /4) with ksol = 0.85 (midway between 0.75-0.95)
and Bsol = 250 (midway between 150-350) from Glykos & Kokkinidis, Acta Crystallogr D Biol Crystallogr. 2000 Aug;56(Pt 8):1070-2
These are probably not the most representative values, but they seem to do the trick. Thoughts?