schrodinger.application.matsci.maestrocmds module

Common Maestro commands.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.maestrocmds.get_colors(palette=None, seed=None, n_colors=10, normalized=False)

Return RGB color tuples.

Parameters
  • palette (str) – if not a palette in PALETTES then this is the palette kwarg passed to seaborn.color_palette

  • seed (None or int) – if given randomize the RGB color tuples using the given seed

  • n_colors (int) – the number of colors to return

  • normalized (bool) – whether to normalize the RGB tuples

Return type

list

Returns

contains RGB color tuples

schrodinger.application.matsci.maestrocmds.normalize_rgb_color(rgb)

Normalize the given color.

Parameters

rgb (tuple) – an RGB triple of integers in [0, 255]

Return type

tuple

Returns

normalized RGB triple of floats in [0, 1]

schrodinger.application.matsci.maestrocmds.get_atoms_asl(idxs)

Return the atoms ASL.

Parameters

idxs (list(int)) – atom indices

Return type

str

Returns

the atoms ASL

schrodinger.application.matsci.maestrocmds.execute_cmd(cmd)

Execute the Maestro command.

Parameters

cmd (str) – the Maestro command

schrodinger.application.matsci.maestrocmds.color_atoms(rgb, idxs)

Color atoms in the Maestro WS.

Parameters
  • rgb (tuple) – an RGB triple of integers in [0, 255]

  • idxs (list(int)) – atom indices

schrodinger.application.matsci.maestrocmds.color_atom_groups(all_idxs, rgbs=None)

Color groups of atoms in the Maestro WS.

Parameters
  • all_idxs (list(list(int))) – groups of atom indices

  • rgbs (list(tuple) or None) – RGB triples of integers in [0, 255] for coloring the different groups of atoms, if None then some defaults colors are used

schrodinger.application.matsci.maestrocmds.select_all_atoms()

Context manager to temporarily select all atoms in the Maestro WS.

schrodinger.application.matsci.maestrocmds.select_atoms(index)

Select specified atoms in Maestro WS

Parameters

index (list) – list of atom indexes

schrodinger.application.matsci.maestrocmds.color_by_element()

Color all atoms in the Maestro WS by element.

schrodinger.application.matsci.maestrocmds.set_ballnstick_repr(idxs)

Set the representation of atoms in the Maestro WS to ball-and-stick.

Parameters

idxs (list(int)) – atom indices

schrodinger.application.matsci.maestrocmds.set_included(entry_id)

Set the included entry to that of the given entry ID.

Parameters

entry_id (str) – the entry ID

schrodinger.application.matsci.maestrocmds.ensure_project_entry(struct, groupname, ptable=None, include_and_sort=False, sorting_prop=None)

Find if the structure entry exists in the project table’s group named groupname, if not create a new entry in this group. Then optionally sort the group and include/select the structure using the sorting property name.

Parameters
  • struct (structure.Structure) – The structure to ensure is in the project

  • groupname (str) – The name of the group to add the structure to

  • ptable (project.Project) – The project table

  • include_and_sort (bool) – If True, include and select the entry and sort the PT group it is in by sorting_prop. Default is False.

  • sorting_prop (str) – The structure property name used to sort the entries

Return type

project.ProjectRow

Returns

The project row for the entry

schrodinger.application.matsci.maestrocmds.sort_group_include_row(groupname, row, sorting_prop, ptable=None)

Sort the given project group by iteration number and then select/include the given row

Parameters
  • groupname (str) – The name of the group to sort

  • row (project.ProjectRow) – The project row of the entry to include

  • sorting_prop (str) – The property name used to sort the entries. If None, group sorting will be skipped.

  • ptable (project.Project) – The project table

schrodinger.application.matsci.maestrocmds.add_miller_plane(hkl, vecs, scaled_vecs=None, min_plane=0, max_plane=1, color=(255, 0, 0), opacity=75, show_arrow=True, entry_id=None, origin=None, draw_location=0, thickness=1, also_draw_planes_behind=True)

Make plane and arrow graphics of a Miller plane and lattice vectors.

Parameters
  • hkl (list[int]) – Miller triple hkl (example: [1,2,1])

  • vecs (list[float]) – Lattice vectors (A)

  • scaled_vecs (list[float]) – Scaled lattice vectors (A) that presumably fit all the planes. If not provide, vecs will be used. See related any_polygons_outside_cell function

  • min_plane (int) – Minimum plane to draw

  • max_plane (int) – Minimum plane to draw

  • color (tuple[int]) – Plane color in RGB

  • opacity (float) – Plane opacity

  • show_arrow (bool) – Whether to show plane normal as an arrow

  • entry_id (str) – Project table entry ID, plane and arrow are associated with

  • origin (list[float]) – Origin (A)

  • draw_location (float) – Shift from the origin in dHKL units

  • thickness (float) – Thickness in the dHKL units

  • also_draw_planes_behind (bool) – Whether to draw planes behind the cell

Return type

xtal.CrystalPlane, maestro.common.Group or None

Returns

Plane and graphics or None on error

schrodinger.application.matsci.maestrocmds.any_polygons_outside_cell(group)

Given a maestro graphics group, check if there are any polygons outside of it. This function is related to add_miller_plane above.

Parameters

group (maestro.common.Group) – Group to check

Return type

bool

Returns

Whether there are any polygons outside the cell

schrodinger.application.matsci.maestrocmds.undoblock_cm(maestro)

Wrap between maestro beginundoblock and endundoblock commands.

Parameters

maestro (maestro) – Maestro instance

schrodinger.application.matsci.maestrocmds.delete_group(maestro, group_name, with_undo=True)

Delete group by name using maestro. Optionally provide undo functionality.

Parameters
  • maestro (maestro) – Input maestro

  • group_name (str) – Group name

  • with_undo (bool) – Whether to wrap in undo block

schrodinger.application.matsci.maestrocmds.build_crystal(struct, cov_offset=0.4, translate=1, bonding=1, bond_orders=1, ncella=1, ncellb=1, ncellc=1, translate_centroids=0, ignore_valence=0)

Build crystal structure of asymmetric unit read from input file.

The output crystal structure is written to a file named ‘crystal-’ + input_file_name.

If there is no crystal symmetry information available in the read structure, this function will raise AttributeError exception. This should not normally happen since the caller is supposed to check for the presence of these properties.

Parameters
  • input_file_name (str) – Name of input Maestro file.

  • covalent_offset (float) – Covalent radius offset used in bond computation.

  • translate (int) – If 1, translate all atoms to the first cell

  • bonding (int) – If 1, re-bond the system, otherwise use as is

  • bond_orders (int) – If 1, reset the bond orders of the system, otherwise use as is

  • ncella (int) – Extents along a

  • ncellb (int) – Extents along b

  • ncellc (int) – Extents along c

  • translate_centroids (int) – If 1, after the cell is built, entire molecules are moved into the first cell. Cannot be used together with translate

  • ignore_valence (int) – If 1, use infra MAX_BONDS for valency exceptions, for 0 use default

Return type

bool

Returns

True on success, False otherwise.