-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: re-introduction virtual sites at COM #4668
base: python
Are you sure you want to change the base?
Conversation
Your pull request does not meet our code formatting rules. Specifically, I suggest you make the following changes: diff --git a/src/core/virtual_sites/CMakeLists.txt b/src/core/virtual_sites/CMakeLists.txt
index 10020fc52..b94e675a4 100644
--- a/src/core/virtual_sites/CMakeLists.txt
+++ b/src/core/virtual_sites/CMakeLists.txt
@@ -23,4 +23,4 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/lb_inertialess_tracers_cuda_interface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/VirtualSitesInertialessTracers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/VirtualSitesRelative.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/VirtualSitesCenterOfMass.cpp)
+ ${CMAKE_CURRENT_SOURCE_DIR}/VirtualSitesCenterOfMass.cpp)
diff --git a/src/core/virtual_sites/VirtualSitesCenterOfMass.cpp b/src/core/virtual_sites/VirtualSitesCenterOfMass.cpp
index 24c6e6a65..c1da295fd 100644
--- a/src/core/virtual_sites/VirtualSitesCenterOfMass.cpp
+++ b/src/core/virtual_sites/VirtualSitesCenterOfMass.cpp
@@ -23,12 +23,12 @@
#include "Particle.hpp"
#include "cells.hpp"
+#include "communication.hpp"
#include "errorhandling.hpp"
#include "forces.hpp"
#include "grid.hpp"
#include "integrate.hpp"
#include "rotation.hpp"
-#include "communication.hpp"
#include <utils/Vector.hpp>
#include <utils/math/quaternion.hpp>
@@ -101,12 +101,13 @@ void VirtualSitesCenterOfMass::back_transfer_forces() {
// cell_structure.ghosts_reduce_forces();
// init_forces_ghosts(cell_structure.ghost_particles());
- //int p_mol_id;
- //int vs_id;
+ // int p_mol_id;
+ // int vs_id;
for (auto &p : cell_structure.local_particles()) {
- //p_mol_id = p.mol_id();
- //vs_id = vitual_site_id_for_mol_id[p.mol_id()];
- auto vs_ptr = cell_structure.get_local_particle(vitual_site_id_for_mol_id[p.mol_id()]);
+ // p_mol_id = p.mol_id();
+ // vs_id = vitual_site_id_for_mol_id[p.mol_id()];
+ auto vs_ptr = cell_structure.get_local_particle(
+ vitual_site_id_for_mol_id[p.mol_id()]);
p.force() +=
(p.mass() / com_by_mol_id[p.mol_id()]->total_mass) * vs_ptr->force();
}
diff --git a/src/core/virtual_sites/VirtualSitesCenterOfMass.hpp b/src/core/virtual_sites/VirtualSitesCenterOfMass.hpp
index 5a719f964..df8d8e709 100644
--- a/src/core/virtual_sites/VirtualSitesCenterOfMass.hpp
+++ b/src/core/virtual_sites/VirtualSitesCenterOfMass.hpp
@@ -39,8 +39,8 @@
* - update virtual sites
*/
-#include <iostream>
#include "config/config.hpp"
+#include <iostream>
//#ifndef VIRTUAL_SITES_CENTER_OF_MASS
@@ -53,8 +53,8 @@
/** @brief Base class for virtual sites implementations */
class VirtualSitesCenterOfMass : public VirtualSites {
public:
- VirtualSitesCenterOfMass(const std::unordered_map<int, int> & mid_for_vs) :
- vitual_site_id_for_mol_id(mid_for_vs) {}
+ VirtualSitesCenterOfMass(const std::unordered_map<int, int> &mid_for_vs)
+ : vitual_site_id_for_mol_id(mid_for_vs) {}
/**
* @brief Update positions and velocities of virtual sites.
*/
@@ -67,8 +67,9 @@ public:
std::unordered_map<int, int> vitual_site_id_for_mol_id = {};
auto const &get_mid_for_vs() const { return vitual_site_id_for_mol_id; }
-
- void set_mid_for_vs( std::unordered_map<int, int> const &vitual_site_id_for_mol_id_ ) {
+
+ void set_mid_for_vs(
+ std::unordered_map<int, int> const &vitual_site_id_for_mol_id_) {
vitual_site_id_for_mol_id = vitual_site_id_for_mol_id_;
}
diff --git a/src/script_interface/virtual_sites/VirtualSitesCenterOfMass.hpp b/src/script_interface/virtual_sites/VirtualSitesCenterOfMass.hpp
index 5c839dafb..057e29949 100644
--- a/src/script_interface/virtual_sites/VirtualSitesCenterOfMass.hpp
+++ b/src/script_interface/virtual_sites/VirtualSitesCenterOfMass.hpp
@@ -30,28 +30,28 @@
#include "core/virtual_sites/VirtualSitesCenterOfMass.hpp"
-#include <memory>
#include <map>
+#include <memory>
namespace ScriptInterface {
namespace VirtualSites {
class VirtualSitesCenterOfMass : public VirtualSites {
public:
-
void do_construct(VariantMap const &args) override {
- auto mid_for_vs = get_value<std::unordered_map<int, int>>(args, "mid_for_vs");
+ auto mid_for_vs =
+ get_value<std::unordered_map<int, int>>(args, "mid_for_vs");
m_virtual_sites = std::make_shared<::VirtualSitesCenterOfMass>(mid_for_vs);
- add_parameters({
- {"mid_for_vs", AutoParameter::read_only,
- [this]() { return make_unordered_map_of_variants(m_virtual_sites->get_mid_for_vs()); }}
- });
+ add_parameters({{"mid_for_vs", AutoParameter::read_only, [this]() {
+ return make_unordered_map_of_variants(
+ m_virtual_sites->get_mid_for_vs());
+ }}});
}
std::shared_ptr<::VirtualSites> virtual_sites() override {
return m_virtual_sites;
- }
+ }
private:
std::shared_ptr<::VirtualSitesCenterOfMass> m_virtual_sites;
diff --git a/src/script_interface/virtual_sites/initialize.cpp b/src/script_interface/virtual_sites/initialize.cpp
index c1a5c3181..1158d4952 100644
--- a/src/script_interface/virtual_sites/initialize.cpp
+++ b/src/script_interface/virtual_sites/initialize.cpp
@@ -21,10 +21,10 @@
#include "initialize.hpp"
#include "ActiveVirtualSitesHandle.hpp"
+#include "VirtualSitesCenterOfMass.hpp"
#include "VirtualSitesInertialessTracers.hpp"
#include "VirtualSitesOff.hpp"
#include "VirtualSitesRelative.hpp"
-#include "VirtualSitesCenterOfMass.hpp"
namespace ScriptInterface {
namespace VirtualSites {
@@ -40,7 +40,8 @@ void initialize(Utils::Factory<ObjectHandle> *om) {
om->register_new<VirtualSitesRelative>("VirtualSites::VirtualSitesRelative");
#endif
#ifdef VIRTUAL_SITES_CENTER_OF_MASS
- om->register_new<VirtualSitesCenterOfMass>("VirtualSites::VirtualSitesCenterOfMass");
+ om->register_new<VirtualSitesCenterOfMass>(
+ "VirtualSites::VirtualSitesCenterOfMass");
#endif
om->register_new<ActiveVirtualSitesHandle>(
"VirtualSites::ActiveVirtualSitesHandle"); To apply these changes, please do one of the following:
You can run Please note that there are often multiple ways to correctly format code. As I am just a robot, I sometimes fail to identify the most aesthetically pleasing way. So please look over my suggested changes and adapt them where the style does not make sense. |
Fixes #4619
Description of changes: