schrodinger.comparison.struc module

schrodinger.comparison.struc.chorus_to_lower_triangle(struct)

Update chorus properties and with them atom coordinates so that upper triangle of the lattice vectors are all zeros. This is needed so that maestro displays structure correctly.

Parameters

struct (structure.Structure) – Structure to update

Return type

structure.Structure

Returns

Updated structure (not a copy!!)

schrodinger.comparison.struc.atom_indices_are_contiguous(st: schrodinger.structure._structure.Structure) bool

Determine if atom indices of each molecule are contiguous. This is to guard against DFT making hydrogen transfers.

schrodinger.comparison.struc.get_pymatgen_mol(ct)
schrodinger.comparison.struc.get_pointgroup_symmetry_ops(st, mol_index=1, include_H=False)

Determine point group symmetry ops using pymatgen. These symmetry operations are given at the origin.

Parameters
  • st – Structure

  • mol_index – index of molecule to perform point group analysis on assumed to be the ASU

  • include_H – if True include hydrogens

Returns

list of SymmOp instances representing symmetry operations

schrodinger.comparison.struc.rotate_pointgroup_symmetry_ops(symmetry_ops, U)

transform point group symmetry ops due to a rotation of the molecule for which the symmetry operations belong

Parameters
  • symmetry_ops – list of SymmOp

  • U – 3x3 unitary transformation

Returns

list of SymmOp

schrodinger.comparison.struc.apply_pointgroup_symmetry_op(op, st, asu_atom_indices)

apply point group symmetry operation to structure This will translate the asu (assumed to be the first molecule) to the origin, apply the symmetry operation and translate back

Parameters
  • op – SymmOp

  • st – Structure to transform

  • asu_atom_indices – list of atom indices of the asu

Returns

transformed cartesian coordinates

schrodinger.comparison.struc.get_op_trans_idx(op, st, asu_atom_indices)

calculates the transformation of indices that occurs under the application of the given symmetry operation

Parameters
  • op – SymmOp

  • st – Structure to transform

  • asu_atom_indices – list of atom indices of the asu

Returns

transformed cartesian coordinates

schrodinger.comparison.struc.is_better_match(n_matched, rmsd, best_n, best_rmsd, n_thresh=20)

Is a new rmsd N better?

When matched molecules are greater than n_thresh, focus on the rmsd improvement only.

schrodinger.comparison.struc.center_com(st: schrodinger.structure._structure.Structure)

Move center of mass to origin.

schrodinger.comparison.struc.estimate_size(st: schrodinger.structure._structure.Structure) float

Return the largest projection along its principal directions

schrodinger.comparison.struc.get_bbox_vectors(st: schrodinger.structure._structure.Structure, make_isometric=False) numpy.ndarray

Return basis vectors of a bounding box for the input structure. Their lengths correspond to the st dimension along these directions. The moment of inertia eigenvalues are in ascending order.

Parameters

st – The input structure should have its center of mass at origin.

schrodinger.comparison.struc.align_st_by_mol(st: schrodinger.structure._structure.Structure, st_indices: numpy.ndarray, ref_st: schrodinger.structure._structure.Structure, ref_indices: numpy.ndarray, allow_reflection=False) Tuple[numpy.ndarray, numpy.ndarray]

Transform st such that its molecule mol_id is aligned to molecule ref_mol_id in ref_st. Only heavy atoms are considered.

Parameters
  • st – test structure to align

  • st_indices – list of atom indices to align (zero based)

  • ref_st – reference structure to align on

  • ref_indices – list of atom indices to align on (zero based)

  • allow_reflection – allow improper rotations in alignment

Returns

translation vector and rotation matrix for the alignment

schrodinger.comparison.struc.get_RMSDn(st: schrodinger.structure._structure.Structure, ref: schrodinger.structure._structure.Structure, matching_cutoff: float = 2, with_alignment=True, allow_reflection=True) Tuple[int, float, Tuple[int, int]]

Return number of matched molecules matched and their RMSD. The input cluster st0 will be aligned with respect to ref as side effect,

Parameters

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

schrodinger.comparison.struc.reorder_cluster_atoms(st, ref, allow_reflection, align=True, use_chirality=False) schrodinger.structure._structure.Structure

Re-order atoms in st to match ref according to alignment. New order is generated by matching the first molecule in st and ref and applied to all other molecules in st.

Parameters
  • st – Structure to re-order atoms of

  • ref – Reference Structure

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

  • align – if True align for rmsd in scoring atom maps

Returns

the renumbered structure

schrodinger.comparison.struc.reorder_zprime2_cluster(st: schrodinger.structure._structure.Structure) schrodinger.structure._structure.Structure

Ensure that when the conformation of A and B are close, they would have the same atom orderings.

It (probably) will error out if A and B are different tautamers.

Assumptions: 1. All AB pair are contiguous with the same ordering 2. A atoms and B atoms separated 3. The first 2 molecules are A and B

These assumptions could be false for DFT output

schrodinger.comparison.struc.align_zprime2_asu(AB: schrodinger.structure._structure.Structure, ref_AB: schrodinger.structure._structure.Structure, align_on_A=False) schrodinger.structure._structure.Structure

align AB to ref_AB

precondition: the atom indices in AB and ref_AB are already reordered

schrodinger.comparison.struc.resolve_conflict(test: List[int], ref: List[int]) Iterator[Tuple[numpy.ndarray, numpy.ndarray]]

Return all valid mappings even if ref has repeats

schrodinger.comparison.struc.get_mappings(choices: Dict[int, List[int]]) Iterator[Tuple[List[int], List[int]]]

Return mappings without duplicates in values

schrodinger.comparison.struc.get_xyz_matches(xyz1: numpy.ndarray, xyz2: numpy.ndarray, matching_cutoff, matched_cutoff) Iterator[Tuple[List[int], List[int]]]

Yield coordinates mappings

schrodinger.comparison.struc.get_xyz_RMSDn(xyz1: numpy.ndarray, xyz2: numpy.ndarray, matching_cutoff: float = 2, matched_cutoff=15) Tuple[int, float]

Return number of matched coordinates, and sum of square differences

schrodinger.comparison.struc.get_potential_alignment(centroids1, centroids2, rdv1, rdv2, match_thresh, n_max=5) Iterator[numpy.ndarray]

Return potential alignment

Parameters

n_max – max number of centroids for alignment check, in addition to the origin

schrodinger.comparison.struc.get_centroid_RMSDn(st: schrodinger.structure._structure.Structure, ref: schrodinger.structure._structure.Structure, matching_cutoff: float = 2, matched_cutoff=15, allow_reflection=True, n_maybe=5, n_nb=3, parity_seen=None) Iterator[Tuple[int, float, schrodinger.structure._structure.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.struc.get_spherical_cluster_RMSDn(st: schrodinger.structure._structure.Structure, ref: schrodinger.structure._structure.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=()) Tuple[int, float, schrodinger.structure._structure.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.

Returns

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

schrodinger.comparison.struc.load_cif(fname: str, neutralize=True, mmjag=True) schrodinger.structure._structure.Structure
Parameters

fname – input file name

schrodinger.comparison.struc.replicate(st: schrodinger.structure._structure.Structure, multiplicity: Union[int, fractions.Fraction], copy_cc=True) schrodinger.structure._structure.Structure

Replicate structure with integer or fractional multiples.

Parameters
  • multiplicity – number of st in the returned structure

  • copy_cc – copy over custom charge if True

schrodinger.comparison.struc.get_niggli_params(lattice_params: List[float]) List[float]

Niggli reduction of the lattice parameters (a, b, c, alpha, beta, gamma)

schrodinger.comparison.struc.get_standard_cell(cell: schrodinger.structure._structure.Structure, to_primitive=False, no_idealize=False, symprec=1e-05) schrodinger.structure._structure.Structure

Fix skewed cell definition Note the new structure won’t carry over bonding information (reassigned), or any CT and atom level properties.

Parameters
  • symprec – distance tolerance in Cartesian coordinates

  • no_idealize – whether to idealize cell lengths and angles according to crystal symmetry

schrodinger.comparison.struc.niggli_reduce_cell(cell: schrodinger.structure._structure.Structure) schrodinger.structure._structure.Structure

Transform cell with Niggli reduced lattice parameters. Note the new cell may not be in the original space group. It seems only to make sense for triclinic lattices (space groups).

schrodinger.comparison.struc.get_cell_fast(st: schrodinger.structure._structure.Structure, symm_ops: Tuple[numpy.ndarray], lattice_params: Optional[Tuple[float]] = None, copy_cc=True, extents: Tuple[int, ...] = (1, 1, 1), asu_input=False, asu_template=None) schrodinger.structure._structure.Structure

The first molecule in st is used as ASU. Supercell box and unit cell lattice parameters are stored in the output structure.

Parameters
  • st – Its first molecule is ASU

  • symm_ops – Each symmetry operator is a 4x4 numpy array

  • lattice_params – if None, read from CT level properties of st

  • copy_cc – copy custom charge to the supercell if set

  • extents – 3D extension of the unit cell

  • asu_input – If False, extract ASU

  • asu_template – ASU template

schrodinger.comparison.struc.apply_symmetries(st: schrodinger.structure._structure.Structure, vecs: List[numpy.array], spg_name: str = '', symm_ops: List[numpy.ndarray] = None)

in-place

Parameters

vecs – a, b, c vectors

schrodinger.comparison.struc.has_clash(cell, cutoff=0.7, use_pbc=True) bool

Clash detection

Maestro preferences: ugly is <0.75, bad is <0.89, and good is <1.3

Here cutoff := d_{ab} / (R_a + R_b)

schrodinger.comparison.struc.extract_supercell(r: schrodinger.comparison.results.OptResult, spg_name: str, extents=(1, 1, 1), copy_cc=True, asu_template=None) schrodinger.structure._structure.Structure

Extract supercell from packing search result.

Parameters
  • r – packing search result

  • spg_name – space group name

  • copy_cc – copy over custom charge if True

  • extents – 3D extension of the unit cell

  • asu_template – example of ASU

schrodinger.comparison.struc.get_inscribe_extents(lattice_params: List[float], d: float) numpy.array

Return supercell extents to inscribe a sphere of diameter d.

Parameters
  • lattice_params – a, b, c, alpha, beta, gamma

  • d – diameter

schrodinger.comparison.struc.get_ASU_RMSD(st1: schrodinger.structure._structure.Structure, st2: schrodinger.structure._structure.Structure, *, allow_improper_rotation=True, include_H=False, include_polar_H=True, reorder_atoms=True) Tuple[float, schrodinger.structure._structure.Structure]

Return RMSD between st1 and st2 and aligned st1, with potential atom index rearrangement. Here st2 is used as reference.

schrodinger.comparison.struc.get_volume_and_density(st: schrodinger.structure._structure.Structure, vecs=None) Tuple[float, float]

Return density in unit of g/cm^-3. The input st should be a supercell.

schrodinger.comparison.struc.is_chiral(st: schrodinger.structure._structure.Structure) bool
schrodinger.comparison.struc.get_conformer_radial_distance_vector(st: schrodinger.structure._structure.Structure) Tuple[numpy.ndarray, numpy.ndarray]

Return heavy atom coordinates. Origin is set at centroid

schrodinger.comparison.struc.get_centroid_radial_distance_vector(cluster: schrodinger.structure._structure.Structure, include_H=False, mol_aids=None) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Return the RDV of the centroids, the centroids excluding the 1st molecule, and the alignment vector (including the 1st molecule) in sorted ordering of RDV.

Origin is set at the centroid of the 1st molecules.

The alignment vector is nx N_ATOMS_CENTROID_ALIGNMENT x3 where n is the number of molecules (we should change it to ASU). For each ASU, it includes the coordinates of the centroid and two extra atoms (given N_ATOMS_CENTROID_ALIGNMENT is 3).

schrodinger.comparison.struc.get_torsion_atoms(a2: schrodinger.structure._structure.StructureAtom, a3: schrodinger.structure._structure.StructureAtom) Tuple[int, int, int, int]

Return the atom indices of a torsion angle

schrodinger.comparison.struc.get_torsions(st, indices=None) Tuple[numpy.ndarray, List]

Return torsion angles

schrodinger.comparison.struc.get_max_torsion_deviation(st1, st2, ref_tors=None)

The input structures should have the SAME AID ordering

schrodinger.comparison.struc.regenerate_with_box_fix(cell: schrodinger.structure._structure.Structure, old_ext: numpy.ndarray, symm_ops, new_ext=(1, 1, 1), asu_input=False) schrodinger.structure._structure.Structure

Regenerate supercell with potential box convention change

schrodinger.comparison.struc.remove_H_atoms(st: schrodinger.structure._structure.Structure) schrodinger.structure._structure.Structure

Return a structure without H atoms

schrodinger.comparison.struc.is_dilute(cell: schrodinger.structure._structure.Structure, asu_v: Optional[float] = None, packing_coeff_cutoff=0.6, density_cutoff=1.0) Tuple[bool, float]

Check packing_coeff if possible. Without asu_v, then check cell density

schrodinger.comparison.struc.get_asu_volume(idx: str, vfname: str) float
schrodinger.comparison.struc.get_radial_count(xyz, center: numpy.ndarray)
schrodinger.comparison.struc.is_close_packed(xyz, center: numpy.ndarray) bool
schrodinger.comparison.struc.asu_iter(supercell: schrodinger.structure._structure.Structure, n=None, asu_template: Optional[schrodinger.structure._structure.Structure] = None) Generator[schrodinger.structure._structure.Structure, None, None]

Yield ASUs in supercell

The caveat is that the supercell has to have ASU as chunks

Parameters
  • n – number of ASU copies in supercell

  • asu_template – asu template

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

Return preprocessed structure

schrodinger.comparison.struc.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=())

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 argument list

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

schrodinger.comparison.struc.extract_zprime2_asus(unitcell: schrodinger.structure._structure.Structure, dimer_distance: float = 3.5, save_homo_dimer: bool = False, inscribe_radius: int = 25)

extract ASU dimers from Z’=2 crystals

schrodinger.comparison.struc.swap_molecules(st, i: int, j: int) schrodinger.structure._structure.Structure

Swap the identity of two molecules in st.