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: schrodinger.infra.mmkv.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.

__len__()
append(value)

Append a new value to the current MMKV arglist.

Parameters

value (str, int, bool, or float depending on the MMKV arglist type) – The new value to append.

setSize(size)

Set the size of the MMKV argument list.

class schrodinger.infra.mmim.MMIMDict(handle)

Bases: collections.abc.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>

__init__(handle)

Create an instance from the given MMIM handle.

keys() a set-like object providing a view on D’s keys
__len__()
__contains__(key)
clear() None.  Remove all items from D.
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D’s items
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
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

values() an object providing a view on D’s values