schrodinger.application.matsci.licutils module¶
Copyright Schrodinger, LLC. All rights reserved.
- exception schrodinger.application.matsci.licutils.LicenseError(token)¶
Bases:
ExceptionLicense error
- __init__(token)¶
Initialize LicenseError object.
- Parameters:
token (schrodinger.infra.licensing) – License token that is not available
- schrodinger.application.matsci.licutils.check_license(panel=None, token=94, name='', as_validator=False, fall_back_tokens=None, matsci_product=True)¶
Check if a valid token exists. If called from Maestro, also check out and hold a MATERIALSCIENCE_MAIN token.
- Parameters:
panel (AppFramework) – panel to use to put up an error dialog if no license
token (
schrodinger.utils.licenseconstant or None) – A token type from the schrodinger.utils.license module, such as MATERIALSCIENCE_MAIN or MATERIALSCIENCE_GA. If not provided, the default material science token will be used if is_cg is False, or the CG token will be used if is_cg is True.name (str) – The user-identifiable name for the token - used for error messages. If not provided, the string used in the license module for this token (if one exists) will be used.
as_validator (bool) – If True, this function will work as an AF2 validation method. Instead of posting a dialog or printing a message for a failed license check, it will return (False, error_message).
fall_back_tokens (list or None) – if present specifies that if the intended license check from the given token or name fails then attempt to get a valid license by running through this ordered list of fall back tokens, each of which is a
schrodinger.utils.licenseconstant for a non-MATSCI productmatsci_product (bool) – True if this check is for a MatSci product, False if not. If True, and run from a Maestro session, this function will ensure that a single MS MAIN license token will be checked out and held for this Maestro session. False indicates that this call is from a non-MatSci panel and should not ensure that a MS MAIN token is being held for this Maestro session.
- Return type:
bool or (bool, str)
- Returns:
True if valid license exists. If no valid license exists, False will be returned by default, but (False, msg) will be returned if as_validator=True. Note that (False, msg) evalutes to True so must be handled by the calling routine as not a boolean if as_validator=True.
- schrodinger.application.matsci.licutils.check_licenses(*tokens, as_validator=False)¶
Check if valid tokens exist. If called from Maestro, also check out and hold a MATERIALSCIENCE_MAIN token.
- Parameters:
tokens (list[schrodinger.utils.license]) – List of license tokens
as_validator (bool) – If True, this function will work as an AF2 validation method. Instead of posting a dialog or printing a message for a failed license check, it will return (False, error_message).
- Return type:
bool or (bool, str)
- Returns:
True if valid license exists. If no valid license exists, False will be returned by default, but (False, msg) will be returned if as_validator=True. Note that (False, msg) evalutes to True so must be handled by the calling routine as not a boolean if as_validator=True.
- schrodinger.application.matsci.licutils.check_cg_license(*args, is_cg, **kwargs)¶
A wrapper around check_license that checks the appropriate license for the given the panel is using coarse grained structures or not.
- Parameters:
is_cg (bool) – True if the panel is using coarse grained structures, False if not
- Return type:
bool or (bool, str)
- Returns:
True if valid license exists. If no valid license exists, False will be returned by default, but (False, msg) will be returned if as_validator=True. Note that (False, msg) evalutes to True so must be handled by the calling routine as not a boolean if as_validator=True.