#!/usr/bin/env python



from IPython.config.loader import Config
try:
    get_ipython
except NameError:
    nested = 0
    cfg = Config()
    prompt_config = cfg.PromptManager
    prompt_config.in_template = 'In [\\#]: '
    prompt_config.in2_template = '   .\\D.: '
    prompt_config.out_template = 'Out[\\#]: '
else:
    print("Running nested copies of IPython.")
    print("The prompts for the nested copy have been modified")
    cfg = Config()
    nested = 1

# First import the embeddable shell class
from IPython.frontend.terminal.embed import InteractiveShellEmbed

# Now create an instance of the embeddable shell. The first argument is a
# string with options exactly as you would type them if you were starting
# IPython at the system command line. Any parameters you want to define for
# configuration can thus be specified here.
banner = """
Custom ipython environment for pymatgen. Useful aliases such as Element,
Specie, Composition, Structure, Molecule, Lattice, PMGJSONEncoder,
PMGJSONDecoder, Spin, Orbital, zopen, read_structure and write_structure have
been loaded.
"""
ipshell = InteractiveShellEmbed(
    config=cfg,
    banner1=banner,
    exit_msg = 'Leaving pymatgen interpreter, back to program.')

from pymatgen import *
ipshell()