[chimerax-users] How to display crystal packing?
Tristan Croll
tic20 at cam.ac.uk
Fri May 8 09:53:23 PDT 2020
This should do what you want (you'll need Clipper installed - also
ISOLDE if you choose to use the commented-out alternative option at the
bottom). Just copy the below script into a file called
make_unit_cells.py, open and select your model, then do:
run make_unit_cells.py num_u, num_v, num_w
... where num_u, num_v and num_w are the number of unit cells to pad by
along each dimension (i.e. 0 0 0 will give you a single unit cell, 1 1 1
will give you 3x3x3). Values greater than 1 are probably inadvisable.
I've put two options at the end of the script. The first (the one it's
currently set to use) uses the methods from ChimeraX's sym command,
which creates each copy as a separate model, in the new position but
otherwise identical (same chain ID). The other, commented-out option
uses an alternative from ISOLDE which will merge them into the *same*
model with new chain IDs - but be aware that this is not yet optimised
for performance (the time required blows out geometrically with the
number of copies - a couple of dozen is fine, but an attempt to make a
3x3x3 unit cells from a 300-residue model with 27 copies in the unit
cell - i.e. 729 ASUs - is at half an hour and counting). If you want to
use it, just comment these lines:
from chimerax.std_commands import sym
sym.show_symmetry([m], 'unit cells', Places(places), True, False,
False, None, None, m.session)
... and uncomment these ones:
# from chimerax.isolde.atomic.building.ncs import
create_all_ncs_copies
# create_all_ncs_copies(m, places)
# Script starts here
import sys
import numpy
args = sys.argv
if len(args) != 4:
from chimerax.core.errors import UserError
raise UserError('Arguments should be the number of unit cells to pad
by along each axis!')
padding = numpy.array([int(r) for r in args[1:]])
from chimerax.atomic import selected_atoms
m = selected_atoms(session).unique_structures[0]
def expand_to_unit_cells(m, padding):
min_bound = -padding
max_bound = padding
from chimerax.clipper.symmetry import (
symmetry_from_model_metadata, Unit_Cell
)
from chimerax.clipper import RTop_frac
cell, spacegroup, sampling, res, _ = symmetry_from_model_metadata(m)
uc = Unit_Cell(m.atoms, cell, spacegroup, sampling)
from chimerax.geometry import Places, Place
uc_symops = uc.symops
from chimerax.geometry import Place, Places
places = []
from chimerax.clipper import Coord_frac
for du in range(min_bound[0], max_bound[0]+1):
for dv in range(min_bound[1], max_bound[1]+1):
for dw in range(min_bound[2], max_bound[2]+1):
for s in uc_symops:
this_s = RTop_frac(s.rot,
s.trn+Coord_frac(du,dv,dw))
ts_orth = this_s.rtop_orth(cell)
places.append(Place(axes=ts_orth.rot.as_numpy().T,
origin=ts_orth.trn.as_numpy()))
print('Number of transforms: {}'.format(len(places)))
# This option is fast, but places each copy into a separate model
with the
# same chain ID as the original
from chimerax.std_commands import sym
sym.show_symmetry([m], 'unit cells', Places(places), True, False,
False, None, None, m.session)
# This method will merge the new chains into the current model with
new
# chain IDs, but currently gets *incredibly* slow if there are large
numbers
# of copies involved.
# from chimerax.isolde.atomic.building.ncs import
create_all_ncs_copies
# create_all_ncs_copies(m, places)
expand_to_unit_cells(m, padding)
On 2020-05-08 14:54, Tristan Croll wrote:
> The symmetry display in ISOLDE is actually provided by the Clipper
> plugin (which I’m also responsible for). It doesn’t currently have a
> built-in command to turn the symmetry views into real atoms, but it
> wouldn’t be particularly difficult to add that. Is actual copies of
> the molecules what you want? Or are instanced “ghost” copies of the
> main molecule sufficient?
>
>
>
>
>> On 8 May 2020, at 14:24, Guillaume Gaullier <guillaume at gaullier.org>
>> wrote:
>>
>> Hello,
>>
>> Today I was trying to display a crystal packing from a PDB entry in
>> ChimeraX, but could not find how to do this. I read the documentation
>> for the sym command
>> https://www.cgl.ucsf.edu/chimerax/docs/user/commands/sym.html ; but
>> either I didn’t get it, or this is not the adequate command for what I
>> am trying to do.
>>
>> What I want to do is the equivalent of PyMOL’s "Action / generate /
>> symmetry mates / +/- one unit cell and within… Å", which is different
>> from the biological assembly the sym command can generate from the PDB
>> annotation. When working with crystallographic data, ISOLDE displays
>> molecules related to the working model by crystallographic symmetry,
>> so displaying the crystal packing seems doable in ChimeraX. Or is it
>> one of ISOLDE’s additions?
>>
>> It would be wonderful if someone could help me with this (it is one of
>> the last few things I need on a regular basis, that I still don’t know
>> how to do in ChimeraX).
>>
>> Thank you in advance,
>>
>> Guillaume
>>
>>
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
>> http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
More information about the ChimeraX-users
mailing list