Skip to content

mmtbx.f_model.manager.deep_copy() does not work correctly when twinned #194

Open
@keitaroyam

Description

@keitaroyam

Following code demonstrates deep_copy()-ed fmodel does not show the same statistics.
Non-twinned data do not cause this problem.
There seems to be something wrong with copying of fmodel_ts1 member.

# Randomly chosen twinned data
pdb_id = "2Z43"
twin_law = "k,h,-l"

import mmtbx.command_line.fetch_pdb
import mmtbx.utils
import iotbx.pdb
from iotbx import reflection_file_reader
from iotbx import reflection_file_utils


mmtbx.command_line.fetch_pdb.run2([pdb_id, "--mtz"])
reflection_file_server = reflection_file_utils.reflection_file_server(reflection_files=[reflection_file_reader.any_reflection_file(file_name=pdb_id+".mtz")])

determine_data_and_flags_result = mmtbx.utils.determine_data_and_flags(reflection_file_server=reflection_file_server)
f_obs = determine_data_and_flags_result.f_obs
r_free_flags = determine_data_and_flags_result.r_free_flags

pdb_inp = iotbx.pdb.input(file_name=pdb_id+".pdb")
pdb_hierarchy = pdb_inp.construct_hierarchy(set_atom_i_seq=True)
xray_structure = pdb_hierarchy.extract_xray_structure(crystal_symmetry=f_obs.crystal_symmetry())

fmodel = mmtbx.utils.fmodel_manager(
          xray_structure = xray_structure,
          f_obs          = f_obs,
          r_free_flags   = r_free_flags,
          twin_law       = twin_law)
fmodel.update_all_scales(optimize_mask=False, remove_outliers=True)

print
print "Original fmodel:"
fmodel.info().show_rfactors_targets_scales_overall()

print
print "Deep_copied fmodel:"
fmodel_copied = fmodel.deep_copy()
fmodel_copied.info().show_rfactors_targets_scales_overall()

print
print "Deep_copied fmodel with original fmodel_ts1:"
fmodel_copied.fmodel_ts1 = fmodel.fmodel_ts1
fmodel_copied.info().show_rfactors_targets_scales_overall()

In my environment the output was:

Original fmodel:
|--(resolution: 1.93 - 27.61 A, n_refl.=78018 (all), 4.67  % free)------------|
|                                                                             |
| r_work= 0.1940 r_free= 0.2411 coordinate error (max.-lik. estimate): None A |
|                                                                             |
| normalized target function (twin_lsq_f) (work): 13.864074                   |
| target function (twin_lsq_f) not normalized (work): 1070112.412251          |
| target function (twin_lsq_f) not normalized (free): 63778.588669            |
| twin fraction: 0.50  twin operator: k,h,-l                                  |
|-----------------------------------------------------------------------------|

Deep_copied fmodel:
|--(resolution: 1.93 - 27.61 A, n_refl.=78018 (all), 4.67  % free)------------|
|                                                                             |
| r_work= 0.2610 r_free= 0.2987 coordinate error (max.-lik. estimate): None A |
|                                                                             |
| normalized target function (twin_lsq_f) (work): 13.357858                   |
| target function (twin_lsq_f) not normalized (work): 1031039.604378          |
| target function (twin_lsq_f) not normalized (free): 63194.344064            |
| twin fraction: 0.50  twin operator: k,h,-l                                  |
|-----------------------------------------------------------------------------|

Deep_copied fmodel with original fmodel_ts1:
|--(resolution: 1.93 - 27.61 A, n_refl.=78018 (all), 4.67  % free)------------|
|                                                                             |
| r_work= 0.1940 r_free= 0.2411 coordinate error (max.-lik. estimate): None A |
|                                                                             |
| normalized target function (twin_lsq_f) (work): 13.357858                   |
| target function (twin_lsq_f) not normalized (work): 1031039.604378          |
| target function (twin_lsq_f) not normalized (free): 63194.344064            |
| twin fraction: 0.50  twin operator: k,h,-l                                  |
|-----------------------------------------------------------------------------|

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions