# Path: veidt/monte_carlo/base.py
# class State(metaclass=ABCMeta):
#     def __init__(self, state, name=None):
#         """
#         Base class for State.
#         :param state: scalar or iterables
#         :param name: string name
#         """
#         self.state = state
#         self.check_state()
#         self.name = name
#         self.label = name
# 
#     @abstractmethod
#     def change(self):
#         """
#         Change state to new state
#         :return:
#         """
#         pass
# 
#     def check_state(self):
#         """
#         Check if the state make sense, raise Error if not
#         :return:
#         """
#         pass
# 
#     def __eq__(self, other):
#         """
#         Compare two states
#         :param other: other state object
#         :return: bool
#         """
#         if isinstance(self.state, Iterable):
#             return all([i == j for i, j in zip(self.state, other.state)])
#         else:
#             return self.state == other.state
# 
#     def copy(self):
#         """
#         copy a state
#         :return: new state object with same state variable
#         """
#         new_state = self.__class__(copy(self.state), self.name)
# 
#         # copy other attributes
#         # new_state.__dict__.update({i: j for i, j in self.__dict__.items() if i not in ['state', 'name']})
#         return new_state
# 
# class StateStructure(metaclass=ABCMeta):
#     """
#     Structure with StateDict to describe the states
#     Each structure will be associated with a collection of state and can be converted to or from the states
#     """
# 
#     def __init__(self, structure, state_dict):
#         """
# 
#         :param structure: pymatgen structure
#         :param state_dict: StateDict object
#         """
#         self.structure = structure.copy()
#         self.state_dict = state_dict.copy()
# 
#     @abstractmethod
#     def structure_from_states(self, state_dict):
#         """
#         Convert the state into pymatgen structure
#         : param state_dict: StateDict object
#         :return: structure corresponding to the state dictionary
#         """
#         pass
# 
#     @abstractmethod
#     def structure_to_states(self, structure):
#         """
#         Convert structure to corresponding state dictionary
#         :param structure: pymatgen structure
#         :return: state dictionary
#         """
#         pass
# 
#     def to_states(self):
#         """
#         Convert the object to state dictionary
#         :return: StateDict object
#         """
#         return self.structure_to_states(self.structure)
# 
#     def from_states(self, state_dict):
#         """
#         Convert a state dictionary into structure
#         :param state_dict: StateDict object
#         :return:
#         """
#         self.structure = self.structure_from_states(state_dict)
#         self.state_dict = state_dict
# 
#     def change(self):
#         """
#         Perform state changes for all items in the state dictionary and
#         update the structure
#         :return:
#         """
#         [i.change() for i in self.state_dict.values()]
#         self.from_states(self.state_dict)
# 
# class StaticState(State):
#     """
#     StaticState does not change the state when calling the change method
#     """
# 
#     def change(self):
#         pass


import numpy as np
import itertools
from collections import defaultdict
from .base import State, StateStructure, StaticState
        :return: StateStructure
        """
        return self.__class__(self.structure.copy(), self.state_dict.copy(), self.species_map)

    def __str__(self):
        """
        string representation of the StateStructure
        :return: string
        """
        return ' '.join([str(i) + str(j.state) for i, j in self.state_dict.items() if i != 'temperature'])


class Chain(object):
    """
    A chain of states class

    To do, need to check states variable changes over steps"""

    def __init__(self):
        self.chain = defaultdict(list)
        self.length = 0
        self.current_state = None

    def append(self, state_dict):
        """Append new states
        :param state_dict: StateDict object
        """

        # append state variables
        for state_name, state in state_dict.items():

# Path: veidt/monte_carlo/base.py
# class State(metaclass=ABCMeta):
#     def __init__(self, state, name=None):
#         """
#         Base class for State.
#         :param state: scalar or iterables
#         :param name: string name
#         """
#         self.state = state
#         self.check_state()
#         self.name = name
#         self.label = name
# 
#     @abstractmethod
#     def change(self):
#         """
#         Change state to new state
#         :return:
#         """
#         pass
# 
#     def check_state(self):
#         """
#         Check if the state make sense, raise Error if not
#         :return:
#         """
#         pass
# 
#     def __eq__(self, other):
#         """
#         Compare two states
#         :param other: other state object
#         :return: bool
#         """
#         if isinstance(self.state, Iterable):
#             return all([i == j for i, j in zip(self.state, other.state)])
#         else:
#             return self.state == other.state
# 
#     def copy(self):
#         """
#         copy a state
#         :return: new state object with same state variable
#         """
#         new_state = self.__class__(copy(self.state), self.name)
# 
#         # copy other attributes
#         # new_state.__dict__.update({i: j for i, j in self.__dict__.items() if i not in ['state', 'name']})
#         return new_state
# 
# class StateStructure(metaclass=ABCMeta):
#     """
#     Structure with StateDict to describe the states
#     Each structure will be associated with a collection of state and can be converted to or from the states
#     """
# 
#     def __init__(self, structure, state_dict):
#         """
# 
#         :param structure: pymatgen structure
#         :param state_dict: StateDict object
#         """
#         self.structure = structure.copy()
#         self.state_dict = state_dict.copy()
# 
#     @abstractmethod
#     def structure_from_states(self, state_dict):
#         """
#         Convert the state into pymatgen structure
#         : param state_dict: StateDict object
#         :return: structure corresponding to the state dictionary
#         """
#         pass
# 
#     @abstractmethod
#     def structure_to_states(self, structure):
#         """
#         Convert structure to corresponding state dictionary
#         :param structure: pymatgen structure
#         :return: state dictionary
#         """
#         pass
# 
#     def to_states(self):
#         """
#         Convert the object to state dictionary
#         :return: StateDict object
#         """
#         return self.structure_to_states(self.structure)
# 
#     def from_states(self, state_dict):
#         """
#         Convert a state dictionary into structure
#         :param state_dict: StateDict object
#         :return:
#         """
#         self.structure = self.structure_from_states(state_dict)
#         self.state_dict = state_dict
# 
#     def change(self):
#         """
#         Perform state changes for all items in the state dictionary and
#         update the structure
#         :return:
#         """
#         [i.change() for i in self.state_dict.values()]
#         self.from_states(self.state_dict)
# 
# class StaticState(State):
#     """
#     StaticState does not change the state when calling the change method
#     """
# 
#     def change(self):
#         pass


# Path: veidt/monte_carlo/state.py
import numpy as np
import itertools
from collections import defaultdict
from .base import State, StateStructure, StaticState

        :return: StateStructure
        """
        return self.__class__(self.structure.copy(), self.state_dict.copy(), self.species_map)

    def __str__(self):
        """
        string representation of the StateStructure
        :return: string
        """
        return ' '.join([str(i) + str(j.state) for i, j in self.state_dict.items() if i != 'temperature'])


class Chain(object):
    """
    A chain of states class

    To do, need to check states variable changes over steps"""

    def __init__(self):
        self.chain = defaultdict(list)
        self.length = 0
        self.current_state = None

    def append(self, state_dict):
        """Append new states
        :param state_dict: StateDict object
        """

        # append state variables
        for state_name, state in state_dict.items():

            if not isinstance(state, StaticState):