Ejemplo n.º 1
0
def setup_system():
    # get the sequence
    sequence = "AAAAAAAAAAAAAAAA"
    sequence = parse.get_sequence_from_AA1(contents=sequence)
    # create the system
    p = system.ProteinMoleculeFromSequence(sequence)
    b = system.SystemBuilder()
    s = b.build_system_from_molecules([p])
    s.temperature_scaler = system.LinearTemperatureScaler(0, 1, 300, 310)

    rest_scaler = s.restraints.create_scaler("nonlinear",
                                             alpha_min=0,
                                             alpha_max=1,
                                             factor=4.0)
    secondary = "H" * 16
    secondary_restraints = parse.get_secondary_structure_restraints(
        system=s, scaler=rest_scaler, contents=secondary)
    s.restraints.add_selectively_active_collection(secondary_restraints,
                                                   len(secondary_restraints))

    # create the options
    options = system.RunOptions()
    options.use_big_timestep = True

    # create a store
    store = vault.DataStore(s.n_atoms,
                            N_REPLICAS,
                            s.get_pdb_writer(),
                            block_size=BACKUP_FREQ)
    store.initialize(mode="w")
    store.save_system(s)
    store.save_run_options(options)

    # create and store the remd_runner
    l = ladder.NearestNeighborLadder(n_trials=1)
    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(s.n_atoms, N_REPLICAS)
    store.save_communicator(c)

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

    # save data_store
    store.save_data_store()

    return s.n_atoms
Ejemplo n.º 2
0
def setup_system():
    # get the sequence
    sequence = 'AAAAAAAAAAAAAAAA'
    sequence = parse.get_sequence_from_AA1(contents=sequence)
    # create the system
    p = system.ProteinMoleculeFromSequence(sequence)
    b = system.SystemBuilder()
    s = b.build_system_from_molecules([p])
    s.temperature_scaler = system.LinearTemperatureScaler(0, 1, 300, 310)

    rest_scaler = s.restraints.create_scaler('nonlinear', alpha_min=0, alpha_max=1, factor=4.0)
    secondary = 'H'*16
    secondary_restraints = parse.get_secondary_structure_restraints(system=s, scaler=rest_scaler,
                                                                          contents=secondary)
    s.restraints.add_selectively_active_collection(secondary_restraints, len(secondary_restraints))

    # create com restraint
    com = s.restraints.create_restraint('com', rest_scaler, ramp=None,
                                        group1=[(1, 'CA')],
                                        group2=[(3, 'CA')],
                                        weights1=None,
                                        weights2=None,
                                        dims='xyz',
                                        force_const=100.,
                                        distance=0.5)
    s.restraints.add_as_always_active(com)

    # create absolute com restraint
    com = s.restraints.create_restraint('abs_com', rest_scaler, ramp=None,
                                        group=[(1, 'CA')],
                                        weights=None,
                                        dims='xyz',
                                        force_const=1.,
                                        position=[0., 0., 0.])
    s.restraints.add_as_always_active(com)

    # create the options
    options = system.RunOptions()

    # create a store
    store = vault.DataStore(s.n_atoms, N_REPLICAS, s.get_pdb_writer(), block_size=BACKUP_FREQ)
    store.initialize(mode='w')
    store.save_system(s)
    store.save_run_options(options)

    # create and store the remd_runner
    l = ladder.NearestNeighborLadder(n_trials=1)
    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(s.n_atoms, N_REPLICAS)
    store.save_communicator(c)

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

    # save data_store
    store.save_data_store()

    return s.n_atoms