MARC_VERSION as MSCVERSION

This commit is contained in:
Vitesh Shah 2020-10-22 11:48:06 +02:00
parent 995f56f69f
commit bd67296e8d
3 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ from pathlib import Path
import damask import damask
marc_version = float(damask.environment.options['MARC_VERSION']) marc_version = float(damask.environment.options['MSCVERSION'])
if int(marc_version) == marc_version: if int(marc_version) == marc_version:
marc_version = int(marc_version) marc_version = int(marc_version)
msc_root = Path(damask.environment.options['MSC_ROOT']) msc_root = Path(damask.environment.options['MSC_ROOT'])
@ -15,7 +15,7 @@ damask_root = damask.environment.root_dir
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Apply DAMASK modification to MSC.Marc/Mentat', description='Apply DAMASK modification to MSC.Marc/Mentat',
epilog = f'MSC_ROOT={msc_root} and MARC_VERSION={marc_version} (from {damask_root}/env/CONFIG)') epilog = f'MSC_ROOT={msc_root} and MSCVERSION={marc_version} (from {damask_root}/env/CONFIG)')
parser.add_argument('--editor', dest='editor', metavar='string', default='vi', parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
help='Name of the editor for MSC.Mentat (executable)') help='Name of the editor for MSC.Mentat (executable)')
@ -23,7 +23,7 @@ parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
def copy_and_replace(in_file,dst): def copy_and_replace(in_file,dst):
with open(in_file) as f: with open(in_file) as f:
content = f.read() content = f.read()
content = content.replace('%INSTALLDIR%',msc_root) content = content.replace('%INSTALLDIR%',str(msc_root))
content = content.replace('%VERSION%',str(marc_version)) content = content.replace('%VERSION%',str(marc_version))
content = content.replace('%EDITOR%', parser.parse_args().editor) content = content.replace('%EDITOR%', parser.parse_args().editor)
with open(dst/Path(in_file).name,'w') as f: with open(dst/Path(in_file).name,'w') as f:

View File

@ -32,7 +32,7 @@ class Environment:
options = {} options = {}
for item in ['DAMASK_NUM_THREADS', for item in ['DAMASK_NUM_THREADS',
'MSC_ROOT', 'MSC_ROOT',
'MARC_VERSION', 'MSCVERSION',
]: ]:
options[item] = os.environ[item] if item in os.environ else None options[item] = os.environ[item] if item in os.environ else None

View File

@ -8,7 +8,7 @@ from .. import environment
class Marc: class Marc:
"""Wrapper to run DAMASK with MSCMarc.""" """Wrapper to run DAMASK with MSCMarc."""
def __init__(self,version=environment.options['MARC_VERSION']): def __init__(self,version=environment.options['MSCVERSION']):
""" """
Create a Marc solver object. Create a Marc solver object.