#if 0

void dlvo_setup(struct float_ctrl_s *self)
{
	/* Input:
	 *   [0] == \epsilon
	 *   [1] == r_m (\sigma = r_m / 2^(1/6))
	 *   [2] == \gamma_r
	 *   [3] == \gamma_a
	 *   [4] == 
	 * Output for dlvo_entry():
	 *   [] == C\epsilon\gamma_r(\sigma)^(\gamma_r - 1)
	 *   [] == -C\epsilon\gamma_a(\sigma)^(\gamma_a - 1)
	 *   [] == 1 - \gamma_r
	 *   [] == 1 - \gamma_a
	 */
	vec_p p = self->params;
	vec_t eps = p[0], rm = p[1], gr = p[2], ga = [3], ;
	vec_t C = (gr/(gr - ga)) * pow(gr/ga,ga/(gr - ga));
	vec_t sigma = rm * pow(2, - 1.0/6.0);
	
	p[] = C * eps * gr * pow(sigma, gr - 1);
	p[] = - C * eps * ga * pow(sigma, ga - 1);
	p[] = 1 - gr;
	p[] = 1 - ga;
	
}

vec_t CTRL_CALL
dlvo_entry(struct float_ctrl_s *self,vec_t arg)
{
	vec_p params = self->params;
	
	/*
	 * params[0] == U0 const
	 * params[1] == R0 const
	 * params[2] == EXTRA_HEIGHT const
	 * arg = dist;
	 */
	vec_t ljf = LJ_modulus(self, arg)
	vec_t pwr;
	/*
	 * d/dr(U_{LJ} + exp(-((r-1.15*r0)*10)^2))
	 */
	pwr = 10 * arg - 11.5 * params[1];
	pwr *= pwr;
	return ljf + params[0] * (params[2] * (230-200*arg) * exp(-pwr));
}

void	CTRL_CALL
vec3_pos_dep(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * model->cur_idx - index of the particle in model->cur_phase
	 * params - matrix3x4_t const
	 */
	vec_p pos = PS_POS(model->cur_phase,model->cur_idx);
	mat3x4VecMul(ret,*(matrix3x4_t*)params,pos);
}

void	CTRL_CALL
vec3_vel_dep(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * model->cur_idx - index of the particle in model->cur_phase
	 * params - matrix3x4_t const
	 */
	vec_p vel = PS_VEL(model->cur_phase,model->cur_idx);
	mat3x4VecMul(ret,*(matrix3x4_t*)params,vel);
}

void	CTRL_CALL
vec3_unit_pos_dep(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * model->cur_idx - index of the particle in model->cur_phase
	 * params - matrix3x4_t const
	 */
	vec_t l, *pos = PS_POS(model->cur_phase,model->cur_idx);
	vec3_t u;
	l = vec3Abs(pos);
	if(IsZero(l))
	{
		vec3Zero(ret);
	}
	else
	{
		l = (vec_t)1.0 / l;
		vec3Scale(u,pos,l);
		mat3x4VecMul(ret,*(matrix3x4_t*)params,u);
	}
}

void	CTRL_CALL
vec3_unit_vel_dep(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * model->cur_idx - index of the particle in model->cur_phase
	 * params - matrix3x4_t const
	 */
	vec_t l, *vel = PS_VEL(model->cur_phase,model->cur_idx);
	vec3_t u;
	l = vec3Abs(vel);
	if(IsZero(l))
	{
		vec3Zero(ret);
	}
	else
	{
		l = (vec_t)1.0 / l;
		vec3Scale(u,vel,l);
		mat3x4VecMul(ret,*(matrix3x4_t*)params,u);
	}
}

void	CTRL_CALL
vec3_linear_to_origin(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * params[0] = potential_barrier_radius
	 * params[1] = potential_barrier_height
	 * model->cur_idx - index of the current particle in model->cur_phase
	 */
	vec_p pos = PS_POS(model->cur_phase,model->cur_idx);
	vec_t r = params[0] - vec3Abs(pos);
	if(r > 0) /* barrier_radius > cur_dist */
	{
		vec3Zero(ret);
	}
	else
	{
		vec3Scale(ret,pos,params[1] * r);
	}
}

void	CTRL_CALL
vec3_exp_to_origin(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * params[0] = potential_barrier_radius
	 * params[1] = potential_barrier_height
	 * model->cur_idx - index of the current particle in model->cur_phase
	 */
	vec_p pos = PS_POS(model->cur_phase,model->cur_idx);
	vec_t d = vec3Abs(pos);
	vec_t r = params[0] - d;
	if(r >= 0)
	{
		vec3Zero(ret);
	}
	else
	{
		vec3Scale(ret,pos,params[1] * exp(r) / d);
	}
}

void	CTRL_CALL
vec3_rectlinear_to_origin(struct vec3_ctrl_s *self,vec_p params,
	vec3_t ret)
{
	vec_p params = self->params;
	/*
	 * params[0] = potential_barrier_radius
	 * params[1] = potential_barrier_height
	 * model->cur_idx - index of the current particle in model->cur_phase
	 */
	int i;
	vec_p pos = PS_POS(model->cur_phase,model->cur_idx);
	vec_t pbwidth = params[0];
	vec_t pbheight = params[1];
	for(i=0;i<3;i++)
	{
		if(pos[i] < -pbwidth)
		{
			ret[i] = (-pbwidth - pos[i]) * pbheight; /* positive */
		} else if(pos[i] > pbwidth)
		{
			ret[i] = (pbwidth - pos[i]) * pbheight; /* negative */
		} else
		{
			ret[i] = 0;
		}
	}
}

#endif

