schrodinger.utils.cgxutils module

exception schrodinger.utils.cgxutils.SerializationError

Bases: Exception

schrodinger.utils.cgxutils.serialize_conformations(conformations)

Converts conformations into numpy.ndarray instance.

Parameters

conformations (Iterable of iterables.) – Iterable over conformations. Each conformation must be an iterable with two elements (energy, coordinates). The “energy” must be convertible to float and “coordinates” must be a numpy.ndarray of shape (natoms, 3). Number of the “coordinates” must be the same for all “conformations”.

Returns

Serialized conformations.

Return type

numpy.ndarray

schrodinger.utils.cgxutils.deserialize_conformations(data)

Does the opposite of serialize_conformations: converts array of floats (buffer) into a list of conformations.

Parameters

data (buffer) – Serialized conformations.

Returns

List of conformations.

Return type

list((float, numpy.ndarray))

class schrodinger.utils.cgxutils.FragmentLibrary(filename)

Bases: object

Encapsulates access to CGX fragment library (SQLite3 file).

__init__(filename)

Opens existing library, or creates new one if filename does not exist.

Parameters

filename (str) – File name.

close()
__contains__(smiles)
__len__()
iteritems()
schrodinger.utils.cgxutils.recompute_stereo(st)
schrodinger.utils.cgxutils.has_undefined_stereo(st, logger)

Extracts and parses mmstereo properties (s_st), return True if there is an undefined (labelled as ‘?’) chirality or cis/trans.

Parameters

st (schrodinger.Structure) – Structure

schrodinger.utils.cgxutils.chop(engine, st, logger=None, i_f3d_origin='i_f3d_origin')

Chops structure into ConfGenX fragments (side effect: modifies atom properties of the input structure).

Parameters
  • engine (schrodinger.infra.fast3d.Engine) – Fast3D engine.

  • st (schrodinger.Structure) – Structure (may include several molecules).

  • i_f3d_origin (str) – Name of the atom property to keep track of the original atom indices.

Returns

List of fragments.

Return type

list(schrodinger.Structure)

schrodinger.utils.cgxutils.is_builtin_fragment(smiles)

Checks whether the smiles is for one of the “built-in” fragments.

schrodinger.utils.cgxutils.uniquesmiler()

Returns unique SMILES generator.

All present hydrogens will be explicit, but no H will be added to the input

schrodinger.utils.cgxutils.read_structures_as_conformations(source, energy_property, logger=None, engine=None)

Gets structures from file/generator, chops them into fragments. Skips the ones that have more than one fragment. Gathers conformations of the “elementary” (indivisible) fragments into a dictionary keyed by unique SMILES.

Parameters
  • source (str or generator) – Structure file name or generator of structures.

  • energy_property (str) – Name of the “energy” CT-level property (required).

  • logger (log.Logger) – Logger (can be None).

  • engine (schrodinger.infra.fast3d.Engine) – Fast3D engine (can be None).

schrodinger.utils.cgxutils.default_custom_fraglib()

Path to the custom fragments library that is to be used by default.