Skip to content
Permalink
Browse files

rg -l AFFINITY | xargs -n1 unifdef -m -UAFFINITY

  • Loading branch information...
fweik committed Oct 1, 2019
1 parent fc08e8a commit b9e1c3098a6a5cea2d7f6b44b954f16fe4941fb6
@@ -252,13 +252,6 @@ inline void add_non_bonded_pair_force(Particle &p1, Particle &p2,
/* bond creation and breaking */
/***********************************************/

#ifdef AFFINITY
/* affinity potential */
// Prevent jump to non-inlined function
if (dist < ia_params.affinity.cut) {
force += affinity_pair_force(p1, p2, ia_params, d, dist);
}
#endif

/***********************************************/
/* non-bonded pair potentials */
@@ -148,9 +148,6 @@ static double recalc_maximal_cutoff(const IA_parameters &data) {
(data.soft_sphere.cut + data.soft_sphere.offset));
#endif

#ifdef AFFINITY
max_cut_current = std::max(max_cut_current, data.affinity.cut);
#endif

#ifdef MEMBRANE_COLLISION
max_cut_current = std::max(max_cut_current, data.membrane.cut);
@@ -252,9 +252,6 @@ struct IA_parameters {
SoftSphere_Parameters soft_sphere;
#endif

#ifdef AFFINITY
Affinity_Parameters affinity;
#endif

#ifdef MEMBRANE_COLLISION
Membrane_Parameters membrane;
@@ -24,31 +24,3 @@
*/
#include "affinity.hpp"

#ifdef AFFINITY
#include "communication.hpp"

#include <utils/constants.hpp>

int affinity_set_params(int part_type_a, int part_type_b, int afftype,
double kappa, double r0, double Kon, double Koff,
double maxBond, double cut) {
IA_parameters *data = get_ia_param_safe(part_type_a, part_type_b);

if (!data)
return ES_ERROR;

data->affinity.type = afftype;
data->affinity.kappa = kappa;
data->affinity.r0 = r0;
data->affinity.Kon = Kon;
data->affinity.Koff = Koff;
data->affinity.maxBond = maxBond;
data->affinity.cut = cut;

/* broadcast interaction parameters */
mpi_bcast_ia_params(part_type_a, part_type_b);

return ES_OK;
}

#endif

Large diffs are not rendered by default.

@@ -137,9 +137,6 @@ using UpdatePropertyMessage = boost::variant
#ifdef ROTATIONAL_INERTIA
, UpdateProperty<Utils::Vector3d, &Prop::rinertia>
#endif
#ifdef AFFINITY
, UpdateProperty<Utils::Vector3d, &Prop::bond_site>
#endif
#ifdef MEMBRANE_COLLISION
, UpdateProperty<Utils::Vector3d, &Prop::out_direction>
#endif
@@ -884,12 +881,6 @@ void rotate_particle(int part, const Utils::Vector3d &axis, double angle) {
}
#endif

#ifdef AFFINITY
void set_particle_affinity(int part, double *bond_site) {
mpi_update_particle_property<Utils::Vector3d, &ParticleProperties::bond_site>(
part, Utils::Vector3d(bond_site, bond_site + 3));
}
#endif

#ifdef MEMBRANE_COLLISION
void set_particle_out_direction(int part, double *out_direction) {
@@ -1607,11 +1598,6 @@ void pointer_to_rotational_inertia(Particle const *p, double const *&res) {
}
#endif

#ifdef AFFINITY
void pointer_to_bond_site(Particle const *p, double const *&res) {
res = p->p.bond_site.data();
}
#endif

#ifdef MEMBRANE_COLLISION
void pointer_to_out_direction(const Particle *p, const double *&res) {
@@ -110,10 +110,6 @@ struct ParticleProperties {
static constexpr Utils::Vector3d rinertia = {1., 1., 1.};
#endif

#ifdef AFFINITY
/** parameters for affinity mechanisms */
Utils::Vector3d bond_site = {-1., -1., -1.};
#endif

#ifdef MEMBRANE_COLLISION
/** parameters for membrane collision mechanisms */
@@ -638,13 +634,6 @@ void set_particle_rotation(int part, int rot);
*/
void rotate_particle(int part, const Utils::Vector3d &axis, double angle);

#ifdef AFFINITY
/** Call only on the master node: set particle affinity.
* @param part the particle.
* @param bond_site its new site of the affinity bond.
*/
void set_particle_affinity(int part, double *bond_site);
#endif

#ifdef MEMBRANE_COLLISION
/** Call only on the master node: set particle out_direction.
@@ -990,9 +979,6 @@ void pointer_to_swimming(Particle const *p,
#ifdef ROTATIONAL_INERTIA
void pointer_to_rotational_inertia(Particle const *p, double const *&res);
#endif
#ifdef AFFINITY
void pointer_to_bond_site(Particle const *p, double const *&res);
#endif

#ifdef MEMBRANE_COLLISION
void pointer_to_out_direction(const Particle *p, const double *&res);
@@ -324,11 +324,6 @@ IF SOFT_SPHERE:
double a, double n,
double cut, double offset)

IF AFFINITY:
cdef extern from "object-in-fluid/affinity.hpp":
cdef int affinity_set_params(int part_type_a, int part_type_b,
int afftype, double kappa, double r0,
double Kon, double Koff, double maxBond, double cut)
IF TABULATED:
cdef extern from "nonbonded_interactions/nonbonded_tab.hpp":
int tabulated_set_params(int part_type_a, int part_type_b,
@@ -1382,69 +1382,6 @@ IF SOFT_SPHERE == 1:
"""
return {"a", "n", "cutoff"}

IF AFFINITY == 1:

cdef class AffinityInteraction(NonBondedInteraction):

def validate_params(self):
if self._params["affinity_cut"] < 0:
raise ValueError("Affinity cutoff has to be >=0")
if self._params["affinity_type"] < 0:
raise ValueError("Affinity type has to be >=0")
if self._params["affinity_kappa"] < 0:
raise ValueError("Affinity kappa has to be >=0")
if self._params["affinity_r0"] < 0:
raise ValueError("Affinity r0 has to be >=0")
if self._params["affinity_Kon"] < 0:
raise ValueError("Affinity Kon has to be >=0")
if self._params["affinity_Koff"] < 0:
raise ValueError("Affinity Koff has to be >=0")
if self._params["affinity_maxBond"] < 0:
raise ValueError("Affinity maxBond has to be >=0")
return True

def _get_params_from_es_core(self):
cdef IA_parameters * ia_params
ia_params = get_ia_param_safe(self._part_types[0],
self._part_types[1])
return {
"affinity_type": ia_params.affinity.type,
"affinity_kappa": ia_params.affinity.kappa,
"affinity_r0": ia_params.affinity.r0,
"affinity_Kon": ia_params.affinity.Kon,
"affinity_Koff": ia_params.affinity.Koff,
"affinity_maxBond": ia_params.affinity.maxBond,
"affinity_cut": ia_params.affinity.cut}

def is_active(self):
return (self._params["affinity_kappa"] > 0)

def _set_params_in_es_core(self):
if affinity_set_params(self._part_types[0],
self._part_types[1],
self._params["affinity_type"],
self._params["affinity_kappa"],
self._params["affinity_r0"],
self._params["affinity_Kon"],
self._params["affinity_Koff"],
self._params["affinity_maxBond"],
self._params["affinity_cut"]):
raise Exception("Could not set Affinity parameters")

def default_params(self):
return {}

def type_name(self):
return "Affinity"

def valid_keys(self):
return {"affinity_type", "affinity_kappa", "affinity_r0",
"affinity_Kon", "affinity_Koff", "affinity_maxBond", "affinity_cut"}

def required_keys(self):
return {"affinity_type", "affinity_kappa", "affinity_r0",
"affinity_Kon", "affinity_Koff", "affinity_maxBond", "affinity_cut"}


IF MEMBRANE_COLLISION == 1:

@@ -1693,8 +1630,6 @@ class NonBondedInteractionHandle:
_type1, _type2)
IF SOFT_SPHERE:
self.soft_sphere = SoftSphereInteraction(_type1, _type2)
IF AFFINITY:
self.affinity = AffinityInteraction(_type1, _type2)
IF LENNARD_JONES_GENERIC:
self.generic_lennard_jones = GenericLennardJonesInteraction(
_type1, _type2)
@@ -124,10 +124,6 @@ cdef extern from "particle_data.hpp":
void set_particle_out_direction(int part, double out_direction[3])
void pointer_to_out_direction(particle * p, double * & res)

IF AFFINITY:
void set_particle_affinity(int part, double bond_site[3])
void pointer_to_bond_site(particle * p, double * & res)

IF MASS:
void pointer_to_mass(particle * p, double * & res)

@@ -570,25 +570,6 @@ cdef class ParticleHandle:
return np.array(
[out_direction[0], out_direction[1], out_direction[2]])

IF AFFINITY:
property bond_site:
"""OIF bond_site"""

def __set__(self, _bond_site):
cdef double bond_site[3]
check_type_or_throw_except(
_bond_site, 3, float, "bond_site has to be 3 floats")
for i in range(3):
bond_site[i] = _bond_site[i]
set_particle_affinity(self.id, bond_site)

def __get__(self):
self.update_particle_data()
cdef const double * bond_site = NULL
pointer_to_bond_site(self.particle_data, bond_site)
return array_locked([bond_site[0], bond_site[1], bond_site[2]])


# Charge
property q:
"""

0 comments on commit b9e1c30

Please sign in to comment.
You can’t perform that action at this time.