Commit b740f32d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent 2f9ebf13
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h" #include "units.h"
/** /**
* @brief Calculates du/dt in code units for a particle. * @brief Calculates du/dt in code units for a particle.
* *
...@@ -50,13 +49,14 @@ __attribute__((always_inline)) INLINE static float cooling_rate( ...@@ -50,13 +49,14 @@ __attribute__((always_inline)) INLINE static float cooling_rate(
/* Get particle density */ /* Get particle density */
const float rho = p->rho; const float rho = p->rho;
/* Get cooling function properties */ /* Get cooling function properties */
const float X_H = cooling->hydrogen_mass_abundance; const float X_H = cooling->hydrogen_mass_abundance;
/* Calculate du_dt */ /* Calculate du_dt */
const float du_dt = -cooling->lambda * ( X_H * rho / phys_const->const_proton_mass) * const float du_dt = -cooling->lambda *
( X_H * rho / phys_const->const_proton_mass) / rho; (X_H * rho / phys_const->const_proton_mass) *
(X_H * rho / phys_const->const_proton_mass) / rho;
return du_dt; return du_dt;
} }
...@@ -77,7 +77,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( ...@@ -77,7 +77,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Get current internal energy (dt=0) */ /* Get current internal energy (dt=0) */
const float u_old = hydro_get_internal_energy(p, 0.f); const float u_old = hydro_get_internal_energy(p, 0.f);
/* Internal energy floor */ /* Internal energy floor */
const float u_floor = cooling->min_energy; const float u_floor = cooling->min_energy;
...@@ -178,9 +178,9 @@ static INLINE void cooling_init_backend( ...@@ -178,9 +178,9 @@ static INLINE void cooling_init_backend(
/* convert lambda to code units */ /* convert lambda to code units */
cooling->lambda = lambda_cgs * cooling->lambda = lambda_cgs *
units_cgs_conversion_factor(us,UNIT_CONV_TIME) / units_cgs_conversion_factor(us, UNIT_CONV_TIME) /
(units_cgs_conversion_factor(us,UNIT_CONV_ENERGY) * (units_cgs_conversion_factor(us, UNIT_CONV_ENERGY) *
units_cgs_conversion_factor(us,UNIT_CONV_VOLUME)); units_cgs_conversion_factor(us, UNIT_CONV_VOLUME));
} }
/** /**
...@@ -195,8 +195,8 @@ static INLINE void cooling_print_backend( ...@@ -195,8 +195,8 @@ static INLINE void cooling_print_backend(
"Cooling function is 'Constant lambda' with " "Cooling function is 'Constant lambda' with "
"(lambda,min_energy,hydrogen_mass_abundance,mean_molecular_weight) " "(lambda,min_energy,hydrogen_mass_abundance,mean_molecular_weight) "
"= (%g,%g,%g,%g)", "= (%g,%g,%g,%g)",
cooling->lambda, cooling->min_energy, cooling->lambda, cooling->min_energy, cooling->hydrogen_mass_abundance,
cooling->hydrogen_mass_abundance, cooling->mean_molecular_weight); cooling->mean_molecular_weight);
} }
#endif /* SWIFT_COOLING_CONST_LAMBDA_H */ #endif /* SWIFT_COOLING_CONST_LAMBDA_H */
...@@ -131,7 +131,6 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) { ...@@ -131,7 +131,6 @@ void engine_make_hierarchical_tasks(struct engine *e, struct cell *c) {
const int is_with_cooling = (e->policy & engine_policy_cooling); const int is_with_cooling = (e->policy & engine_policy_cooling);
const int is_with_sourceterms = (e->policy & engine_policy_sourceterms); const int is_with_sourceterms = (e->policy & engine_policy_sourceterms);
/* Are we in a super-cell ? */ /* Are we in a super-cell ? */
if (c->super == c) { if (c->super == c) {
...@@ -3388,8 +3387,9 @@ void engine_init(struct engine *e, struct space *s, ...@@ -3388,8 +3387,9 @@ void engine_init(struct engine *e, struct space *s,
fprintf(e->file_stats, fprintf(e->file_stats,
"#%14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s " "#%14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s "
"%14s %14s %14s\n", "%14s %14s %14s\n",
"Time", "Mass", "E_tot", "E_kin", "E_int", "E_pot", "E_pot_self", "E_pot_ext", "Time", "Mass", "E_tot", "E_kin", "E_int", "E_pot", "E_pot_self",
"E_radcool", "Entropy", "p_x", "p_y", "p_z", "ang_x", "ang_y", "ang_z"); "E_pot_ext", "E_radcool", "Entropy", "p_x", "p_y", "p_z", "ang_x",
"ang_y", "ang_z");
fflush(e->file_stats); fflush(e->file_stats);
char timestepsfileName[200] = ""; char timestepsfileName[200] = "";
......
...@@ -35,8 +35,7 @@ ...@@ -35,8 +35,7 @@
*/ */
void potential_init(const struct swift_params* parameter_file, void potential_init(const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct phys_const* phys_const,
const struct UnitSystem* us, const struct UnitSystem* us, const struct space* s,
const struct space* s,
struct external_potential* potential) { struct external_potential* potential) {
potential_init_backend(parameter_file, phys_const, us, s, potential); potential_init_backend(parameter_file, phys_const, us, s, potential);
......
...@@ -48,8 +48,7 @@ ...@@ -48,8 +48,7 @@
/* Now, some generic functions, defined in the source file */ /* Now, some generic functions, defined in the source file */
void potential_init(const struct swift_params* parameter_file, void potential_init(const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct phys_const* phys_const,
const struct UnitSystem* us, const struct UnitSystem* us, const struct space* s,
const struct space* s,
struct external_potential* potential); struct external_potential* potential);
void potential_print(const struct external_potential* potential); void potential_print(const struct external_potential* potential);
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#include "parser.h" #include "parser.h"
#include "part.h" #include "part.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h"
#include "space.h" #include "space.h"
#include "units.h"
/** /**
* @brief External Potential Properties - Disc patch case * @brief External Potential Properties - Disc patch case
...@@ -157,16 +157,17 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -157,16 +157,17 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* Placeholder for now- just returns 0 * Placeholder for now- just returns 0
* *
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
* @param phys_const Physical constants in internal units. * @param phys_const Physical constants in internal units.
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
*/ */
__attribute__((always_inline)) INLINE static float external_gravity_get_potential_energy( __attribute__((always_inline)) INLINE static float
external_gravity_get_potential_energy(
const struct external_potential* potential, const struct external_potential* potential,
const struct phys_const* const phys_const, const struct part* p) { const struct phys_const* const phys_const, const struct part* p) {
return 0.; return 0.;
} }
/** /**
* @brief Initialises the external potential properties in the internal system * @brief Initialises the external potential properties in the internal system
...@@ -180,8 +181,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -180,8 +181,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
static INLINE void potential_init_backend( static INLINE void potential_init_backend(
const struct swift_params* parameter_file, const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct UnitSystem* us, const struct phys_const* phys_const, const struct UnitSystem* us,
const struct space* s, const struct space* s, struct external_potential* potential) {
struct external_potential* potential) {
potential->surface_density = parser_get_param_double( potential->surface_density = parser_get_param_double(
parameter_file, "DiscPatchPotential:surface_density"); parameter_file, "DiscPatchPotential:surface_density");
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include "parser.h" #include "parser.h"
#include "part.h" #include "part.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h"
#include "space.h" #include "space.h"
#include "units.h"
/** /**
* @brief External Potential Properties - Isothermal sphere case * @brief External Potential Properties - Isothermal sphere case
...@@ -100,32 +100,33 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep( ...@@ -100,32 +100,33 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
* @param g Pointer to the g-particle data. * @param g Pointer to the g-particle data.
*/ */
__attribute__((always_inline)) INLINE static void external_gravity_acceleration( __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
double time ,const struct external_potential* potential, double time, const struct external_potential* potential,
const struct phys_const* const phys_const, struct gpart* g) { const struct phys_const* const phys_const, struct gpart* g) {
const float dx = g->x[0] - potential->x; const float dx = g->x[0] - potential->x;
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
const float rinv2 = 1./(dx*dx + dy*dy + dz*dz); const float rinv2 = 1. / (dx * dx + dy * dy + dz * dz);
const double term = -potential->vrot2_over_G * rinv2; const double term = -potential->vrot2_over_G * rinv2;
g->a_grav[0] = term * dx; g->a_grav[0] = term * dx;
g->a_grav[1] = term * dy; g->a_grav[1] = term * dy;
g->a_grav[2] = term * dz; g->a_grav[2] = term * dz;
} }
/** /**
* @brief Computes the gravitational potential energy of a particle in an isothermal potential. * @brief Computes the gravitational potential energy of a particle in an
* isothermal potential.
* *
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
* @param phys_const Physical constants in internal units. * @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data. * @param g Pointer to the particle data.
*/ */
__attribute__((always_inline)) INLINE static float external_gravity_get_potential_energy( __attribute__((always_inline)) INLINE static float
external_gravity_get_potential_energy(
const struct external_potential* potential, const struct external_potential* potential,
const struct phys_const* const phys_const, const struct gpart* g) { const struct phys_const* const phys_const, const struct gpart* g) {
...@@ -133,8 +134,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -133,8 +134,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
return potential->vrot * potential->vrot * 0.5 * log(dx*dx + dy*dy * dz*dz); return potential->vrot * potential->vrot * 0.5 *
} log(dx * dx + dy * dy * dz * dz);
}
/** /**
* @brief Initialises the external potential properties in the internal system * @brief Initialises the external potential properties in the internal system
...@@ -148,14 +150,16 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -148,14 +150,16 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
static INLINE void potential_init_backend( static INLINE void potential_init_backend(
const struct swift_params* parameter_file, const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct UnitSystem* us, const struct phys_const* phys_const, const struct UnitSystem* us,
const struct space* s, const struct space* s, struct external_potential* potential) {
struct external_potential* potential) {
potential->x = s->dim[0]/2. + potential->x =
s->dim[0] / 2. +
parser_get_param_double(parameter_file, "IsothermalPotential:position_x"); parser_get_param_double(parameter_file, "IsothermalPotential:position_x");
potential->y = s->dim[1]/2. + potential->y =
s->dim[1] / 2. +
parser_get_param_double(parameter_file, "IsothermalPotential:position_y"); parser_get_param_double(parameter_file, "IsothermalPotential:position_y");
potential->z = s->dim[2]/2. + potential->z =
s->dim[2] / 2. +
parser_get_param_double(parameter_file, "IsothermalPotential:position_z"); parser_get_param_double(parameter_file, "IsothermalPotential:position_z");
potential->vrot = potential->vrot =
parser_get_param_double(parameter_file, "IsothermalPotential:vrot"); parser_get_param_double(parameter_file, "IsothermalPotential:vrot");
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#include "parser.h" #include "parser.h"
#include "part.h" #include "part.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h"
#include "space.h" #include "space.h"
#include "units.h"
/** /**
* @brief External Potential Properties * @brief External Potential Properties
...@@ -72,16 +72,17 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -72,16 +72,17 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @brief Computes the gravitational potential energy due to nothing. * @brief Computes the gravitational potential energy due to nothing.
* *
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
* @param phys_const Physical constants in internal units. * @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data. * @param g Pointer to the particle data.
*/ */
__attribute__((always_inline)) INLINE static float external_gravity_get_potential_energy( __attribute__((always_inline)) INLINE static float
external_gravity_get_potential_energy(
const struct external_potential* potential, const struct external_potential* potential,
const struct phys_const* const phys_const, const struct part* g) { const struct phys_const* const phys_const, const struct part* g) {
return 0.; return 0.;
} }
/** /**
* @brief Initialises the external potential properties in the internal system * @brief Initialises the external potential properties in the internal system
...@@ -97,8 +98,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -97,8 +98,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
static INLINE void potential_init_backend( static INLINE void potential_init_backend(
const struct swift_params* parameter_file, const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct UnitSystem* us, const struct phys_const* phys_const, const struct UnitSystem* us,
const struct space* s, const struct space* s, struct external_potential* potential) {}
struct external_potential* potential) {}
/** /**
* @brief Prints the properties of the external potential to stdout. * @brief Prints the properties of the external potential to stdout.
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include "parser.h" #include "parser.h"
#include "part.h" #include "part.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h"
#include "space.h" #include "space.h"
#include "units.h"
/** /**
* @brief External Potential Properties - Point mass case * @brief External Potential Properties - Point mass case
...@@ -116,25 +116,26 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -116,25 +116,26 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
g->a_grav[2] += -potential->mass * dz * rinv3; g->a_grav[2] += -potential->mass * dz * rinv3;
} }
/** /**
* @brief Computes the gravitational potential energy of a particle in a point mass potential. * @brief Computes the gravitational potential energy of a particle in a point
* mass potential.
* *
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
* @param phys_const Physical constants in internal units. * @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data. * @param g Pointer to the particle data.
*/ */
__attribute__((always_inline)) INLINE static float external_gravity_get_potential_energy( __attribute__((always_inline)) INLINE static float
external_gravity_get_potential_energy(
const struct external_potential* potential, const struct external_potential* potential,
const struct phys_const* const phys_const, const struct part* g) { const struct phys_const* const phys_const, const struct part* g) {
const float dx = g->x[0] - potential->x; const float dx = g->x[0] - potential->x;
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
const float rinv = 1./sqrtf(dx * dx + dy * dy + dz * dz); const float rinv = 1. / sqrtf(dx * dx + dy * dy + dz * dz);
return -phys_const->const_newton_G * potential->mass * r_inv; return -phys_const->const_newton_G * potential->mass * r_inv;
} }
/** /**
* @brief Initialises the external potential properties in the internal system * @brief Initialises the external potential properties in the internal system
...@@ -148,8 +149,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -148,8 +149,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
static INLINE void potential_init_backend( static INLINE void potential_init_backend(
const struct swift_params* parameter_file, const struct swift_params* parameter_file,
const struct phys_const* phys_const, const struct UnitSystem* us, const struct phys_const* phys_const, const struct UnitSystem* us,
const struct space* s, const struct space* s, struct external_potential* potential) {
struct external_potential* potential) {
potential->x = potential->x =
parser_get_param_double(parameter_file, "PointMassPotential:position_x"); parser_get_param_double(parameter_file, "PointMassPotential:position_x");
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include "parser.h" #include "parser.h"
#include "part.h" #include "part.h"
#include "physical_constants.h" #include "physical_constants.h"
#include "units.h"
#include "space.h" #include "space.h"
#include "units.h"
/** /**
* @brief External Potential Properties - Softened Isothermal sphere case * @brief External Potential Properties - Softened Isothermal sphere case
...@@ -46,10 +46,12 @@ struct external_potential { ...@@ -46,10 +46,12 @@ struct external_potential {
/*! Rotation velocity */ /*! Rotation velocity */
double vrot; double vrot;
/*! Square of vrot, the circular velocity which defines the isothermal potential */ /*! Square of vrot, the circular velocity which defines the isothermal
* potential */
double vrot2_over_G; double vrot2_over_G;
/*! Square of the softening length. Acceleration tends to zero within this distance from the origin */ /*! Square of the softening length. Acceleration tends to zero within this
* distance from the origin */
double epsilon2; double epsilon2;
/*! Time-step condition pre-factor */ /*! Time-step condition pre-factor */
...@@ -74,17 +76,18 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep( ...@@ -74,17 +76,18 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
const float r2_plus_epsilon2_inv = 1.f / (dx * dx + dy * dy + dz * dz + potential->epsilon2); const float r2_plus_epsilon2_inv =
1.f / (dx * dx + dy * dy + dz * dz + potential->epsilon2);
const float drdv = const float drdv =
dx * (g->v_full[0]) + dy * (g->v_full[1]) + dz * (g->v_full[2]); dx * (g->v_full[0]) + dy * (g->v_full[1]) + dz * (g->v_full[2]);
const double vrot = potential->vrot; const double vrot = potential->vrot;
const float dota_x = const float dota_x = vrot * vrot * r2_plus_epsilon2_inv *
vrot * vrot * r2_plus_epsilon2_inv * (g->v_full[0] - 2.f * drdv * dx * r2_plus_epsilon2_inv); (g->v_full[0] - 2.f * drdv * dx * r2_plus_epsilon2_inv);
const float dota_y = const float dota_y = vrot * vrot * r2_plus_epsilon2_inv *
vrot * vrot * r2_plus_epsilon2_inv * (g->v_full[1] - 2.f * drdv * dy * r2_plus_epsilon2_inv); (g->v_full[1] - 2.f * drdv * dy * r2_plus_epsilon2_inv);
const float dota_z = const float dota_z = vrot * vrot * r2_plus_epsilon2_inv *
vrot * vrot * r2_plus_epsilon2_inv * (g->v_full[2] - 2.f * drdv * dz * r2_plus_epsilon2_inv); (g->v_full[2] - 2.f * drdv * dz * r2_plus_epsilon2_inv);
const float dota_2 = dota_x * dota_x + dota_y * dota_y + dota_z * dota_z; const float dota_2 = dota_x * dota_x + dota_y * dota_y + dota_z * dota_z;
const float a_2 = g->a_grav[0] * g->a_grav[0] + g->a_grav[1] * g->a_grav[1] + const float a_2 = g->a_grav[0] * g->a_grav[0] + g->a_grav[1] * g->a_grav[1] +
g->a_grav[2] * g->a_grav[2]; g->a_grav[2] * g->a_grav[2];
...@@ -97,7 +100,7 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep( ...@@ -97,7 +100,7 @@ __attribute__((always_inline)) INLINE static float external_gravity_timestep(
* *
* Note that the accelerations are multiplied by Newton's G constant * Note that the accelerations are multiplied by Newton's G constant
* later on. * later on.
* *
* a = v_rot^2 * (x,y,z) / (r^2 + epsilon^2) * a = v_rot^2 * (x,y,z) / (r^2 + epsilon^2)
* @param time The current time. * @param time The current time.
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
...@@ -111,24 +114,27 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -111,24 +114,27 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
const float dx = g->x[0] - potential->x; const float dx = g->x[0] - potential->x;
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
const float r2_plus_epsilon2_inv = 1.f / (dx * dx + dy * dy + dz * dz + potential->epsilon2); const float r2_plus_epsilon2_inv =
1.f / (dx * dx + dy * dy + dz * dz + potential->epsilon2);
const double term = -potential->vrot2_over_G * r2_plus_epsilon2_inv; const double term = -potential->vrot2_over_G * r2_plus_epsilon2_inv;
g->a_grav[0] = term * dx; g->a_grav[0] = term * dx;
g->a_grav[1] = term * dy; g->a_grav[1] = term * dy;
g->a_grav[2] = term * dz; g->a_grav[2] = term * dz;
} }
/** /**
* @brief Computes the gravitational potential energy of a particle in an isothermal potential. * @brief Computes the gravitational potential energy of a particle in an
* isothermal potential.
* *
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
* @param phys_const Physical constants in internal units. * @param phys_const Physical constants in internal units.
* @param g Pointer to the particle data. * @param g Pointer to the particle data.
*/ */
__attribute__((always_inline)) INLINE static float external_gravity_get_potential_energy( __attribute__((always_inline)) INLINE static float
external_gravity_get_potential_energy(
const struct external_potential* potential, const struct external_potential* potential,
const struct phys_const* const phys_const, const struct part* g) { const struct phys_const* const phys_const, const struct part* g) {
...@@ -136,8 +142,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -136,8 +142,9 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
return potential->vrot * potential->vrot * 0.5 * log(dx*dx + dy*dy * dz*dz + potential->epsilon2); return potential->vrot * potential->vrot * 0.5 *