Ejemplo n.º 1
0
def main():
    # create the system
    p = system.SubSystemFromSequence("NALA ALA CALA")
    b = system.SystemBuilder()
    s = b.build_system([p])
    with open("tri_ala.top", "w") as outfile:
        outfile.write(s._top_string)
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.SubSystemFromSequence(sequence)
    b = system.SystemBuilder()
    s = b.build_system([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()

    # 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 = leader.LeaderReplicaExchangeRunner(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