Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/features.def
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ BUCKINGHAM
SOFT_SPHERE
HAT
GAY_BERNE implies ROTATION
GAY_BERNE_WIDTH implies ROTATION
THOLE requires ELECTROSTATICS

/* ScaFaCoS */
Expand Down
5 changes: 5 additions & 0 deletions src/core/energy_inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "nonbonded_interactions/buckingham.hpp"
#include "nonbonded_interactions/gaussian.hpp"
#include "nonbonded_interactions/gay_berne.hpp"
#include "nonbonded_interactions/gay_berne_width.hpp"
#include "nonbonded_interactions/hat.hpp"
#include "nonbonded_interactions/hertzian.hpp"
#include "nonbonded_interactions/lj.hpp"
Expand Down Expand Up @@ -175,6 +176,10 @@ inline double calc_non_bonded_pair_energy(
ret += gb_pair_energy(p1.quat(), p2.quat(), ia_params, d, dist);
#endif

#ifdef ESPRESSO_GAY_BERNE_WIDTH
ret += gb_width_pair_energy(p1.quat(), p2.quat(), ia_params, d, dist);
#endif

return ret;
}

Expand Down
11 changes: 11 additions & 0 deletions src/core/forces_inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "nonbonded_interactions/buckingham.hpp"
#include "nonbonded_interactions/gaussian.hpp"
#include "nonbonded_interactions/gay_berne.hpp"
#include "nonbonded_interactions/gay_berne_width.hpp"
#include "nonbonded_interactions/hat.hpp"
#include "nonbonded_interactions/hertzian.hpp"
#include "nonbonded_interactions/lj.hpp"
Expand Down Expand Up @@ -152,6 +153,11 @@ inline ParticleForce calc_non_central_force(Particle const &p1,
#ifdef ESPRESSO_GAY_BERNE
pf += gb_pair_force(p1.quat(), p2.quat(), ia_params, d, dist);
#endif

#ifdef ESPRESSO_GAY_BERNE_WIDTH
pf += gb_width_pair_force(p1.quat(), p2.quat(), ia_params, d, dist);
#endif

return pf;
}

Expand All @@ -166,6 +172,11 @@ inline Utils::Vector3d calc_non_central_force(Utils::Vector3d const &dir1,
#ifdef ESPRESSO_GAY_BERNE
f += gb_pair_force(dir1, dir2, ia_params, d, dist).f;
#endif

#ifdef ESPRESSO_GAY_BERNE_WIDTH
f += gb_width_pair_force(dir1, dir2, ia_params, d, dist).f;
#endif

return f;
}

Expand Down
1 change: 1 addition & 0 deletions src/core/nonbonded_interactions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/buckingham.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gaussian.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gay_berne.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gay_berne_width.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hat.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hertzian.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ljcos2.cpp
Expand Down
41 changes: 41 additions & 0 deletions src/core/nonbonded_interactions/gay_berne_width.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2010-2026 The ESPResSo project
*
* This file is part of ESPResSo.
*
* ESPResSo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ESPResSo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/** \file
*
* Implementation of \ref gay_berne_width.hpp
*/

#include "gay_berne_width.hpp"

#ifdef ESPRESSO_GAY_BERNE_WIDTH

#include "nonbonded_interaction_data.hpp"

#include <cmath>

GayBerneWidth_Parameters::GayBerneWidth_Parameters(double eps, double sig,
double wid, double cut,
double k1, double k2,
double mu, double nu)
: eps{eps}, sig{sig}, wid{wid}, cut{cut}, k1{k1}, k2{k2}, mu{mu}, nu{nu},
chi1{((k1 * k1) - 1.) / ((k1 * k1) + 1.)},
chi2{(std::pow(k2, 1. / mu) - 1.) / (std::pow(k2, 1. / mu) + 1.)} {}

#endif // ESPRESSO_GAY_BERNE_WIDTH
Loading