A python package which provides data models & tools for the Computational Molecular Sciences (CMS).
The most fundamental model is ProtoModel
, a subclass of the pydantic BaseModel
, which provides commonly used methods in CMS.
from cmselemental.models import ProtoModel
class Model(ProtoModel):
...
obj = Model(...)
is_same = obj.compare(other_obj)
stringified = obj.json()
data = obj.dict()
Routines for serializing to popular formats like JSON and YAML are available, with support for encoding Numpy arrays.
from cmselemental.util import serialize, deserialize
stringified = serialize(data, encodding="json", indent=4)
data = deserialize(stringified, encoding="json")