uw-cmg / MAST

MAterials Simulation Toolkit for use with pymatgen
17 stars 8 forks source link

structopt compatibility in MAST 1.1.0 #378

Closed cmgtam closed 8 years ago

cmgtam commented 10 years ago

Hyunseok could not run structopt in MAST. I found the following four issues. Correcting them will allow structopt to submit, but which may only be a prelude to other issues.

ISSUE 1: don't use mast_install_path

structoptchecker

def _structopt_get_non_mast_keywords(self): ... allowedpath = os.path.join(dirutil.get_mast_install_path(),"MAST",...

change to "dirutil.get_mast_control_path(),'programkeys','structopt_allowed_keywords.py'"

    allowedpath = os.path.join(dirutil.get_mast_control_path(),
                    'programkeys','structopt_allowed_keywords.py')

ISSUE 2: need to copy over allowed keywords

[tam@bardeen Structopt]$ cp ~/.local/lib/python2.7/site-packages/MAST/ingredients/programkeys/structopt_allowed_keywords.py ~/MAST/CONTROL/programkeys/. That is, this copy needs to be added into the setup.py script so that the file copies over automatically upon installation

ISSUE 3: Properly import Optimizer class

File "/home/tam/.local/lib/python2.7/site-packages/MAST/ingredients/checker/structoptchecker.py", line 474, in set_up_program_input return self.set_up_program_input_whole() File "/home/tam/.local/lib/python2.7/site-packages/MAST/ingredients/checker/structoptchecker.py", line 482, in set_up_program_input_whole Optinit = Optimizer(self.structopt_parameters)

Error detected in MAST class MASTmon! Please fix the error and rerun MAST. Error message: Error in recipe GATest_Si_20140606T210600 as follows: <type 'exceptions.TypeError'> 'module' object is not callable None

from MAST.structopt import Optimizer -> change to: from MAST.structopt.Optimizer import Optimizer

ISSUE 4: Build submission script correctly:

mast_exec //share/apps/mvapich2/tam_mvapich2-1.9a2/usr/local/bin/mpiexec python

Bad submission script production (Optimizer.py gets called twice): From input file, remove the ~/bin/pylib/structopt/Optimizer.py line

//share/apps/mvapich2/tam_mvapich2-1.9a2/usr/local/bin/mpiexec python /home/tam/MAST/CONTROL/Optimizer.py/Optimizer.py /home/tam/MAST/SCRATCH/GATest_Si_20140606T212004/perfect_opt1/structoptinput.txt

In structoptchecker:

    optimizerpath = os.path.join(structoptpath,'Optimizer.py')
    new_exec_line += ' {0} {1}'.format(optimizerpath,inputfile)

Change to:

    #optimizerpath = os.path.join(structoptpath,'Optimizer.py')
    new_exec_line += ' {0} {1}'.format(structoptpath,inputfile)
cmgtam commented 8 years ago

Closing this issue. Hyunseok's working structopt version is the current version in MAST v.1.3.3, and all future StructOpt development is being handled at https://github.com/uw-cmg/StructOpt_modular.