Force Match

Functions

vector< int > Blob::get_bead_assignment (int i)
 returns the list of nodes where bead i should be assigned to. More...
 
void Blob::get_bead_position (int i, arr3 &v)
 returns the position of bead i. More...
 
int * Blob::get_bead_type_ptr ()
 returns the bead_type pointer. More...
 
int Blob::get_bead_type (int i)
 returns the bead_type of bead i. More...
 
int Blob::load_beads (const char *beads_filename, PreComp_params *pc_params, scalar scale)
 Read the beads_filename, loading beads position and types. More...
 
int Blob::forget_beads ()
 num_beads = 0; delete bead_type; delete bead_position. More...
 
 PreComp_solver::PreComp_solver ()
 
 PreComp_solver::~PreComp_solver ()
 destructor: deallocates pointers. More...
 
int PreComp_solver::msg (int whatever)
 
int PreComp_solver::msg (string whatever)
 
void PreComp_solver::reset_fieldenergy ()
 
int PreComp_solver::init (PreComp_params *pc_params, SimulationParams *params, Blob **blob_array)
 Read input precomputed tables. More...
 
int PreComp_solver::solve_using_neighbours_non_critical (scalar *blob_corr=NULL)
 using linkedlists, calculate twice the forces to avoid any critical regions. More...
 
int PreComp_solver::solve_using_neighbours ()
 calculate the forces using linkedlists. More...
 
int PreComp_solver::solve (scalar *blob_corr=NULL)
 calculate the forces using a straightforward double loop. More...
 
int PreComp_solver::compute_bead_positions ()
 calculate b_pos, the absolute positions of the beads. More...
 
int PreComp_solver::calc_force_from_pot ()
 
int PreComp_solver::read_tabulated_values (PreComp_params &pc_params, string kind, scalar *Z, scalar scale_Z)
 
scalar PreComp_solver::get_U (scalar x, int typei, int typej)
 Use finterpolate to return the value for U at x between types i and j. More...
 
scalar PreComp_solver::get_F (scalar x, int typei, int typej)
 Use finterpolate to return the value for F at x between types i and j. More...
 
scalar PreComp_solver::finterpolate (scalar *Z, scalar x, int typei, int typej)
 Get the value Z value (either U or F) at x between types typei and typej. More...
 
scalar PreComp_solver::get_field_energy (int index0, int index1)
 
int PreComp_solver::build_pc_nearest_neighbour_lookup ()
 put the beads on the grid. More...
 
int PreComp_solver::prebuild_pc_nearest_neighbour_lookup_and_swap ()
 put the beads on the grid. More...
 
int PreComp_solver::prebuild_pc_nearest_neighbour_lookup ()
 put the beads on the grid. More...
 
int PreComp_solver::safely_swap_pc_layers ()
 swap the two LinkedLists. More...
 
void PreComp_solver::write_beads_to_file (FILE *fout, int timestep)
 write beads to file, for the current timestep More...
 

Variables

static const int PreComp_solver::adjacent_cells [27][3]
 

Detailed Description

Function Documentation

◆ build_pc_nearest_neighbour_lookup()

int PreComp_solver::build_pc_nearest_neighbour_lookup ( )

put the beads on the grid.

Referenced by World::run().

◆ calc_force_from_pot()

int PreComp_solver::calc_force_from_pot ( )
private

Calculate F as the numerical derivative of U, instead of reading .force files

Parameters
[in]inttotal_int: total number of different interactions.

Referenced by PreComp_solver::init().

◆ compute_bead_positions()

int PreComp_solver::compute_bead_positions ( )

◆ finterpolate()

scalar PreComp_solver::finterpolate ( scalar Z,
scalar  x,
int  typei,
int  typej 
)
private

Get the value Z value (either U or F) at x between types typei and typej.

The function is currently private and accessed through get_U and get_F. For production purposes it may be reasonable to move it to public, and remove get_U and get_F

Referenced by PreComp_solver::get_F(), and PreComp_solver::get_U().

◆ forget_beads()

int Blob::forget_beads ( )

num_beads = 0; delete bead_type; delete bead_position.

Beads are only useful before PreComp_solver.init is called. They can be removed later on.

Beads are only useful before PreComp_solver.init is called.

  • They can be removed later on.

Referenced by PreComp_solver::init().

◆ get_bead_assignment()

vector< int > Blob::get_bead_assignment ( int  i)

returns the list of nodes where bead i should be assigned to.

Referenced by PreComp_solver::init().

◆ get_bead_position()

void Blob::get_bead_position ( int  i,
arr3 v 
)

returns the position of bead i.

get_bead_position i onto arr3 v [precomp]

Referenced by PreComp_solver::init().

◆ get_bead_type()

int Blob::get_bead_type ( int  i)

returns the bead_type of bead i.

get_bead_type [precomp]

◆ get_bead_type_ptr()

int * Blob::get_bead_type_ptr ( )

returns the bead_type pointer.

get the pointer to "bead_type" [precomp]

◆ get_F()

scalar PreComp_solver::get_F ( scalar  x,
int  typei,
int  typej 
)

Use finterpolate to return the value for F at x between types i and j.

Compute (through finterpolate) the value of the potential at x between bead types typei and typej. Kept just for clarity, may be removed in the future.

Referenced by PreComp_solver::solve(), PreComp_solver::solve_using_neighbours(), and PreComp_solver::solve_using_neighbours_non_critical().

◆ get_field_energy()

scalar PreComp_solver::get_field_energy ( int  index0,
int  index1 
)

◆ get_U()

scalar PreComp_solver::get_U ( scalar  x,
int  typei,
int  typej 
)

Use finterpolate to return the value for U at x between types i and j.

Compute (through finterpolate) the value of the potential at x between bead types typei and typej. Kept just for clarity, may be removed in the future.

Referenced by PreComp_solver::solve(), PreComp_solver::solve_using_neighbours(), and PreComp_solver::solve_using_neighbours_non_critical().

◆ init()

int PreComp_solver::init ( PreComp_params pc_params,
SimulationParams params,
Blob **  blob_array 
)

Read input precomputed tables.

Parameters
[in]vector<string>types: types of beads present.
[in]intinputData: 1 means read .force and .pot files, while 2 means read .pot and calculate the forces

read <type_i>-<type_j>.force and <type_i>-<type_j>.pot files for all the possible pairs, setting up the potential functions. All the .pot and .force files need to have the same x_range same Dx, and same number of points. It is allowed, however, that they have a different number of lines at the beginning starting with "#".

Referenced by World::init().

◆ load_beads()

int Blob::load_beads ( const char *  beads_filename,
PreComp_params pc_params,
scalar  scale 
)
private

Read the beads_filename, loading beads position and types.

Opens and reads the given 'ffea beads file', extracting all the beads types and positions and for this Blob.

Referenced by Blob::init().

◆ msg() [1/2]

int PreComp_solver::msg ( string  whatever)
private

◆ msg() [2/2]

int PreComp_solver::msg ( int  whatever)
private

◆ prebuild_pc_nearest_neighbour_lookup()

int PreComp_solver::prebuild_pc_nearest_neighbour_lookup ( )

put the beads on the grid.

Referenced by World::init(), and World::run().

◆ prebuild_pc_nearest_neighbour_lookup_and_swap()

int PreComp_solver::prebuild_pc_nearest_neighbour_lookup_and_swap ( )

put the beads on the grid.

◆ PreComp_solver()

PreComp_solver::PreComp_solver ( )

◆ read_tabulated_values()

int PreComp_solver::read_tabulated_values ( PreComp_params pc_params,
string  kind,
scalar Z,
scalar  scale_Z 
)
private

Read either the .pot or .force files and store its contents either in U or F

Referenced by PreComp_solver::init().

◆ reset_fieldenergy()

void PreComp_solver::reset_fieldenergy ( )

◆ safely_swap_pc_layers()

int PreComp_solver::safely_swap_pc_layers ( )

swap the two LinkedLists.

Referenced by World::die_with_dignity().

◆ solve()

int PreComp_solver::solve ( scalar blob_corr = NULL)

calculate the forces using a straightforward double loop.

◆ solve_using_neighbours()

int PreComp_solver::solve_using_neighbours ( )

calculate the forces using linkedlists.

◆ solve_using_neighbours_non_critical()

int PreComp_solver::solve_using_neighbours_non_critical ( scalar blob_corr = NULL)

using linkedlists, calculate twice the forces to avoid any critical regions.

Referenced by World::run().

◆ write_beads_to_file()

void PreComp_solver::write_beads_to_file ( FILE *  fout,
int  timestep 
)

write beads to file, for the current timestep

Referenced by World::print_trajectory_and_measurement_files().

◆ ~PreComp_solver()

PreComp_solver::~PreComp_solver ( )

destructor: deallocates pointers.

Variable Documentation

◆ adjacent_cells

const int PreComp_solver::adjacent_cells
staticprivate
Initial value:
= {
{-1, -1, -1},
{-1, -1, 0},
{-1, -1, +1},
{-1, 0, -1},
{-1, 0, 0},
{-1, 0, +1},
{-1, +1, -1},
{-1, +1, 0},
{-1, +1, +1},
{0, -1, -1},
{0, -1, 0},
{0, -1, +1},
{0, 0, -1},
{0, 0, 0},
{0, 0, +1},
{0, +1, -1},
{0, +1, 0},
{0, +1, +1},
{+1, -1, -1},
{+1, -1, 0},
{+1, -1, +1},
{+1, 0, -1},
{+1, 0, 0},
{+1, 0, +1},
{+1, +1, -1},
{+1, +1, 0},
{+1, +1, +1}
}

Referenced by PreComp_solver::solve_using_neighbours(), and PreComp_solver::solve_using_neighbours_non_critical().