'''
This is a class to hold configuration data within ChemShell (Python version).
It is based on that written by Kevin Stafford for the DL_MONTE HTK

The "fragments" used by ChemShell have been equated to a molecule for the purpose
of the config. A cell object has also been created in CONFIG even though objects
are present in fragments and it is this instance that is employed in calculations etc
'''

#import the objects employed by ChemShell
from chemsh       import *
#from fragment import Fragment as frag

class CONFIG(object):

    """Container class for CONFIG"""

    def __init__(self, title=None, cell=None, nummol=None, molecules=None, levcfg = None, pbc = None):

        """Representation of CONFIG input file
        """

        self.title = title

        self.levcfg = 0

        self.pbc = 3

        self.cell = cell

        self.nummol = 0
        self.molecules = []

        if nummol is not None:
            self.nummol = nummol

        if molecules is not None:
            self.molecules = molecules

    def append_fragment(self, fragment):

        self.molecules.append(fragment)

        self.nummol = self.nummol + 1

    def set_cell(self, cell):

        self.cell = cell

    def set_title(self, title):

        self.title = title
