schrodinger.utils.license module

Contains a class License that allows easy licensing of Python scripts

It is a violation of your software license agreement to modify the code in this module in any way.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.utils.license.License(license_type, num_tokens=1, version=None, force=False)

Bases: object

Class to allow easy licensing of Python scripts

It is a violation of your software license to modify this class in any way.

__init__(license_type, num_tokens=1, version=None, force=False)

Create a License object. License objects should be assigned to a variable that stays in scope for the duration the license token should be held. The accepted way to return a license token is by calling the checkin method of the license object, but the token will also be returned when the object is garbage collected.

  • license_type (module-level constant) – Module-level constant such as BIOLUMINATE_MAIN, BIOLUMINATE_SHARED, BIOLUMINATE_PROTEIN_DOCKING, MATERIALSCIENCE_MAIN

  • num_tokens (int) – The number of tokens to check out

  • version (int) – An integer value representing the product version. This is ten times the decimal value with the tenths digit, i.e. 93 for version 9.3. If not provided, the license type is looked up in the module constant DEFAULT_VERSIONS dictionary and that version is used. If license_type is not found in DEFAULT_VERSIONS, the module constant DEFAULT_GENERIC_VERSION is used.

  • force (bool) – For the attempted checkout of the license even if license_type is not recognized by this class. If checkout is unsuccessful, no error will be raised, but self.license will be None


Check if the license is currently valid


Return the license token. After calling this method, the License object will report itself as invalid.

class schrodinger.utils.license.LicenseStatus(error_code)

Bases: object

Simple class to store license availability status. Meant to be returned by is_license_available(), for which __bool__() has been defined.


error_code (int) – The error code of a particular license type. Error codes defined in mmlic3.h

property error_code

The license status

Return type



Returns TRUE if S-OPLS is available. Note that OPLS2, OPLS3, OPLS3e, and OPLS4 are all now called S-OPLS (as of 01 June 2021). This function does not actually check for OPLS2 specifically, but rather it checks for S-OPLS.

schrodinger.utils.license.is_matsci(token=None, name=None)

Return True if the given license token or name is for the MATERIALSCIENCE product, False otherwise.

  • token (int or None) – the license token, if None use name

  • name (str or None) – the license name, if None use token

Return type



whether the license token or name is for the MATERIALSCIENCE product