#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
 Aestimo 1D Schrodinger-Poisson Solver
 Copyright (C) 2013-2018 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

File Information:
-----------------
This script is one method of running aestimo. Simply specify the input file
(which should be a python module with the appropriate parameter) as the script's
argument.

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.
"""

__author__    = "For the list of contributors, see ~/AUTHORS.md"
__copyright__ = "Copyright (C) 2013-2020 Sefer Bora Lisesivdin and Aestimo group"
__license__   = "GPLv3+ WITHOUT ANY WARRANTY"
__version__   = "2.0.1"

import sys,os
import optparse
import aestimo.aestimo as aestimo
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 <aestimo input module name>\n')
    sys.exit()
inputfile = args[0]

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

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