schrodinger.application.mlff.utils module

MLFF utils.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.mlff.utils.get_env_mlff_data()

Get MLFF data from the environment.

Return type:

str

Returns:

SCHRODINGER_MLFF_DATA env value

schrodinger.application.mlff.utils.get_model_name_from_path(model_dir)

Get model name from model directory path.

Parameters:

model_dir (str) – Root directory for MLFF models

Return type:

str

Returns:

MLFF model name from directory

schrodinger.application.mlff.utils.create_mlff_model_type(model_name=None, model_dir=None)

Create MlffModelType object from model name.

Parameters:
  • model_name (str) – MLFF model name

  • model_dir (str or None) – Root directory for MLFF models. If None, default directory will be used.

Return type:

bool, MlffModelType or str

Returns:

True and created MlffModelType object if successful, False and error message on failure

schrodinger.application.mlff.utils.create_custom_mlff_model_type(model_dir)

Create an MLFF model type for a custom model directory.

If SCHRODINGER_MLFF_DATA is set, it is used as the model source. The requested model directory is still used to verify that the requested model name matches the environment model.

Parameters:

model_dir (str) – Custom model directory requested by the caller

Return type:

bool, MlffModelType or str

Returns:

True and created MlffModelType on success, False and error message on failure

schrodinger.application.mlff.utils.is_official_modeltype(model)

Return whether the model type is an official (non-custom) MLFF model.

Parameters:

model (MlffModelType) – MLFF model type to check

Return type:

bool

Returns:

True if the model type string is among the official model types

schrodinger.application.mlff.utils.get_jaguar_no_pbc_models()

Get list of MLFF Jaguar models that are not compatible with PBC.

Return type:

list[str]

Returns:

Sorted list of MLFF Jaguar models not compatible with PBC

schrodinger.application.mlff.utils.set_pytorch_threads(num_threads)

Context manager to set PyTorch thread count, preventing CPU oversubscription.

Parameters:

num_threads (int) – Number of threads to use