schrodinger.comparison.neighbors module

methods for handling neighbors with ase

class schrodinger.comparison.neighbors.MoleculeNeighbor(molecule_number, ix, iy, iz)

Bases: tuple

ix

Alias for field number 1

iy

Alias for field number 2

iz

Alias for field number 3

molecule_number

Alias for field number 0

schrodinger.comparison.neighbors.com_cell_atoms(st, unit_cell, symbol='C')

Construct an Atoms instance where each atom represents the COM of a molecule in st

params:

st (Structure): the input crystal unit_cell (3x3 np.array): lattice vectors are rows symbol (str): symbol for each atom in COM cell

returns:

An Atoms instance that gives the COM cell

schrodinger.comparison.neighbors.spherical_cluster(st, Rcut)

Construct a spherical cluster of radius Rcut about each molecules center of mass in st. The Nth value of the generator is centered about the Nth molecule.

params:

st (Structure): represents the conventional cell unit_cell (3x3 np.array): lattice vectors as rows Rcut (float): cutoff for including molecules

returns:

Generator of clusters

schrodinger.comparison.neighbors.spherical_atomic_cluster(st: Structure, Rcut: float, center_idx=1)

Construct a cluster of neighbors centered about the center_idx’th molecule. This implementation includes any molecule that has any atom inside the cutoff radius with respect to the central molecule.

Parameters:
  • st – represents the conventional cell

  • Rcut – cutoff for including molecules

  • center_idx – molecule index for the spherical cluster center

schrodinger.comparison.neighbors.search_cluster_radius(st, Ncluster_min=25, Ncluster_max=35, r=4.0, cluster_at_r=None, dRthresh=0.01, center_idx=1) Tuple[Structure, float]

Search for a cluster radius that gives a spherical cluster of a certain size. If a cluster that satisfies the limits is not found a RuntimeError.

Parameters:
  • st (Structure) – the crystal

  • Ncluster_min (int) – minimum number of molecules in cluster

  • Ncluster_max (int) – maximum number of molecules in cluster

  • r (float) – radius to start search

  • cluster_at_r (Optional[Structure]) – the cluster produced by spherical_atomic_cluster at radius r

  • Rthresh (float) – stop search if we can’t find Ncluster_min < N < Ncluster_max within precision dRthresh

Returns:

tuple of Structure, radius

schrodinger.comparison.neighbors.preprocess_st(st: Structure, *, remove_hydrogens=True, remove_asl='water', copy=False) Structure

Return preprocessed structure

schrodinger.comparison.neighbors.prepare_data(st: Structure, is_spherical_cluster=False, remove_hydrogens=True, remove_asl='water', copy=False, min_molecules=25, max_molecules=35, zprime2=False, regenerate_unitcell=False)

Return processed spherical clusters for st

schrodinger.comparison.neighbors.get_spherical_cluster_RMSDn(st: Structure, ref: Structure, matching_cutoff: float = 2, matched_cutoff=15, align_cluster=True, include_H=False, renumber_rmsd_thresh=0.8, allow_reflection=True, pg_symmetry_ops=(), n_thresh: int = 20, zprime2: bool = False) Tuple[int, float, Structure]

Return number of molecules matched, their RMSD, and the aligned st with respect to ref. The st and ref are assumed to be spherical clusters centered about the first molecule.

Parameters:
  • st – test Structure to align

  • ref – reference Structure (unmoved)

  • matching_cutoff – If the centroid of a molecule is within the radius of another molecule from a different cluster, it is considered as matched.

  • matched_cutoff – If the number of matched centroids is less than this number, abort further computation

  • align_cluster – If not set, only align on the central molecules, i.e., the first molecules of the input structures; otherwise further align on all molecules

  • include_H – if False using heavy atom rmsd, else use all atom rmsd

  • renumber_rmsd_thresh – only attempt atom renumber if rmsd for 1st molecule is greater than this

  • allow_reflection – whether or not to allow reflection when optimizing rmsd in scoring method

  • pg_symmetry_ops – iterable of SymmOp instances, each representing a point group symmetry operation. If the iterable is not empty each operation is applied to the test cluster RMSD N analysis is performed. The best RMSD N is returned.

  • n_thresh – Centroid threshold for comparing spherical cluster alignments on the basis of RMSD only.

  • zprime2 – Flag to align Z’=2 crystals; if False, assume all molecules equivalent

Returns:

three-tuple: N matched, rmsd of match, st after renumbering/alignment A new structure is returned

schrodinger.comparison.neighbors.get_centroid_RMSDn(st: Structure, ref: Structure, matching_cutoff: float = 2, matched_cutoff=15, allow_reflection=True, n_maybe=5, n_nb=3, parity_seen=None) Iterator[Tuple[int, float, Structure]]

Return number of molecules matched, their RMSD, and the aligned st with respect to ref. The st and ref are assumed to be spherical clusters centered about the first molecule.

Parameters:
  • n_maybe – number of small radius centroids for maybe-inlier test

  • n_nb – number of neighboring centroids (besides the central one) for maybe-inlier test

  • parity_seen – Only attempt centroid alignment if the corresponding parity has not been tried (proper or improper rotations)

schrodinger.comparison.neighbors.run_centroid_rmsdn_then_spherical_rmsdn(test_cluster, ref_cluster, matching_cutoff=2, matched_cutoff=15, allow_reflection=True, renumber_rmsd_thresh=0.5, align_cluster=True, pg_symmetry_ops=(), n_thresh: int = 20)

Return atomic spherical RMSDn and the corresponding aligned cluster from running centroid RMSDn and atomic RMSDn sequentially.

See struc.py::get_spherical_cluster_RMSDn for full argument docs

Parameters:
  • matching_cutoff – If the centroid of a molecule is within the radius of another molecule from a different cluster, it is considered as matched.

  • matched_cutoff – If the number of matched centroids is less than this number, abort further computation

  • n_thresh – Centroid threshold for comparing spherical cluster alignments on the basis of RMSD only.

  • zprime2 – Flag to align Z’=2 crystals; if False, assume all molecules equivalent

schrodinger.comparison.neighbors.compute_rmsdn(test_data: List[Structure], ref_data: List[Structure], use_point_group_symmetry=False, skip_centroid_rmsdn=False, matching_cutoff=2, matched_cutoff=15, renumber_rmsd_thresh=0.5, align_cluster=False, allow_reflection=True, n_thresh: int = 20) Tuple[int, float, Structure]

Here both test_data and ref_data correspond to 1 crystal structure. They don’t need to have the same Z’ value.

See struc.py::get_spherical_cluster_RMSDn for full keyword argument docs