Solve atoms with alternate locations#

Resolving alternate crystallographic atom locations in a molecular system.

The function molsysmt.build.solve_atoms_with_alternate_locations() resolves crystallographic alternate conformations by selecting a specific alternate location identifier (e.g. 'A', 'B', or the conformation with highest 'occupancy').

Added in version 1.0.0.

Basic usage#

Let’s show how this function works using bundled PDB file 1BNF:

import molsysmt as msm
from importlib.resources import files
pdb_filename = str(files('molsysmt.data.pdb').joinpath('1bnf.pdb'))
molsys = msm.convert(pdb_filename, to_form='molsysmt.MolSys', get_missing_bonds=False)

Let’s inspect alternate location information for atom index 480 using molsysmt.basic.get():

msm.get(molsys, element='atom', selection='atom_index==480', alternate_location=True)
[{'480': {'location_id': array(['A', 'B'], dtype=object),
   'atom_id': ['481', '482'],
   'occupancy': array([0.5, 0.5]),
   'coordinates': <Quantity([[4.17   4.9768 4.186 ]
    [4.1655 4.9841 4.1835]], 'nanometer')>,
   'b_factor': <Quantity([0.2098 0.2083], 'nanometer ** 2')>}}]

Now we set all alternate locations to location ID 'B' using molsysmt.build.solve_atoms_with_alternate_locations():

msm.build.solve_atoms_with_alternate_location(molsys, location_id='B')
msm.get(molsys, element='atom', selection=480, atom_id=True, coordinates=True)
[['482'], <Quantity([[[4.1655 4.9841 4.1835]]], 'nanometer')>]

Resolving by maximum occupancy#

Setting location_id='occupancy' automatically selects the conformation with the highest crystallographic occupancy for every alternate atom:

molsys_occ = msm.convert(pdb_filename, to_form='molsysmt.MolSys', get_missing_bonds=False)
msm.build.solve_atoms_with_alternate_location(molsys_occ, location_id='occupancy')
msm.get(molsys_occ, element='atom', selection=480, atom_id=True, coordinates=True)
[['481'], <Quantity([[[4.17   4.9768 4.186 ]]], 'nanometer')>]

Warning

Alternate location metadata preservation Native PDB file, PDB text, and molsysmt.MolSys forms retain alternate location metadata. When converting to third-party formats (such as MDAnalysis or OpenMM), alternate locations may be collapsed to the default conformer.