awmitch / aiida-dakota

AiiDA plugin for Dakota
MIT License
0 stars 0 forks source link

Write convert_input_to_namelist_entry function for Dakota #7

Closed awmitch closed 2 years ago

awmitch commented 2 years ago

Need to specialize the function def convert_input_to_namelist_entry(key, val, mapping=None): to Dakota.

Also investigate mapping to ensure Dakota format, originally mapping_species = {kind_name: (index + 1) for index, kind_name in enumerate(kind_names)} defined here

awmitch commented 2 years ago

Need to rewrite if_instance(val,dict) in convert_input_to_namelist_entry function which uses mapping_species Not sure if dakota will ever have dicts submitted as a parameter, will disable for now

awmitch commented 2 years ago

Note that all input parameter logic is found in the submission script. Dakota package has been confirmed to also contain an xml input schema from which an input helper can be made.

from aiida import orm, engine
from aiida.common.exceptions import NotExistent

parameters = {
    'ENVIRONMENT':{
        'keywords':[tabular_data],
        'tabular_data_file':'List_param_study.dat',
    },
    'METHOD':{
        'keywords':['list_parameter_study'],
        'list_of_points':[0.00734987, 0.008],

    },
    'MODEL':{
        'keywords':[],
    },
    'VARIABLES':{
        'keywords':[],
        'continuous_design':1
        'descriptors':'degauss'
    },
    'INTERFACE':{
        'keywords':[],
    },
    'RESPONSES':{
        'keywords':[no_gradients, no_hessians],
        'response_functions':1
    },
}

# Setting up inputs
computer = orm.load_computer('localhost')
try:
    code = load_code('dakota@localhost')
except NotExistent:
    # Setting up code via python API (or use "verdi code setup")
    code = orm.Code(label='laptop', remote_computer_exec=[computer, '/bin/bash'], input_plugin_name='dakota.study')

builder = code.get_builder()
builder.parameters = Dict(dict=parameters)

builder.metadata.options.withmpi = False
builder.metadata.options.resources = {
    'num_machines': 1,
    'num_mpiprocs_per_machine': 1,
}

# Running the calculation & parsing results
#output_dict, node = engine.run_get_node(builder)
calculation = engine.submit(builder)
print("Completed.")
awmitch commented 2 years ago

At this point the conversion is accurate and issue now remains to do issue #9 to run a successful dakota simulation