Source code for pycif.utils.classes.chemistries
from types import MethodType
from ...utils.check.errclass import PluginError
from .baseclass import Plugin
[docs]
class Chemistry(Plugin):
[docs]
    @classmethod
    def register_plugin(cls, name, version, module, subtype="", **kwargs):
        """Register a module for a plugin and version with possibly options
        Args:
            name (str):  name of the plugin
            version (str):  version of the plugin
            module (types.ModuleType): module defining the interface
                between pyCIF and the plugin
            plugin_type (str): type of plugin
            **kwargs (dictionary): default options for module
        """
        super(Chemistry, cls).register_plugin(
            name, version, module, plugin_type="chemistry", subtype=subtype
        ) 
[docs]
    def read_chemicalscheme(self, *args, **kwargs):
        """Read a chemical scheme from an existing file
        Args:
            self (Chemistry): plugin defining the chemistry. Should include
            dirscheme grid to be able to read the chemistry from files
        Return:
            Characteristics of the chemical scheme
        """
        raise PluginError("The function read_scheme was not defined") 
[docs]
    def create_chemicalscheme(self, *args, **kwargs):
        """Creates a chemical scheme if needed
        Args:
            chemistry (dictionary): dictionary defining the chelical scheme
        """
        raise PluginError("The function create_chemicalscheme was not defined") 
[docs]
    def initiate_template(self):
        super(Chemistry, self).initiate_template(
            plg_type="chemistry",
            default_functions={
                "read_chemicalscheme": True, "create_chemicalscheme": True}
        )