4747#include " TabulatedPotential.hpp"
4848#include " system/Leaf.hpp"
4949
50- #include < boost/variant.hpp>
51-
5250#include < algorithm>
5351#include < cassert>
5452#include < cmath>
5553#include < optional>
5654#include < stdexcept>
5755#include < unordered_map>
56+ #include < variant>
5857#include < vector>
5958
6059/* Special cutoff value for a disabled bond.
@@ -74,24 +73,16 @@ struct VirtualBond {
7473 double cutoff () const { return BONDED_INACTIVE_CUTOFF ; }
7574};
7675
77- /* * Visitor to get the number of bound partners from the bond parameter
78- * variant.
79- */
80- class BondNumPartners : public boost ::static_visitor<int > {
81- public:
82- template <typename T> int operator ()(T const &) const { return T::num; }
83- };
84-
8576/* * Variant in which to store the parameters of an individual bonded
8677 * interaction
8778 */
8879using Bonded_IA_Parameters =
89- boost ::variant<NoneBond, FeneBond, HarmonicBond, QuarticBond, BondedCoulomb,
90- BondedCoulombSR, AngleHarmonicBond, AngleCosineBond,
91- AngleCossquareBond, DihedralBond, TabulatedDistanceBond,
92- TabulatedAngleBond, TabulatedDihedralBond, ThermalizedBond,
93- RigidBond, IBMTriel, IBMVolCons, IBMTribend,
94- OifGlobalForcesBond, OifLocalForcesBond, VirtualBond>;
80+ std ::variant<NoneBond, FeneBond, HarmonicBond, QuarticBond, BondedCoulomb,
81+ BondedCoulombSR, AngleHarmonicBond, AngleCosineBond,
82+ AngleCossquareBond, DihedralBond, TabulatedDistanceBond,
83+ TabulatedAngleBond, TabulatedDihedralBond, ThermalizedBond,
84+ RigidBond, IBMTriel, IBMVolCons, IBMTribend,
85+ OifGlobalForcesBond, OifLocalForcesBond, VirtualBond>;
9586
9687/* *
9788 * @brief container for bonded interactions.
@@ -147,7 +138,7 @@ class BondedInteractionsMap : public System::Leaf<BondedInteractionsMap> {
147138 auto size () const { return m_params.size (); }
148139 auto get_next_key () const { return next_key; }
149140 auto get_zero_based_type (int bond_id) const {
150- return contains (bond_id) ? at (bond_id)->which ( ) : 0 ;
141+ return contains (bond_id) ? static_cast < int >( at (bond_id)->index () ) : 0 ;
151142 }
152143 auto get_n_thermalized_bonds () const {
153144 assert (n_thermalized_bonds >= 0 );
@@ -198,7 +189,7 @@ class BondedInteractionsMap : public System::Leaf<BondedInteractionsMap> {
198189 bonds.begin (), bonds.end (),
199190 [this , partner_id = p_partner.id ()](BondView const &bond) {
200191 auto const &bond_ptr = at (bond.bond_id ());
201- return (boost::get <BondType>(bond_ptr.get ()) != nullptr ) and
192+ return std::holds_alternative <BondType>(* bond_ptr.get ()) and
202193 (bond.partner_ids ()[0 ] == partner_id);
203194 });
204195 }
@@ -234,5 +225,5 @@ class BondedInteractionsMap : public System::Leaf<BondedInteractionsMap> {
234225
235226/* * @brief Get the number of bonded partners for the specified bond. */
236227inline int number_of_partners (Bonded_IA_Parameters const &iaparams) {
237- return boost::apply_visitor ( BondNumPartners () , iaparams);
228+ return std::visit ([]< typename T>(T const &) { return T::num; } , iaparams);
238229}
0 commit comments