Esempio n. 1
0
def setup_system():
    # create a store
    writer = pdb_writer.PDBWriter(range(N_ATOMS), ["CA"] * N_ATOMS, [1] * N_ATOMS, ["ALA"] * N_ATOMS)
    store = vault.DataStore(N_ATOMS, N_REPLICAS, writer, block_size=BACKUP_FREQ)
    store.initialize(mode="w")

    # create and store the remd_runner
    l = ladder.NearestNeighborLadder(n_trials=100)
    policy = adaptor.AdaptationPolicy(1.0, 50, 100)
    a = adaptor.EqualAcceptanceAdaptor(n_replicas=N_REPLICAS, adaptation_policy=policy)
    remd_runner = master_runner.MasterReplicaExchangeRunner(N_REPLICAS, max_steps=N_STEPS, ladder=l, adaptor=a)
    store.save_remd_runner(remd_runner)

    # create and store the communicator
    c = comm.MPICommunicator(N_ATOMS, N_REPLICAS)
    store.save_communicator(c)

    # create and store the fake system
    s = helper.FakeSystem()
    s.temperature_scaler = ConstantTemperatureScaler(300.0)
    store.save_system(s)

    # create and store the options
    o = RunOptions()
    o.runner = "fake_runner"
    store.save_run_options(o)

    # create and save the initial states
    states = [gen_state(i) for i in range(N_REPLICAS)]
    store.save_states(states, 0)

    # save data_store
    store.save_data_store()
Esempio n. 2
0
 def test_runner_equals_fake_runner_should_create_fake_runner(self):
     system = mock.Mock()
     comm = mock.Mock()
     options = RunOptions()
     options.runner = "fake_runner"
     with mock.patch("meld.system.runner.FakeSystemRunner") as mock_runner:
         get_runner(system, options, comm)
         self.assertEqual(mock_runner.call_count, 1)
Esempio n. 3
0
 def test_runner_equals_openmm_should_create_openmm_runner(self):
     system = mock.Mock()
     comm = mock.Mock()
     options = RunOptions()
     options.runner = "openmm"
     with mock.patch("meld.system.openmm_runner.runner.OpenMMRunner") as mock_runner:
         get_runner(system, options, comm)
         self.assertEqual(mock_runner.call_count, 1)
Esempio n. 4
0
 def test_runner_equals_fake_runner_should_create_fake_runner(self):
     system = mock.Mock()
     comm = mock.Mock()
     options = RunOptions()
     options.runner = 'fake_runner'
     with mock.patch('meld.system.runner.FakeSystemRunner') as mock_runner:
         get_runner(system, options, comm)
         self.assertEqual(mock_runner.call_count, 1)
Esempio n. 5
0
 def test_runner_equals_openmm_should_create_openmm_runner(self):
     system = mock.Mock()
     comm = mock.Mock()
     options = RunOptions()
     options.runner = 'openmm'
     with mock.patch('meld.system.runner.OpenMMRunner') as mock_runner:
         get_runner(system, options, comm)
         self.assertEqual(mock_runner.call_count, 1)
Esempio n. 6
0
def setup_system():
    # create a store
    writer = pdb_writer.PDBWriter(range(N_ATOMS), ['CA'] * N_ATOMS,
                                  [1] * N_ATOMS, ['ALA'] * N_ATOMS)
    store = vault.DataStore(N_ATOMS,
                            N_REPLICAS,
                            writer,
                            block_size=BACKUP_FREQ)
    store.initialize(mode='w')

    # create and store the remd_runner
    l = ladder.NearestNeighborLadder(n_trials=100)
    policy = adaptor.AdaptationPolicy(1.0, 50, 100)
    a = adaptor.EqualAcceptanceAdaptor(n_replicas=N_REPLICAS,
                                       adaptation_policy=policy)
    remd_runner = master_runner.MasterReplicaExchangeRunner(N_REPLICAS,
                                                            max_steps=N_STEPS,
                                                            ladder=l,
                                                            adaptor=a)
    store.save_remd_runner(remd_runner)

    # create and store the communicator
    c = comm.MPICommunicator(N_ATOMS, N_REPLICAS)
    store.save_communicator(c)

    # create and store the fake system
    s = helper.FakeSystem()
    s.temperature_scaler = ConstantTemperatureScaler(300.)
    store.save_system(s)

    # create and store the options
    o = RunOptions()
    o.runner = 'fake_runner'
    store.save_run_options(o)

    # create and save the initial states
    states = [gen_state(i) for i in range(N_REPLICAS)]
    store.save_states(states, 0)

    # save data_store
    store.save_data_store()
Esempio n. 7
0
 def test_raises_when_system_has_no_temperature_scaler(self):
     self.system.temperature_scaler = None
     with self.assertRaises(RuntimeError):
         OpenMMRunner(self.system, RunOptions())
Esempio n. 8
0
 def setUp(self):
     self.options = RunOptions()
Esempio n. 9
0
 def setUp(self):
     self.options = RunOptions(solvation="explicit")