#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script is one method of running aestimo_h. If no input file is specified,
the input file defined in the aestimo.config module will be run as default.

Alternatively, many of the example input files show how we can transform them
into scripts that can be run directly to perform the simulations. That approach
also allows us to tailor each simulation even more to our needs.
"""
"""
 Aestimo 1D Schrodinger-Poisson Solver
 Copyright (C) 2013-2014 Sefer Bora Lisesivdin and Aestimo group

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. See ~/COPYING file or http://www.gnu.org/copyleft/gpl.txt .

    For the list of contributors, see ~/AUTHORS
"""
import sys,os
import optparse
import aestimo.aestimo_h as aestimo_h
import aestimo.config as config

usage = """usage: %prog <aestimo input module name>

Aestimo is a Poisson-Schrodinger semiconductor simulator for quantum wells.
It is written in python, see the aestimo package for examples on how to use
it."""
parser = optparse.OptionParser(usage=usage) #overkill now but may add options in the future.
(options, args) = parser.parse_args()   
if len(args)==0:
    sys.stderr.write('Missing input file\nUsage: aestimo_h <aestimo input module name>\n')
    sys.exit()
inputfile = args[0]

# Import input file
sys.path.append(os.getcwd())
inputparams = __import__(inputfile,fromlist=[None])
aestimo_h.logger.info("inputfile is %s",inputfile)

if __name__=="__main__":
    aestimo_h.run_aestimo(inputparams)
