faunus
Public Member Functions | Protected Attributes | List of all members
Faunus::Energy::GroupPairingPolicy< TCutoff > Class Template Reference

Particle pairing to calculate pairẃise interaction using particles' groups internally. More...

#include <energy.h>

Collaboration diagram for Faunus::Energy::GroupPairingPolicy< TCutoff >:
Collaboration graph
[legend]

Public Member Functions

 GroupPairingPolicy (Space &spc)
 
void from_json (const json &j)
 
void to_json (json &j) const
 
template<RequireEnergyAccumulator TAccumulator, typename T >
void particle2particle (TAccumulator &pair_accumulator, const T &a, const T &b) const
 Add two interacting particles to the accumulator. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void groupInternal (TAccumulator &pair_accumulator, const TGroup &group)
 All pairings within a group. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void groupInternal (TAccumulator &pair_accumulator, const TGroup &group, const std::size_t index)
 Pairings of a single particle within the group. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TIndex >
void groupInternal (TAccumulator &pair_accumulator, const TGroup &group, const TIndex &index)
 Pairing in the group involving only the particles present in the index. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void group2group (TAccumulator &pair_accumulator, const TGroup &group1, const TGroup &group2)
 Complete cartesian pairing of particles in two groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void group2group (TAccumulator &pair_accumulator, const TGroup &group1, const TGroup &group2, const std::vector< std::size_t > &index1)
 Cross pairing of particles in two groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void group2group (TAccumulator &pair_accumulator, const TGroup &group1, const TGroup &group2, const std::vector< std::size_t > &index1, const std::vector< std::size_t > &index2)
 Cross pairing of particles in two groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TGroups >
void group2groups (TAccumulator &pair_accumulator, const TGroup &group, const TGroups &groups)
 Complete cartesian pairing between particles in a group and a union of groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TGroups >
void group2groups (TAccumulator &pair_accumulator, const TGroup &group, const TGroups &group_index, const std::vector< std::size_t > &index)
 Cross pairing of particles in a group and a union of groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename Tgroup >
void group2all (TAccumulator &pair_accumulator, const Tgroup &group)
 Complete cartesian pairing between particles in a group and particles in other groups in space. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void group2all (TAccumulator &pair_accumulator, const TGroup &group, const int index)
 Complete cartesian pairing between a single particle in a group and particles in other groups in space. More...
 
template<RequireEnergyAccumulator TAccumulator, typename Tgroup >
void group2all (TAccumulator &pair_accumulator, const Tgroup &group, const std::vector< std::size_t > &index)
 Complete cartesian pairing between selected particles in a group and particles in other groups in space. More...
 
template<RequireEnergyAccumulator TAccumulator, typename T >
void groups2self (TAccumulator &pair_accumulator, const T &group_index)
 Cross pairing of particles among a union of groups. More...
 
template<RequireEnergyAccumulator TAccumulator, typename T >
void groups2all (TAccumulator &pair_accumulator, const T &group_index)
 Cross pairing of particles between a union of groups and its complement in space. More...
 
template<RequireEnergyAccumulator TAccumulator>
void all (TAccumulator &pair_accumulator)
 Cross pairing between all particles in the space. More...
 
template<RequireEnergyAccumulator TAccumulator, typename TCondition >
void all (TAccumulator &pair_accumulator, TCondition condition)
 Cross pairing between all particles in the space. More...
 

Protected Attributes

const Spacespc
 a space to operate on
 
TCutoff cut
 a cutoff functor that determines if energy between two groups can be ignored
 

Detailed Description

template<typename TCutoff>
class Faunus::Energy::GroupPairingPolicy< TCutoff >

Particle pairing to calculate pairẃise interaction using particles' groups internally.

Depending on the accumulator provided, raw particle pairs, energy sum, etc. can be obtained.

Accumulator is used as the first argument in all methods. Accumulator shall overload '+=' operator to accept a pair of particle references as used in particle2particle method.

Remarks
Method arguments are generally not checked for correctness because of performance reasons.
Template Parameters
TCutoffa cutoff scheme between groups
See also
InstantEnergyAccumulator, GroupCutoff

Constructor & Destructor Documentation

◆ GroupPairingPolicy()

template<typename TCutoff >
Faunus::Energy::GroupPairingPolicy< TCutoff >::GroupPairingPolicy ( Space spc)
inlineexplicit
Parameters
spc

Member Function Documentation

◆ all() [1/2]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator>
void Faunus::Energy::GroupPairingPolicy< TCutoff >::all ( TAccumulator &  pair_accumulator)
inline

Cross pairing between all particles in the space.

If the distance between particles' groups is greater or equal to the group cutoff distance, no calculation is performed.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
Parameters
pair_accumulatoraccumulator of interacting pairs of particles

◆ all() [2/2]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TCondition >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::all ( TAccumulator &  pair_accumulator,
TCondition  condition 
)
inline

Cross pairing between all particles in the space.

If the distance between particles' groups is greater or equal to the group cutoff distance, no calculation is performed.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TConditiona function returning bool and having a group as an argument
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
conditiona group filter if internal energy of the group shall be added

◆ group2all() [1/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename Tgroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2all ( TAccumulator &  pair_accumulator,
const Tgroup &  group 
)
inline

Complete cartesian pairing between particles in a group and particles in other groups in space.

group × (space ∖ group)

If the distance between the groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group

◆ group2all() [2/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2all ( TAccumulator &  pair_accumulator,
const TGroup &  group,
const int  index 
)
inline

Complete cartesian pairing between a single particle in a group and particles in other groups in space.

⊕group × (space ∖ group), where ⊕ denotes a filter by an index (here a single particle)

If the distance between the groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped. This method is performance-optimized version of the multiple indices method.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
indexa particle index relative to the group beginning

◆ group2all() [3/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename Tgroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2all ( TAccumulator &  pair_accumulator,
const Tgroup &  group,
const std::vector< std::size_t > &  index 
)
inline

Complete cartesian pairing between selected particles in a group and particles in other groups in space.

⊕group × (space ∖ group), where ⊕ denotes a filter by an index

If the distance between the groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
indexlist of particle indices in the group relative to the group beginning

◆ group2group() [1/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2group ( TAccumulator &  pair_accumulator,
const TGroup &  group1,
const TGroup &  group2 
)
inline

Complete cartesian pairing of particles in two groups.

group1 × group2

If the distance between the groups is greater or equal to the group cutoff distance, no calculation is performed. The group intersection must be an empty set, i.e., no particle is included in both groups. This is not verified for performance reason.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group1
group2

◆ group2group() [2/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2group ( TAccumulator &  pair_accumulator,
const TGroup &  group1,
const TGroup &  group2,
const std::vector< std::size_t > &  index1 
)
inline

Cross pairing of particles in two groups.

Only a cartesian subset of the complete cartesian product is considered as the particles in the first group must be also present in the index. The aim is to capture only interactions that involve changing (indexed) particles.

⊕group1 × group2, where ⊕ denotes a filter by an index

If the distance between the groups is greater or equal to the group cutoff distance, no calculation is performed. The group intersection must be an empty set, i.e., no particle is included in both groups. This is not verified for performance reason.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group1
group2
index1list of particle indices in group1 relative to the group beginning

◆ group2group() [3/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2group ( TAccumulator &  pair_accumulator,
const TGroup &  group1,
const TGroup &  group2,
const std::vector< std::size_t > &  index1,
const std::vector< std::size_t > &  index2 
)
inline

Cross pairing of particles in two groups.

Only a non-cartesian subset of the complete cartesian product is considered as at least one particles in the pair must be also present in the respective index. The aim is to capture only interactions that involve changing (indexed) particles, i.e., to avoid pairs containing only non-indexed particles.

(⊕group1 × ∁⊕group2) + (∁⊕group1 × ⊕group2) + (⊕group1 × ⊕group2) = = group1 × group2 − (∁⊕group2 × ∁⊕group2), where ⊕ denotes a filter by an index and ∁ a complement

If the distance between the groups is greater or equal to the group cutoff distance, no calculation is performed. The group intersection must be an empty set, i.e., no particle is included in both groups. This is not verified for performance reason.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group1
group2
index1list of particle indices in group1 relative to the group beginning
index2list of particle indices in group2 relative to the group beginning

◆ group2groups() [1/2]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TGroups >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2groups ( TAccumulator &  pair_accumulator,
const TGroup &  group,
const TGroups &  groups 
)
inline

Complete cartesian pairing between particles in a group and a union of groups.

group × (∪ groups)

If the distance between the groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped. The internal energy of the group is not computed even if the group is also present in the union of groups.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
TGroups
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
groups

◆ group2groups() [2/2]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TGroups >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::group2groups ( TAccumulator &  pair_accumulator,
const TGroup &  group,
const TGroups &  group_index,
const std::vector< std::size_t > &  index 
)
inline

Cross pairing of particles in a group and a union of groups.

Only a cartesian subset of the complete cartesian product is considered as the particles of the first group must be also present in the index. The aim is to capture only interactions that involve changing (indexed) particles.

⊕group × (∪ groups), where ⊕ denotes a filter by an index

If the distance between the groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped. The internal energy of the group is not computed even if the group is also present in the union of groups.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
TGroups
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
group_indexgroups as indices in Space::groups
indexlist of particle indices in the group relative to the group beginning

◆ groupInternal() [1/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::groupInternal ( TAccumulator &  pair_accumulator,
const TGroup &  group 
)
inline

All pairings within a group.

All pair interaction within the group are accumulated. The pair exclusions defined in the molecule topology are honoured.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
group
pair_accumulatoraccumulator of interacting pairs of particles

◆ groupInternal() [2/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::groupInternal ( TAccumulator &  pair_accumulator,
const TGroup &  group,
const std::size_t  index 
)
inline

Pairings of a single particle within the group.

The pair exclusions defined in the molecule topology are honoured.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
indexinternal index of the selected particle within the group

◆ groupInternal() [3/3]

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename TGroup , typename TIndex >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::groupInternal ( TAccumulator &  pair_accumulator,
const TGroup &  group,
const TIndex &  index 
)
inline

Pairing in the group involving only the particles present in the index.

Only such non-bonded pair interactions within the group are considered if at least one particle is present in the index. The pair exclusions defined in the molecule topology are honoured.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
TGroup
TIndex
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group
indexinternal indices of particles within the group

◆ groups2all()

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename T >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::groups2all ( TAccumulator &  pair_accumulator,
const T group_index 
)
inline

Cross pairing of particles between a union of groups and its complement in space.

If the distance between any two groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
T
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group_indexlist of groups

◆ groups2self()

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename T >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::groups2self ( TAccumulator &  pair_accumulator,
const T group_index 
)
inline

Cross pairing of particles among a union of groups.

No internal pairs within any group are considered.

If the distance between any two groups is greater or equal to the group cutoff distance, the particle pairing between them is skipped.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
T
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
group_indexlist of groups

◆ particle2particle()

template<typename TCutoff >
template<RequireEnergyAccumulator TAccumulator, typename T >
void Faunus::Energy::GroupPairingPolicy< TCutoff >::particle2particle ( TAccumulator &  pair_accumulator,
const T a,
const T b 
) const
inline

Add two interacting particles to the accumulator.

Due to compiler optimization, the '+=' operator and this function itself may be inlined to significantly improve performance.

Template Parameters
TAccumulatoran accumulator with '+=' operator overloaded to add a pair of particles as references {T&, T&}
Tan interacting particle
Parameters
pair_accumulatoraccumulator of interacting pairs of particles
afirst particle
bsecond particle

The documentation for this class was generated from the following file: