wlcsim Fortran Codebase Structure

Should show image of code diagram
program wlcsim

Use a universal discretization scheme to simulate from WLCs through Gaussian chains.

The main entry point of the program is pretty useless as a starting point to understand the codebase, and simply calls one of several “versions” of the program built from our Brownian Dynamics/Monte Carlo API.

Program

program main

Loads in parameters from the input file. Calculates parameters used in simulation from input parameters. For each save point requested, uses either Bruno, Quinn, or Brad’s simulators to step forwards (in time or Monte Carlo steps) and writes the output and (optionally) the simulation state needed to restart the simulation.

Use :flap (command_line_interface()), precision (setup_runtime_floats()), params (wlcsim_params(), wlc_repsuffix(), maxfilenamelen(), save_simulation_state(), set_parameters(), initialize_wlcsim_data(), save_parameters(), printdescription(), printwindowstats())
Call to:stop_if_err(), setup_runtime_floats(), set_parameters(), initialize_wlcsim_data(), save_parameters(), save_simulation_state(), wlcsim_quinn(), wlcsim_bruno(), wlcsim_bruno_mc(), wlcsim_bruno_looping_events()

The actual hard work is done in the wlcsim_* files

Subroutines and functions

subroutine wlcsim_bruno(save_ind, wlc_p)

values from wlcsim_data

Parameters:
  • save_ind [integer,in]
  • wlc_p [wlcsim_params,in]
Use :

params (dp(), wlcsim_params(), pack_as_para(), printenergies(), printsiminfo())

Called from:

main

Call to:

initialize_energies_from_scratch(), mcsim(), verify_energies_from_scratch(), bdsim(), pack_as_para(), stress(), stressp(), energy_elas(), energy_self_chain(), printsiminfo(), printenergies()

subroutine wlcsim_quinn(save_ind, wlc_p)

Quinn’s branch of the Fortran codebase. This branch is set up for Monte-Carlo simulations with a particular focus on parallel tempering.

Parameters:
  • save_ind [integer,in] :: 1, 2, …
  • wlc_p [wlcsim_params,inout]
Use :

params, mpi

Called from:

main

Call to:

onlynode(), head_node(), worker_node(), printenergies(), printwindowstats(), printlinkingnumber()

The main entry points for our API are the mcsim.f03 and BDsim.f03 routines, which allow you to do Monte Carlo moves and Brownian Dynamics timesteps (respectively) given a set of energies (or forces, respectively) specified by the input in defines.inc.

Subroutines and functions

subroutine mcsim(wlc_p)

Perform Metropolis Hastings Monte Carlo moves on the system of polymers. Loops over move types (crank shaft, slide,…) and calls each energy function. Accepts move by the Metropolis condition on the change in energy. If accepted update system.

Parameters:wlc_p [wlcsim_params,inout] :: system varibles
Use :params (wlc_phit(), wlc_crossp(), wlc_abp(), wlc_dphi_l2(), wlc_ab(), wlc_ncross(), wlc_ind_exchange(), wlc_indphi(), wlc_rand_stat(), wlc_cross(), wlc_vol(), wlc_phi_l2(), wlc_nphi(), wlc_dphib(), wlc_attempts(), wlc_up(), wlc_crosssize(), wlc_ncrossp(), wlc_r(), wlc_success(), wlc_rp(), wlc_meth(), wlc_dphia(), wlc_phib(), printenergies(), wlcsim_params(), wlc_phia(), int_min(), nan(), wlc_nbend(), wlc_npointsmoved(), pack_as_para(), nmovetypes(), wlc_pointsmoved(), wlc_bendpoints(), wlcsim_params_recenter(), wlc_lk0(), wlc_lk(), wlc_tw(), wlc_wr(), wlc_vp(), wlc_u(), wlc_v(), wlc_r_gjk(), wlc_nucleosomewrap(), wlc_basepairs(), wlc_basepairs_prop()), energies, umbrella (umbrella_energy()), mersenne_twister, binning (addbead(), removebead()), update_ru (update_r()), polydispersity (length_of_chain(), chain_id(), leftmost_from()), linkingnumber (get_del_tw_wr_lk())
Called from:wlcsim_bruno(), wlcsim_bruno_looping_events(), wlcsim_bruno_mc(), worker_node(), onlynode()
Call to:list_confinement(), set_all_denergy_to_zero(), mc_move(), mc_cylinder(), mc_sterics(), mc_internucleosome(), check_rp_for_nan(), alexanderp_crank(), length_of_chain(), chain_id(), alexanderp_slide(), alexanderp(), mc_eelas(), mc_global_twist(), mc_bind(), pack_as_para(), de_self_crank(), energy_self_slide(), mc_int_chem(), mc_int_rep(), mc_int_super_rep(), mc_int_update(), mc_external_field(), mc_2bead_potential(), mc_explicit_binding(), umbrella_energy(), get_del_tw_wr_lk(), apply_energy_ison(), calc_all_de_from_dx(), sum_all_denergies(), accept_all_energies(), stop_if_err(), update_r(), printenergies(), leftmost_from(), mc_adapt(), wlcsim_params_recenter()

mcsim.f03 calls different subroutines that define possible Monte Carlo moves (like MC_reptationMove.f03) and then checks for whether the move should succeed by summing the various energies that are turned on (like mc_wlc.f90). Diagrams describing a few of the moves are provided here:

Should show images of moves Should show the image of spider move

MC_wlc

Paramters of moves are optimized over time by adapt.f90.

Subroutines and functions

subroutine mc_adapt(wlc_p, mctype)

values from wlcsim_data

Parameters:
  • wlc_p [wlcsim_params,in]
  • mctype [integer,in] :: Type of move
Use :

params

Called from:

mcsim()