World Class Reference

#include <World.h>

Public Member Functions

 World ()
 
 ~World ()
 
int init (string FFEA_script_filename, int frames_to_delete, int mode, bool writeEnergy)
 Reads the .ffea file and initialises the World. More...
 
int get_smallest_time_constants ()
 Finds the largest allowed timesteps. More...
 
int lem (set< int > blob_indices, int num_modes)
 Calculates an linear elastic model for a given blob. More...
 
int dmm (set< int > blob_indices, int num_modes)
 Calculates an dynamic mode model for a given blob. More...
 
int dmm_rp (set< int > blob_indices, int num_modes)
 Calculates an elastic network model for a given blob. More...
 
int run ()
 
int read_and_build_system (vector< string > script_vector)
 Parses <blobs>, <springs>, <rods> and <precomp>. More...
 
int load_kinetic_maps (vector< string > map_fnames, vector< int > map_from, vector< int > map_to, int blob_index)
 Loads the maps from a given blob. More...
 
int build_kinetic_identity_maps ()
 Builds additional maps for energy calculations. More...
 
int load_kinetic_states (string states_fname, int blob_index)
 
int load_kinetic_rates (string rates_fname, int blob_index)
 
void print_kinetic_rates_to_screen (int type)
 
void get_system_CoM (vector3 *system_CoM)
 
void get_system_centroid (vector3 *centroid)
 
void get_system_dimensions (vector3 *dimenstion_vector)
 
int enm (int *blob_index, int num_modes)
 
int get_num_blobs ()
 

Private Member Functions

int load_springs (const char *fname)
 
rod::Rod_blob_interfacerod_blob_interface_from_block (vector< string > block, int interface_id, FFEA_input_reader *systemreader, rod::Rod **rod_array, Blob **blob_array)
 
rod::Rodrod_from_block (vector< string > block, int block_id, FFEA_input_reader *systemreader)
 
void activate_springs ()
 
int apply_springs ()
 
scalar get_spring_field_energy (int index0, int index1)
 
int calculate_kinetic_rates ()
 calculates the kinetic rates as a function of the energy of the system More...
 
int choose_new_kinetic_state (int blob_index, int *target)
 randomly chooses a new kinetic state based upon the kinetic rates / switching probabilitie More...
 
int change_kinetic_state (int blob_index, int target_state)
 changes the kinetic state based upon the kinetic rates. Maps between conformations and adds/ removes bound sites More...
 
int get_next_script_tag (FILE *in, char *buf)
 
void apply_dense_matrix (scalar *y, scalar *M, scalar *x, int N)
 
void do_es ()
 
void make_trajectory_from_eigenvector (string traj_out_fname, int blob_index, int mode_index, Eigen_VectorX evec, scalar step)
 Calculates a pseudo-trajectory by varying an eigenvector by a constant factor. More...
 
void print_evecs_to_file (string fname, Eigen_MatrixX ev, int num_rows, int num_modes)
 
void print_evals_to_file (string fname, Eigen_VectorX ev, int num_modes, scalar scale)
 
void write_eig_to_files (scalar *evals_ordered, scalar **evecs_ordered, int num_modes, int num_nodes)
 Writes eigensystems to files in order. More...
 
void write_output_header (FILE *fout, string fname)
 
void print_trajectory_and_measurement_files (int step, scalar wtime)
 
void print_checkpoints ()
 
void write_pre_print_to_trajfile (int step)
 
void do_nothing ()
 
int prebuild_nearest_neighbour_lookup_wrapper (scalar cell_size)
 
void make_measurements ()
 
void write_measurements_to_file (FILE *fout, int step)
 
void write_detailed_measurements_to_file (FILE *fout)
 
void print_trajectory_conformation_changes (FILE *fout, int step, int *from_index, int *to_index)
 
void print_kinetic_files (int step)
 
void print_static_trajectory (int step, scalar wtime, int blob_index)
 
void calc_blob_corr_matrix (int num_blobs, scalar *blob_corr)
 calculates the blob to blob corrections due to periodic boundary conditions More...
 
int die_with_dignity (int step, scalar wtime)
 

Private Attributes

Blob ** blob_array
 2-D Array of Blob objects (blob i, conformation j) More...
 
Blob ** active_blob_array
 Which conformation is active in each blob. More...
 
rod::Rod ** rod_array
 1-D array containing pointers to all rod objects More...
 
rod::Rod_blob_interface ** rod_blob_interface_array
 1-D array containing pointers to all rod-blob interfaces More...
 
SparseMatrixFixedPattern *** kinetic_map
 Maps for kinetic switching of conformations. More...
 
SparseMatrixFixedPattern **** kinetic_return_map
 
Springspring_array
 An array of springs which connect nodes if necessary. More...
 
int num_springs
 And how many springs are there? More...
 
int num_binding_sites
 How many kinetic binding sites are there? More...
 
bool mass_in_system
 Check whether mass is present anywhere, to determine whether or not to write kinetic energies to files. More...
 
int num_threads
 How many threads are available for parallelisation. More...
 
RngStreamrng
 An array of pointers to random number generators (for use in parallel) More...
 
unsigned long ** Seeds
 A pointer to an array of arrays, containing the seeds of the different RNGStreams. More...
 
int num_seeds
 The number of seeds stored in Seeds. More...
 
RngStreamkinetic_rng
 An array of pointers to random number generators for use in kinetics. More...
 
SimulationParams params
 Parameters being used for this simulation. More...
 
NearestNeighbourLinkedListCube lookup
 Data structure keeping track of which `cell' each face lies in (where the world has been discretised into a grid of cells of dimension 1.5 kappa) so that the BEM matrices may be constructed quickly and sparsely. More...
 
FILE * trajectory_out
 Output trajectory file. More...
 
FILE * kinetics_out
 Output kinetics file. More...
 
FILE * measurement_out
 Output measurement file. More...
 
bool writeDetailed
 Output detailed measurements file. May be unneccesary. More...
 
FILE * detailed_meas_out
 
FILE * trajbeads_out
 Output file for the trajectory beads. Completely optional. More...
 
FFEA_input_readerffeareader
 
FFEA_input_readersystemreader
 
vector3 L
 
FILE * checkpoint_out
 
  • Output Checkpoint file
More...
 
BEM_Poisson_Boltzmann PB_solver
 BEM solver for the exterior electrostatics. More...
 
int total_num_surface_faces
 Number of surface faces in entire system. More...
 
scalarphi_Gamma
 Vector of the electrostatic potential on each surface in entire system. More...
 
scalarJ_Gamma
 
scalarwork_vec
 
BiCGSTAB_solver nonsymmetric_solver
 Biconjugate gradient stabilised solver for nonsymmetric matrices. More...
 
VdW_solvervdw_solver
 
SSINT_matrix ssint_matrix
 LJ parameters matrix. More...
 
BindingSite_matrix binding_matrix
 Binding Interactions matrix. More...
 
PreComp_params pc_params
 stores info within the <precomp> block at the .ffea file. More...
 
PreComp_solver pc_solver
 PreComputed potentials solver. More...
 
vector3 box_dim
 
long long step_initial
 
scalarblob_corr
 
KineticState ** kinetic_state
 Kinetic State and Rate objects. More...
 
scalar *** kinetic_rate
 
scalar *** kinetic_base_rate
 
scalar kineticenergy
 
scalar strainenergy
 
scalar springenergy
 
scalar ** springfieldenergy
 
scalar ssintenergy
 
scalar preCompenergy
 
vector3 CoM
 
vector3 CoG
 
scalar rmsd
 

Friends

struct ffea_test
 

Constructor & Destructor Documentation

◆ World()

World::World ( )

◆ ~World()

World::~World ( )

Member Function Documentation

◆ activate_springs()

void World::activate_springs ( )
private

◆ apply_dense_matrix()

void World::apply_dense_matrix ( scalar y,
scalar M,
scalar x,
int  N 
)
private

◆ apply_springs()

int World::apply_springs ( )
private

Referenced by run().

◆ build_kinetic_identity_maps()

int World::build_kinetic_identity_maps ( )

Builds additional maps for energy calculations.

This function uses the existing kinetic maps to build 'return_maps', which are used for energy calculations and comparisons

Referenced by read_and_build_system().

◆ calc_blob_corr_matrix()

void World::calc_blob_corr_matrix ( int  num_blobs,
scalar blob_corr 
)
private

calculates the blob to blob corrections due to periodic boundary conditions

Referenced by run().

◆ calculate_kinetic_rates()

int World::calculate_kinetic_rates ( )
private

calculates the kinetic rates as a function of the energy of the system

Calculates kinetic rates based upon the current state of the blob.

This function alters the given kinetic_rates using the energy of the system. The average rate throughout the simulation should still be the given values.

Referenced by run().

◆ change_kinetic_state()

int World::change_kinetic_state ( int  blob_index,
int  target_state 
)
private

changes the kinetic state based upon the kinetic rates. Maps between conformations and adds/ removes bound sites

Changes the active kinetic state for a given blob.

Parameters
[in]intblob_index Index of the blob to be changed
[in]inttarget_state State the blob should be changed to

This function changes the kinetic state of the blob. For a conformational change, the current structure is mapped to the target and the active_blob_array[i] pointer is updated. For a binding / unbinding event, the binding sites are activated.

Referenced by run().

◆ choose_new_kinetic_state()

int World::choose_new_kinetic_state ( int  blob_index,
int *  target 
)
private

randomly chooses a new kinetic state based upon the kinetic rates / switching probabilitie

Selects a new states based on the current kinetic rates.

Parameters
[in]intblob_index Which blob wants to switch
[in]int*target A list of potential states

This function randomly chooses a state to switch to out of the given allowed taget states based upon the current kinetic rates.

Referenced by run().

◆ die_with_dignity()

int World::die_with_dignity ( int  step,
scalar  wtime 
)
private

Referenced by run().

◆ dmm()

int World::dmm ( set< int >  blob_indices,
int  num_modes 
)

Calculates an dynamic mode model for a given blob.

Parameters
[in]set<int>List of blobs to get Dynamic Mode Model
[in]intnum_modes The number of modes / eigenvalues to be calculated

By linearising the elasticity vector around the initial position, this function performs matrix algebra using the Eigen libraries to diagonalise the coupling between the elasticity and viscosity matrices, and outputs pseudo-trajectories based upon these eigenvectors

Referenced by main().

◆ dmm_rp()

int World::dmm_rp ( set< int >  blob_indices,
int  num_modes 
)

Calculates an elastic network model for a given blob.

Parameters
[in]set<int>List of blobs to get Elastic Network Model
[in]intnum_modes The number of modes / eigenvalues to be calculated

By linearising the elasticity vector around the initial position, this function performs matrix algebra using the Eigen libraries to diagonalise the coupling between the elasticity and rotne-praga viscosity matrices, and outputs pseudo-trajectories based upon these eigenvectors

Referenced by main().

◆ do_es()

void World::do_es ( )
private

Referenced by run().

◆ do_nothing()

void World::do_nothing ( )
private

Referenced by init().

◆ enm()

int World::enm ( int *  blob_index,
int  num_modes 
)

◆ get_next_script_tag()

int World::get_next_script_tag ( FILE *  in,
char *  buf 
)
private

◆ get_num_blobs()

int World::get_num_blobs ( )

Referenced by main().

◆ get_smallest_time_constants()

int World::get_smallest_time_constants ( )

Finds the largest allowed timesteps.

By linearising the equation of motion, this function performs matrix algebra using the Eigen libraries to find the largest allowed timestep for ffea numerical integration.

Referenced by main().

◆ get_spring_field_energy()

scalar World::get_spring_field_energy ( int  index0,
int  index1 
)
private

◆ get_system_centroid()

void World::get_system_centroid ( vector3 centroid)

Blob centroid

Rod centroid

I'm leaving it like this and there's nothing you can do about it

Referenced by init().

◆ get_system_CoM()

void World::get_system_CoM ( vector3 system_CoM)

◆ get_system_dimensions()

void World::get_system_dimensions ( vector3 dimenstion_vector)

Referenced by init().

◆ init()

int World::init ( string  FFEA_script_filename,
int  frames_to_delete,
int  mode,
bool  writeDetail 
)

Reads the .ffea file and initialises the World.

Parameters
[in]stringFFEA_script_filename

Open and read .ffea file, parse the block through SimulationParams::extract_params in the "SimulationParams params" private attribute, parse the <blobs> and <springs> blocks through World::read_and_build_system initialise a number of RNG, prepare output files, initialise VdW solver, initialise BEM PBE solver

Referenced by ffea_test::connection_energy(), ffea_test::connection_energy_2(), ffea_test::connection_energy_3(), ffea_test::connection_orientation_test(), ffea_test::connection_propagation(), ffea_test::connection_test(), ffea_test::identify_face(), load_kinetic_states(), ffea_test::lower_sphere(), main(), read_and_build_system(), and ffea_test::recover_normal().

◆ lem()

int World::lem ( set< int >  blob_indices,
int  num_modes 
)

Calculates an linear elastic model for a given blob.

Parameters
[in]set<int>List of blobs to get Linear Elastic Model
[in]intnum_modes The number of modes / eigenvalues to be calculated

By linearising the elasticity vector around the initial position, this function performs matrix algebra using the Eigen libraries to diagonalise elasticity matrix and output pseudo-trajectories based upon these eigenvectors

Referenced by main().

◆ load_kinetic_maps()

int World::load_kinetic_maps ( vector< string >  map_fnames,
vector< int >  map_from,
vector< int >  map_to,
int  blob_index 
)

Loads the maps from a given blob.

Parameters
[in]vector<string>map_fnames A vector of maps to load
[in]vector<int>map_from Which conformation the maps are from
[in]vector<int>map_to Which conformation the maps go to
[in]intblob_index Which blob the maps belong to

This function reads in the maps required for kinetic switching between conformations. Does no error checking for correct number of maps

Referenced by read_and_build_system().

◆ load_kinetic_rates()

int World::load_kinetic_rates ( string  rates_fname,
int  blob_index 
)

Referenced by read_and_build_system().

◆ load_kinetic_states()

int World::load_kinetic_states ( string  states_fname,
int  blob_index 
)

Referenced by read_and_build_system().

◆ load_springs()

int World::load_springs ( const char *  fname)
private

Referenced by read_and_build_system().

◆ make_measurements()

void World::make_measurements ( )
private

◆ make_trajectory_from_eigenvector()

void World::make_trajectory_from_eigenvector ( string  traj_out_fname,
int  blob_index,
int  mode_index,
Eigen_VectorX  evec,
scalar  step 
)
private

Calculates a pseudo-trajectory by varying an eigenvector by a constant factor.

This function takes an Eigen::VectorXd and applies it as a series of translations to the given blob.

Referenced by dmm(), dmm_rp(), and lem().

◆ prebuild_nearest_neighbour_lookup_wrapper()

int World::prebuild_nearest_neighbour_lookup_wrapper ( scalar  cell_size)
private

Referenced by die_with_dignity(), init(), and run().

◆ print_checkpoints()

void World::print_checkpoints ( )
private

Print the RNG values responsible for the current state of the system i.e. do this before all forces are calculated, which advances the system

Referenced by run().

◆ print_evals_to_file()

void World::print_evals_to_file ( string  fname,
Eigen_VectorX  ev,
int  num_modes,
scalar  scale 
)
private

Referenced by dmm(), dmm_rp(), and lem().

◆ print_evecs_to_file()

void World::print_evecs_to_file ( string  fname,
Eigen_MatrixX  ev,
int  num_rows,
int  num_modes 
)
private

Referenced by dmm(), dmm_rp(), and lem().

◆ print_kinetic_files()

void World::print_kinetic_files ( int  step)
private

Referenced by die_with_dignity(), and run().

◆ print_kinetic_rates_to_screen()

void World::print_kinetic_rates_to_screen ( int  type)

◆ print_static_trajectory()

void World::print_static_trajectory ( int  step,
scalar  wtime,
int  blob_index 
)
private

◆ print_trajectory_and_measurement_files()

void World::print_trajectory_and_measurement_files ( int  step,
scalar  wtime 
)
private

Write trajectory for each blob, then do blob specific measurements (which are needed for globals, but only explicitly printed if "-d" was used)

Referenced by ffea_test::connection_energy(), ffea_test::connection_orientation_test(), die_with_dignity(), ffea_test::identify_face(), and run().

◆ print_trajectory_conformation_changes()

void World::print_trajectory_conformation_changes ( FILE *  fout,
int  step,
int *  from_index,
int *  to_index 
)
private

◆ read_and_build_system()

int World::read_and_build_system ( vector< string >  script_vector)

Parses <blobs>, <springs>, <rods> and <precomp>.

Parameters
[in]vector<string>script_vector, which is essentially the FFEA input file, line by line, as it comes out of FFEA_input_reader::file_to_lines

Referenced by init().

◆ rod_blob_interface_from_block()

rod::Rod_blob_interface * World::rod_blob_interface_from_block ( vector< string >  block,
int  interface_id,
FFEA_input_reader systemreader,
rod::Rod **  rod_array,
Blob **  blob_array 
)
private

Referenced by read_and_build_system().

◆ rod_from_block()

rod::Rod * World::rod_from_block ( vector< string >  block,
int  block_id,
FFEA_input_reader systemreader 
)
private

Referenced by read_and_build_system().

◆ run()

int World::run ( )

◆ write_detailed_measurements_to_file()

void World::write_detailed_measurements_to_file ( FILE *  fout)
private

◆ write_eig_to_files()

void World::write_eig_to_files ( scalar evals_ordered,
scalar **  evecs_ordered,
int  num_modes,
int  num_nodes 
)
private

Writes eigensystems to files in order.

This function writes the eigenvalues calculated for enms and dmms to files

◆ write_measurements_to_file()

void World::write_measurements_to_file ( FILE *  fout,
int  step 
)
private

◆ write_output_header()

void World::write_output_header ( FILE *  fout,
string  fname 
)
private

Referenced by init().

◆ write_pre_print_to_trajfile()

void World::write_pre_print_to_trajfile ( int  step)
private

Friends And Related Function Documentation

◆ ffea_test

friend struct ffea_test
friend

Field Documentation

◆ active_blob_array

◆ binding_matrix

BindingSite_matrix World::binding_matrix
private

Binding Interactions matrix.

Referenced by init(), load_kinetic_states(), and read_and_build_system().

◆ blob_array

Blob** World::blob_array
private

◆ blob_corr

scalar* World::blob_corr
private

◆ box_dim

vector3 World::box_dim
private

◆ checkpoint_out

FILE* World::checkpoint_out
private

  • Output Checkpoint file

Referenced by init(), print_checkpoints(), World(), and ~World().

◆ CoG

vector3 World::CoG
private

◆ CoM

vector3 World::CoM
private

Geometries

Referenced by World(), and ~World().

◆ detailed_meas_out

FILE* World::detailed_meas_out
private

◆ ffeareader

FFEA_input_reader* World::ffeareader
private

Reader objects

Referenced by init(), World(), and ~World().

◆ J_Gamma

scalar* World::J_Gamma
private

Referenced by do_es(), and init().

◆ kinetic_base_rate

◆ kinetic_map

SparseMatrixFixedPattern*** World::kinetic_map
private

Maps for kinetic switching of conformations.

Referenced by build_kinetic_identity_maps(), change_kinetic_state(), init(), load_kinetic_maps(), World(), and ~World().

◆ kinetic_rate

◆ kinetic_return_map

SparseMatrixFixedPattern**** World::kinetic_return_map
private

◆ kinetic_rng

RngStream* World::kinetic_rng
private

An array of pointers to random number generators for use in kinetics.

Referenced by choose_new_kinetic_state(), init(), and print_checkpoints().

◆ kinetic_state

KineticState** World::kinetic_state
private

Kinetic State and Rate objects.

Referenced by calculate_kinetic_rates(), change_kinetic_state(), init(), load_kinetic_states(), World(), and ~World().

◆ kineticenergy

scalar World::kineticenergy
private

◆ kinetics_out

FILE* World::kinetics_out
private

Output kinetics file.

Referenced by init(), print_kinetic_files(), World(), and ~World().

◆ L

vector3 World::L
private

Momenta

Referenced by World(), and ~World().

◆ lookup

NearestNeighbourLinkedListCube World::lookup
private

Data structure keeping track of which `cell' each face lies in (where the world has been discretised into a grid of cells of dimension 1.5 kappa) so that the BEM matrices may be constructed quickly and sparsely.

Referenced by die_with_dignity(), init(), and run().

◆ mass_in_system

bool World::mass_in_system
private

Check whether mass is present anywhere, to determine whether or not to write kinetic energies to files.

Referenced by init(), read_and_build_system(), World(), write_measurements_to_file(), and ~World().

◆ measurement_out

FILE* World::measurement_out
private

◆ nonsymmetric_solver

BiCGSTAB_solver World::nonsymmetric_solver
private

Biconjugate gradient stabilised solver for nonsymmetric matrices.

Referenced by do_es(), and init().

◆ num_binding_sites

int World::num_binding_sites
private

How many kinetic binding sites are there?

◆ num_seeds

int World::num_seeds
private

The number of seeds stored in Seeds.

Referenced by init(), print_checkpoints(), World(), and ~World().

◆ num_springs

int World::num_springs
private

And how many springs are there?

Referenced by activate_springs(), apply_springs(), load_springs(), make_measurements(), World(), and ~World().

◆ num_threads

int World::num_threads
private

How many threads are available for parallelisation.

Referenced by init(), print_checkpoints(), World(), and ~World().

◆ params

◆ PB_solver

BEM_Poisson_Boltzmann World::PB_solver
private

BEM solver for the exterior electrostatics.

Referenced by do_es(), and init().

◆ pc_params

PreComp_params World::pc_params
private

stores info within the <precomp> block at the .ffea file.

Referenced by init(), and read_and_build_system().

◆ pc_solver

◆ phi_Gamma

scalar* World::phi_Gamma
private

Vector of the electrostatic potential on each surface in entire system.

Referenced by do_es(), init(), World(), and ~World().

◆ preCompenergy

scalar World::preCompenergy
private

◆ rmsd

scalar World::rmsd
private

◆ rng

RngStream* World::rng
private

An array of pointers to random number generators (for use in parallel)

Referenced by ffea_test::connection_propagation(), init(), print_checkpoints(), read_and_build_system(), run(), World(), and ~World().

◆ rod_array

◆ rod_blob_interface_array

◆ Seeds

unsigned long** World::Seeds
private

A pointer to an array of arrays, containing the seeds of the different RNGStreams.

Referenced by init(), print_checkpoints(), World(), and ~World().

◆ spring_array

Spring* World::spring_array
private

An array of springs which connect nodes if necessary.

Referenced by activate_springs(), apply_springs(), load_springs(), make_measurements(), World(), and ~World().

◆ springenergy

scalar World::springenergy
private

◆ springfieldenergy

scalar ** World::springfieldenergy
private

◆ ssint_matrix

SSINT_matrix World::ssint_matrix
private

LJ parameters matrix.

Referenced by init(), and read_and_build_system().

◆ ssintenergy

scalar World::ssintenergy
private

◆ step_initial

long long World::step_initial
private

◆ strainenergy

scalar World::strainenergy
private

◆ systemreader

FFEA_input_reader* World::systemreader
private

◆ total_num_surface_faces

int World::total_num_surface_faces
private

Number of surface faces in entire system.

Referenced by do_es(), init(), World(), and ~World().

◆ trajbeads_out

FILE* World::trajbeads_out
private

Output file for the trajectory beads. Completely optional.

Referenced by init(), and print_trajectory_and_measurement_files().

◆ trajectory_out

FILE* World::trajectory_out
private

◆ vdw_solver

VdW_solver* World::vdw_solver
private

◆ work_vec

scalar* World::work_vec
private

Referenced by do_es(), and init().

◆ writeDetailed

bool World::writeDetailed
private

Output detailed measurements file. May be unneccesary.

Referenced by init(), World(), and ~World().


The documentation for this class was generated from the following files: