forked from Cell-veto/postlhc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharddisk.hpp
42 lines (35 loc) · 894 Bytes
/
harddisk.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// (c) 2015-2016 Sebastian Kapfer <[email protected]>, FAU Erlangen
#ifndef HARDDISK_HPP_INCLUDED
#define HARDDISK_HPP_INCLUDED
#include "ecmc.hpp"
struct HardInteraction : Interaction
{
double diameter;
HardInteraction ()
{
diameter = 2;
}
double sr_repulsion_range () const
{
return diameter;
}
void set_parameter (string_ref name, double value)
{
if (name == "diameter")
{
if (! (value > 0.))
rt_error ("Invalid particle diameter");
diameter = value;
}
else
{
rt_error ("Invalid parameter: " + name);
}
}
double random_sr_repulsion (double rsq, RandomContext *)
{
// hard disks/spheres always collide at distance 'diameter'
return sq (diameter) - rsq;
}
};
#endif /* HARDDISK_HPP_INCLUDED */