schrodinger.comparison.struc module¶
- schrodinger.comparison.struc.align_pos(pos, fit_pos, fit_ref_pos, weights=None, return_trans_rot=False, allow_improper_rotation=False, is_precentered=False)¶
Align
pos
using transformations (rotation and translation) derived from convertingfit_pos
tofit_ref_pos
. Weighted Kabsch algorithm is used to obtain the transformations.- Parameters
allow_improper_rotation – If not set, only proper rotation is allowed.
is_precentered (
bool
) –True
if all position arrays, i.e.,pos
,fit_pos
, andfit_ref_pos
, have been properly centered. Note thatpos
andfit_pos
should be centered to the origin with respect toweights
.
- Returns
aligned
pos
and optionally the transformation matrices ifreturn_trans_rot
is set to beTrue
- Return type
Nx3
numpy.ndarray
ifreturn_trans
is False. Otherwise (numpy.ndarray
, (1x3numpy.ndarray
, 3x3numpy.ndarray
)) where the 1x3 array is the translation vector, and the 3x3 array is the rotation matrix. The aligned position is calculated as numpy.dot(pos - trans_vec, rot_mat).
- schrodinger.comparison.struc.chorus_to_lower_triangle(struct)¶
Update chorus properties and with the 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
- 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
:return 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 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
0-based indices for coordinates after the transformation
- schrodinger.comparison.struc.is_better_match(n_matched, rmsd, best_n, best_rmsd, n_thresh=20)¶
is a new rmsd N better?
- schrodinger.comparison.struc.center_com(st: schrodinger.structure._structure.Structure)¶
Move center of mass to 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 moleculemol_id
is aligned to moleculeref_mol_id
inref_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.reorder_cluster_atoms(st, ref, allow_reflection, align_structures=True, use_chirality=False) schrodinger.structure._structure.Structure ¶
Re-order atoms in st to match ref. 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.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 toref
. 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 toref
. 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 ¶
- Parameters
multiplicity – number of
st
in the returned structurecopy_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.has_clash(cell, cutoff=0.5, 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.Result, 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] ¶
Return the RDV of the centroids and the centroids excluding the 1st molecule, in sorted ordering in terms RDV.
Origin is set at the centroid of the 1st molecules.
- 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)) 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: float) Tuple[bool, float] ¶
Check packing_coeff if possible. asu_v == 0 means it’s not available, then check cell density
- schrodinger.comparison.struc.get_asu_volume(idx: str, vfname: str) float ¶
- schrodinger.comparison.struc.asu_iter(supercell: schrodinger.structure._structure.Structure, n=None, asu_template: Optional[schrodinger.structure._structure.Structure] = None) schrodinger.structure._structure.Structure ¶
Yield ASUs in supercell
- 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.rotate_xyz(xyz: numpy.ndarray, w: numpy.ndarray) numpy.ndarray ¶
Rotate the input coordinates using axis-angle parametrization.
- Parameters
w – Rodrigues vectors in Radians