def jumpfix(sel, **kwargs):
    '''
    Function passed to the Fasu object that provides the possibility
    to fix PBC box jumps. The method is not foolproof, but often works.
    '''
    from MDAnalysis.coordinates.core import triclinic_vectors
    all = sel.selectAtoms('name *')
    cen = sel.selectAtoms(kwargs['centre'])
    shift = triclinic_vectors(cen.dimensions).diagonal()/2 - cen.centerOfGeometry()
#    shift = all.bbox(pbc=True)[1]/2 - cen.centerOfGeometry()
    all.translate(shift)
    all.packIntoBox()
    return all
Example #2
0
 def dimensions(self, box):
     x, y, z = triclinic_vectors(box)
     cell = {'x': x, 'y': y, 'z': z}
     self._unitcell = cell
Example #3
0
 def convert_dimensions_to_unitcell(self, ts):
     """Read dimensions from timestep *ts* and return Gromacs box vectors"""
     return self.convert_pos_to_native(triclinic_vectors(ts.dimensions))
Example #4
0
 def dimensions(self, box):
     self._unitcell = triclinic_vectors(box)
Example #5
0
 def dimensions(self, box):
     self._unitcell = triclinic_vectors(box)
Example #6
0
 def dimensions(self, box):
     x, y, z = triclinic_vectors(box)
     cell = {'x': x, 'y': y, 'z': z}
     self._unitcell = cell
Example #7
0
 def dimensions(self, box):
     x, y, z = triclinic_vectors(box)
     numpy.put(self._unitcell, self._ts_order_x, x)
     numpy.put(self._unitcell, self._ts_order_y, y)
     numpy.put(self._unitcell, self._ts_order_z, z)