def test__on_ready():
    symbols = configuration['potential']['symbols']
    task_name = configuration['task']['task_name']
    task_directory = configuration['task']['task_directory']
    structure_filename = configuration['structure']['filename']
    restart = False
    fullauto = False

    cleanup(task_directory)
    assert not os.path.exists(task_directory)
    assert 'potential' in configuration
    assert 'parameters' in configuration
    #<--- code setup
    from pypospack.task.lammps import LammpsSimulation
    lammps_task = LammpsSimulation(task_name=task_name,
                                   task_directory=task_directory,
                                   structure_filename=structure_filename)
    lammps_task.on_init(configuration)
    lammps_task.on_config(configuration)
    #<--- test setup
    assert os.path.exists(task_directory)
    assert lammps_task.status == 'READY'
    #<--- code being testing
    lammps_task.on_ready(configuration)
    #<--- expected behavior
    lammps_setfl_filename = '{}.eam.alloy'.format("".join(symbols))

    #<--- check to see if the configuration dictionaries were setup correctly
    assert type(lammps_task.conditions_INIT) == OrderedDict
    assert type(lammps_task.conditions_CONFIG) == OrderedDict
    assert type(lammps_task.conditions_READY) == OrderedDict
    assert type(lammps_task.conditions_RUNNING) == OrderedDict
    assert type(lammps_task.conditions_POST) == OrderedDict
    assert type(lammps_task.conditions_FINISHED) == OrderedDict

    assert os.path.isfile(os.path.join(task_directory, lammps_setfl_filename))

    assert lammps_task.conditions_INIT['task_directory_created']
    assert all([v for k, v in lammps_task.conditions_INIT.items()]) == True
    assert lammps_task.conditions_CONFIG['potential_initialized'] == True
    assert lammps_task.conditions_CONFIG['parameters_processed'] == True
    assert all([v for k, v in lammps_task.conditions_CONFIG.items()]) == True
    assert all([v for k, v in lammps_task.conditions_READY.items()]) == True
    assert lammps_task.conditions_RUNNING['process_initialized'] == True
    assert all([v for k, v in lammps_task.conditions_RUNNING.items()]) == True
    assert lammps_task.conditions_POST['process_finished'] == False
    assert all([v for k, v in lammps_task.conditions_POST.items()]) == False
    assert all([v
                for k, v in lammps_task.conditions_FINISHED.items()]) == False
示例#2
0
def test__on_ready():
    task_name = configuration['task']['task_name']
    task_directory = configuration['task']['task_directory']
    structure_filename = configuration['structure']['filename']
    restart = False
    fullauto = False

    cleanup(task_directory)
    assert not os.path.exists(task_directory)
    assert 'potential' in configuration
    assert 'parameters' in configuration
    #<--- code setup
    from pypospack.task.lammps import LammpsSimulation
    lammps_task = LammpsSimulation(task_name=task_name,
                                   task_directory=task_directory,
                                   structure_filename=structure_filename)
    lammps_task.on_init(configuration)
    lammps_task.on_config(configuration)
    #<--- test setup
    assert os.path.exists(task_directory)
    assert lammps_task.status == 'READY'
    #<--- code being testing
    lammps_task.on_ready(configuration)

    assert type(lammps_task.conditions_INIT) == OrderedDict
    assert type(lammps_task.conditions_CONFIG) == OrderedDict
    assert type(lammps_task.conditions_READY) == OrderedDict
    assert type(lammps_task.conditions_RUNNING) == OrderedDict
    assert type(lammps_task.conditions_POST) == OrderedDict
    assert type(lammps_task.conditions_FINISHED) == OrderedDict

    assert lammps_task.conditions_INIT['task_directory_created']
    assert all([v for k, v in lammps_task.conditions_INIT.items()]) == True
    assert lammps_task.conditions_CONFIG['potential_initialized'] == True
    assert lammps_task.conditions_CONFIG['parameters_processed'] == True
    assert all([v for k, v in lammps_task.conditions_CONFIG.items()]) == True
    assert all([v for k, v in lammps_task.conditions_READY.items()]) == True
    #assert lammps_task.conditions_RUNNING['process_initialized']== False
    #assert all([v for k,v in lammps_task.conditions_RUNNING.items()]) == False
    assert lammps_task.conditions_POST['process_finished'] == False
    assert all([v for k, v in lammps_task.conditions_POST.items()]) == False
    assert all([v
                for k, v in lammps_task.conditions_FINISHED.items()]) == False
示例#3
0
print('poscar_filename={}'.format(Ni_structure_definition['filename']))
assert os.path.isfile(Ni_structure_definition['filename'])

Ni_task_configuration = OrderedDict()
Ni_task_configuration['task'] = OrderedDict()
Ni_task_configuration['task']['task_name'] = 'Ni_fcc_unit.E_min_all'
Ni_task_configuration['task']['task_directory'] = 'Ni_fcc_.E_min_all'
Ni_task_configuration['task_type'] = 'min_none'
Ni_task_configuration['potential'] = Ni_eam_potential_definition
Ni_task_configuration['parameters'] = Ni_eam_parameters
Ni_task_configuration['structure'] = Ni_structure_definition

configuration = Ni_task_configuration

task_name = configuration['task']['task_name']
task_directory = configuration['task']['task_directory']
structure_filename = configuration['structure']['filename']
restart = False
fullauto = False

from pypospack.task.lammps import LammpsSimulation
lammps_task = LammpsSimulation(task_name=task_name,
                               task_directory=task_directory,
                               structure_filename=structure_filename)
lammps_task.on_init(configuration)
lammps_task.on_config(configuration)
lammps_task.on_ready(configuration)
lammps_task.on_running(configuration)
lammps_task.on_post(configuration)
示例#4
0
 def on_ready(self, configuration=None, results=None):
     if self.bulk_structure_name is not None:
         self.__modify_structure(results=results)
     LammpsSimulation.on_ready(self, configuration=configuration)
示例#5
0
 def on_ready(self,configuration=None,results=None):
     LammpsSimulation.on_ready(
             self,
             configuration=configuration,
             results=results)