Skip to content

Commit

Permalink
New function of GRM to accomodate shifting coordinates for us and ext…
Browse files Browse the repository at this point in the history
…ernal forcefields.
  • Loading branch information
olegsobolev committed Dec 21, 2018
1 parent ea7bf29 commit cc21afc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions cctbx/geometry_restraints/base_geometry.py
Expand Up @@ -60,6 +60,13 @@ def select(self, selection=None, iselection=None):
Given selection return manager only with selected atoms and restraints
"""
raise NotImplementedError
def shift_sites_cart(self, shift):
"""
Sometimes coordinates of the model are shifted (e.g. in boxing with map).
In case any element of restraints cares, do what is appropriate here.
"""
raise NotImplementedError

def discard_symmetry(self, new_unit_cell):
return self
def add_angles_in_place(self, additional_angle_proxies):
Expand Down
4 changes: 4 additions & 0 deletions cctbx/geometry_restraints/manager.py
Expand Up @@ -438,6 +438,10 @@ def get_n_seq():
result.set_source(source = self.get_source())
return result

def shift_sites_cart(self, shift):
# just a stub from RSR. Proper treatment can be implemented here.
self.remove_reference_coordinate_restraints_in_place()

def discard_symmetry(self, new_unit_cell):
assert self.site_symmetry_table is not None #XXX lazy
assert self.shell_sym_tables is not None #XXX lazy
Expand Down
9 changes: 1 addition & 8 deletions mmtbx/refinement/real_space/individual_sites.py
Expand Up @@ -344,15 +344,10 @@ def refine(self,
new_unit_cell = box.xray_structure_box.unit_cell()
geo_box = self.geometry_restraints_manager.select(box.selection)
geo_box = geo_box.discard_symmetry(new_unit_cell=new_unit_cell)
geo_box.remove_reference_coordinate_restraints_in_place() # disaster happens otherwise
geo_box.shift_sites_cart(box.shift_cart) # disaster happens otherwise
map_box = box.map_box
sites_cart_box = box.xray_structure_box.sites_cart()

# When using the Schrodinger force field, move the whole structure as the
# selected atoms are environment aware.
if geo_box.get_source() == 'SCHRODINGER':
geo_box.shift_cart(box.shift_cart)

rsr_simple_refiner = simple(
target_map = map_box,
selection = sel,
Expand All @@ -377,8 +372,6 @@ def refine(self,
iselection, sites_cart_refined)
self.xray_structure.set_sites_cart(sites_cart_moving)
self.sites_cart = self.xray_structure.sites_cart()
if geo_box.get_source() == 'SCHRODINGER':
geo_box.shift_cart(shift_back)
else: # NCS constraints are present
# select on xrs, grm, ncs_groups
grm = self.geometry_restraints_manager.select(selection)
Expand Down

0 comments on commit cc21afc

Please sign in to comment.