def test_read_one_e01(snap): import asyncio from collections import namedtuple # Use dataclass in Python 3.7 loop = asyncio.get_event_loop() semaphore = asyncio.Semaphore(CONCUR_TASKS) Min, Cycle, Frame = 'v38abs', snap.Cycle, snap.Frame log, variables, atoms = snap.log, snap.variables, snap.atoms mode = 'predict' verbose = True snapshot = loop.run_until_complete(read_one( Min, Cycle, Frame, variables, mode, semaphore, verbose)) assert snapshot == False
def test_read_one_e05(snap): # cro-opt-13-150-mndo.out does not exist import asyncio from collections import namedtuple # Use dataclass in Python 3.7 loop = asyncio.get_event_loop() semaphore = asyncio.Semaphore(CONCUR_TASKS) Min, Cycle, Frame = snap.Min, snap.Cycle, 150 log, variables, atoms = snap.log, snap.variables, snap.atoms mode = 'predict' verbose = True with pytest.raises(ValueError): snapshot = loop.run_until_complete(read_one( Min, Cycle, Frame, variables, mode, semaphore, verbose))
def test_read_one_e03(snap): # om2-opt-13-200-opt.c does not exist import asyncio from collections import namedtuple # Use dataclass in Python 3.7 loop = asyncio.get_event_loop() semaphore = asyncio.Semaphore(CONCUR_TASKS) Min, Cycle, Frame = snap.Min, snap.Cycle, 200 log, variables, atoms = snap.log, snap.variables, snap.atoms mode = 'model' verbose = True snapshot = loop.run_until_complete(read_one( Min, Cycle, Frame, variables, mode, semaphore, verbose)) assert snapshot == False
def snap_predict(snap): import asyncio from collections import namedtuple # Use dataclass in Python 3.7 loop = asyncio.get_event_loop() semaphore = asyncio.Semaphore(CONCUR_TASKS) Min, Cycle, Frame = snap.Min, snap.Cycle, snap.Frame log, variables, atoms = snap.log, snap.variables, snap.atoms mode = 'predict' verbose = True snapshot = loop.run_until_complete(read_one( Min, Cycle, Frame, variables, mode, semaphore, verbose)) Snap = namedtuple('snap', 'log variables atoms shot') return Snap(log, variables, atoms, shot=snapshot)
def snap(): import asyncio from collections import namedtuple # Use dataclass in Python 3.7 Min = 'v38s' Cycle = 13 Frame = 50 opt = 'cro-opt' i = str(Cycle) + '-' + str(Frame) pth = 'snapshots-' + str(Min) log = pth + '/' + opt + '-' + i + '.log' optc = pth + '/' + opt + '-' + i + '-opt.c' na, atoms, _ = read_c(optc) variables = define_variables() loop = asyncio.get_event_loop() semaphore = asyncio.Semaphore(CONCUR_TASKS) verbose = True mode = 'analyse' snapshot = loop.run_until_complete(read_one( Min, Cycle, Frame, variables, mode, semaphore, verbose)) Snap = namedtuple('snap', 'log variables atoms shot Min Cycle Frame') return Snap(log, variables, atoms, snapshot, Min, Cycle, Frame)