schrodinger.application.livedesign.ld_utils module

schrodinger.application.livedesign.ld_utils.get_sha1(file_path)

Return the SHA1 hash of a specified file. If no file path is provided, return None.

Parameters

file_path (str or None) – the path to a file, or None

Returns

the SHA1 hash of the file located at file_path, or None

Return type

str or None

schrodinger.application.livedesign.ld_utils.get_round_trip_hash(st, host: str) str

Return a hash of relevant structure and host data. This will be used to determine whether structures imported from LiveDesign can be exported back to LiveDesign using corporate ID (vs. structure) matching.

Parameters
  • st (structure.Structure) – a structure

  • host – the LiveDesign host wrt which the round-trip hash should be generated.

Returns

a hash value related to the provided structure

schrodinger.application.livedesign.ld_utils.apply_round_trip_hash(st, host)

Store a structure-dependent hash as a property on this structure.

See get_round_trip_hash() function for documentation of st and host arguments.

schrodinger.application.livedesign.ld_utils.st_matches_round_trip_hash(st, host)

Determine whether the supplied structure can be exported again using the stored “round-trip” corporate ID value.

This can only be done if
  1. The structure was originally imported from the same LD host that it

    is not being exported to.

  2. The SMILES/stereochemistry of the structure has not changed since

    being imported.

See get_round_trip_hash() function for documentation of st and host arguments.

Returns

whether the round trip hash value stored on this structure matches a newly-generated hash

Return type

bool

schrodinger.application.livedesign.ld_utils.get_properties(structures: List[schrodinger.structure._structure.Structure]) Set[str]

Get a set of all property names from the given structures

Parameters

structures – List of structures

Returns

Set of property names

schrodinger.application.livedesign.ld_utils.get_property_value(struct: schrodinger.structure._structure.Structure, prop_name: Optional[str]) str

Get the property value from the structure, for the given property name. If prop_name is None, return an empty string

Parameters
  • struct – Structure

  • prop_name – Property name

Returns

Property value or empty string

schrodinger.application.livedesign.ld_utils.get_sample_property_value(structures: List[schrodinger.structure._structure.Structure], prop_name: Optional[str]) Optional[Any]

Get the property value for the given prop_name, from the first structure in which prop_name exists. Return None if prop_name is None or prop_name doesn’t exist in any of the structures

Parameters
  • structures – List of structures

  • prop_name – Property name

Returns

Property value or None

schrodinger.application.livedesign.ld_utils.set_corp_id_properties(sts, corp_id_match_prop=None)

Set the corporate ID property for given structures. Uses match property if passed in, or default corp ID property if not.

Parameters
  • sts (list(structure.Structure)) – structures to set properties for

  • corp_id_match_prop (str | None) – Optional property to get corp ID

schrodinger.application.livedesign.ld_utils.safely_set_property(st, key, value)

Set a specified property on a structure. If the supplied value is None, delete the property if it is already defined on the structure if possible.

Raises

ValueError – if this function is asked to delete a permanent property, e.g. a structure title

Parameters
  • st (structure.Structure) – a structure

  • key (str) – a structure property key

  • value (bool or int or float or str or None) – the value to store in the structure property dictionary

schrodinger.application.livedesign.ld_utils.is_sd_dataname(dataname)
Parameters

dataname (str) – a structure property data name

Returns

whether the supplied dataname belongs to the “SD” family

Return type

bool

schrodinger.application.livedesign.ld_utils.get_properties_datanames_from_entry_data(entry_data) Set[str]

Get the property data names from the entry data

Parameters

entry_data (entry_types.BaseEntryData or None) – Entry data to get property data names from

Returns

Set of property data names

schrodinger.application.livedesign.ld_utils.get_source_file_path(st: schrodinger.structure._structure.Structure) str

Get the source file path of the given structure if it exists in the file system

Parameters

st – structure instance

Returns

path to the source file of the structure

Raises

ValueError – if the source file path is not found in the structure or in the file system

schrodinger.application.livedesign.ld_utils.get_trajectory_path(cms_file_path: str) str | None

Get the trajectory path associated with the given cms file

Parameters

cms_file_path – path to the cms file

Returns

path to the trajectory data

schrodinger.application.livedesign.ld_utils.write_trajectory_data(cms_file_path: str, traj_path: str, zip_file_path: str)

Write cms file and trajectory data as ‘.zip’ file

Parameters
  • cms_file_path – path to the cms file

  • traj_path – path to the trajectory data

  • zip_file_path – path where the zipped trajectory data will be written