Ejemplo n.º 1
0
def test_makebatch_prod():
    settings = default_globals()
    this_thread = atesa.spawnthread('fakethread',
                                    thread_type='prod',
                                    suffix='1',
                                    settings=settings)
    atesa.makebatch(this_thread, settings=settings)
    assert my_file_cmp(settings.working_directory + '/fakethread_1_fwd.slurm',
                       settings.working_directory + '/test_fwd.slurm')
    assert my_file_cmp(settings.working_directory + '/fakethread_1_bwd.slurm',
                       settings.working_directory + '/test_bwd.slurm')
    os.remove(settings.working_directory + '/fakethread_1_fwd.slurm')
    os.remove(settings.working_directory + '/fakethread_1_bwd.slurm')
    os.remove(settings.logfile)
Ejemplo n.º 2
0
def test_spawnthread_bare():
    settings = default_globals()
    this_thread = atesa.spawnthread('fakethread',
                                    thread_type='init',
                                    suffix='1',
                                    settings=settings)
    assert this_thread.basename == 'fakethread'
    assert this_thread.suffix == '1'
    assert this_thread.name == 'fakethread_1'
    assert this_thread.type == 'init'
    assert this_thread.start_name == 'fakethread'
    assert this_thread.prmtop == 'test.prmtop'
    assert this_thread.last_valid == '0'
    return this_thread
Ejemplo n.º 3
0
def test_makebatch_ca():
    settings = default_globals()
    settings.n_shots = 2
    settings.committor_analysis = [10, 0.5, 0.1, 1, 10, 'test']
    this_thread = atesa.spawnthread('fakethread',
                                    thread_type='committor_analysis',
                                    suffix='1',
                                    settings=settings)
    atesa.makebatch(this_thread, settings=settings)
    assert my_file_cmp(settings.working_directory + '/fakethread_ca_0.slurm',
                       settings.working_directory + '/test_ca_0.slurm')
    assert my_file_cmp(settings.working_directory + '/fakethread_ca_1.slurm',
                       settings.working_directory + '/test_ca_1.slurm')
    os.remove(settings.working_directory + '/fakethread_ca_0.slurm')
    os.remove(settings.working_directory + '/fakethread_ca_1.slurm')
    os.remove(settings.logfile)
Ejemplo n.º 4
0
def test_spawnthread_eps():
    # Doesn't test basic spawnthread functions (test_spawnthread_bare() does); this tests EPS functionality
    # Spawnthread will call atesa.candidatevalues() to assemble CV values, so I need to give it real files to work with
    settings = test_initialize_eps()
    this_thread = atesa.spawnthread('eps.rst7',
                                    thread_type='init',
                                    suffix='1',
                                    settings=settings)
    assert float('%.3f' % (this_thread.rc_min)) == 0.7
    assert float('%.3f' % (this_thread.rc_max)) == 1.3
    assert this_thread.eps_bwd + this_thread.eps_fwd == settings.eps_settings[
        1] - 1  # -1 to account for start bead
    for i in range(settings.k_beads - 1):
        os.remove(settings.working_directory + '/eps' + str(i + 1) + '.in')
    os.remove(settings.logfile)
    return this_thread
Ejemplo n.º 5
0
def test_makebatch_init():
    # This test (and the other makebatch tests) function as follows:
    #  Assemble spoofed **kwargs input to direct makebatch behavior
    #  Call makebatch with spoofed input
    #  Compare produced batch file to correct one in test directory w/ assert
    #  Delete new file to clean up
    settings = default_globals()
    this_thread = atesa.spawnthread('fakethread',
                                    thread_type='init',
                                    suffix='1',
                                    settings=settings)
    test_file = atesa.makebatch(this_thread, settings=settings)
    assert my_file_cmp(
        settings.working_directory + '/' + test_file,
        settings.working_directory + '/test_init.slurm'
    )  # todo: this (and other filecmp's) rely on being localized on my particular filesystem... possible workaround?
    os.remove(test_file)
    os.remove(settings.logfile)