schrodinger.infra.mmim module

Wrapper classes and functions for dealing with the MMIM library, which is used to read & write Impact and QSite input files.

See MMIMDict documentation for more details.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.infra.mmim.convert_string(key, value)

Given a key (as integer or string) and a value (string), try to convert the value to the proper type for this keyword. Return converted value. Will raise a KeyError if the wrong key value is specified.

NOTE: Used by glide.py

class schrodinger.infra.mmim.MMIMArgList(handle, key, converter=None, getter=None, setter=None, get_len=None, set_len=None)

Bases: MMKVArgList

__init__(handle, key, converter=None, getter=None, setter=None, get_len=None, set_len=None)

Create an instance from the MMKV/MMIM handle and key (int or string).

Takes functions to get and set indexed values, and a function to determine the length. If these are not provided, they are looked up based on the key provided.

get_len and set_len methods should be defined for array types only.

class schrodinger.infra.mmim.MMIMDict(handle=None)

Bases: MutableMapping

A class for setting and getting MMIM keyword values. Given an MMIM handle, create an instance as follows:

mydict = MMIMDict(mmim_handle)

Then set any keywords:

mydict[<keywordname>] = <value>

The object can also be used as a context manager, in which case the handle is optional. One will be created if needed, and deleted on exit:

with MMIMDict() as mydict:
    mydict[<keywordname>] = <value>
    mm.mmim_method(mydict.handle, ...)
__init__(handle=None)

Create an instance from the given MMIM handle. If none supplied, a new handle will be created when the context is entered.

keys() a set-like object providing a view on D's keys
__len__()
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v