This callback specifies that a code block is providing logic to determine the strength of interaction between individuals. It should return the strength of the interaction as a numeric value. You must explicitly use return(value) at the end of the code block. For more information on how to use interaction() callback see SLiM Manual: page 604

interaction(int_type_id, subpop_id)

Arguments

int_type_id

The id of the InteractionType to apply this callback to. Can be an integer 1, 2, etc., or character "i1", "i2", etc.

subpop_id

The id(s) of the subpopulation(s) to which this callback should apply. Can be an integer 1, 2, etc., or character "p1", "p2", etc.

Value

None

Details

Global variables available in reproduction callbacks:

distance

The distance from receiver to exerter, in spatial simulations; NAN otherwise

strength

The default interaction strength calculated by the interaction function

receiver

The individual receiving the interaction (an object of class Individual)

exerter

The individual exerting the interaction (an object of class Individual)

subpop

The subpopulation in which the receiver and exerter live

Author

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)

Examples

slim_block(interaction(), {
  # custom interaction strength as a function of values held in exerter and receiver tagF element.
  return(dnorm(exerter.tagF, receiver.tagF, 0.1) / dnorm(0, 0, 0.1))
})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 interaction() {
#>     return(dnorm(exerter.tagF, receiver.tagF, 0.1)/dnorm(0, 0, 0.1));
#> }