Permalink
Browse files

Merge pull request #2367 from fweik/anisotropy

Anisotropy
  • Loading branch information...
KaiSzuttor committed Nov 8, 2018
2 parents f964c9a + 92ed15d commit 40e949020b7e006e13414f32c4a556f30c17ed54
@@ -27,6 +27,7 @@
#include "domain_decomposition.hpp"
#include "errorhandling.hpp"
#include "grid.hpp"
/** Returns pointer to the cell which corresponds to the position if
the position is in the nodes spatial domain otherwise a nullptr
@@ -46,6 +46,7 @@
#include "electrostatics_magnetostatics/maggs.hpp"
#include "cells.hpp"
#include "communication.hpp"
#include "debug.hpp"
#include "errorhandling.hpp"
#include "ghosts.hpp"
#include "global.hpp"
@@ -54,7 +55,7 @@
#include "integrate.hpp"
#include "nonbonded_interactions/nonbonded_interaction_data.hpp"
#include "particle_data.hpp"
#include "thermostat.hpp"
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -43,7 +43,6 @@
#include "grid.hpp"
#include "integrate.hpp"
#include "particle_data.hpp"
#include "thermostat.hpp"
#include "tuning.hpp"
#include "utils/strcat_alloc.hpp"
@@ -34,7 +34,6 @@
#include "initialize.hpp"
#include "integrate.hpp"
#include "particle_data.hpp"
#include "thermostat.hpp"
#include "tuning.hpp"
#include "utils.hpp"
#ifdef CUDA
@@ -34,11 +34,13 @@
#include "bonded_interactions/bonded_interaction_data.hpp"
#include "cells.hpp"
#include "communication.hpp"
#include "debug.hpp"
#include "global.hpp"
#include "grid.hpp"
#include "integrate.hpp"
#include "nonbonded_interactions/nonbonded_interaction_data.hpp"
#include "partCfg_global.hpp"
#include "random.hpp"
#include "rotation.hpp"
#include "virtual_sites.hpp"
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cells.hpp"
#include "communication.hpp"
#include "debug.hpp"
#include "initialize.hpp"
#include "particle_data.hpp"
#include "rotation.hpp"
@@ -25,11 +25,12 @@
*/
#include "config.hpp"
#ifdef ROTATION
#include "Vector.hpp"
#include "nonbonded_interactions/gb.hpp"
#include "particle_data.hpp"
#include "thermostat.hpp"
#include "utils.hpp"
constexpr const int ROTATION_X = 2;
constexpr const int ROTATION_Y = 4;
@@ -127,3 +128,4 @@ inline void normalize_quaternion(double *q) {
}
#endif
#endif
@@ -18,8 +18,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _THERMOSTAT_H
#define _THERMOSTAT_H
#ifndef CORE_THERMOSTAT_HPP
#define CORE_THERMOSTAT_HPP
/** \file
*/
@@ -30,10 +30,10 @@
#include "integrate.hpp"
#include "particle_data.hpp"
#include "random.hpp"
#include "rotation.hpp"
#include "Vector.hpp"
#include "grid.hpp"
#include <cmath>
/** \name Thermostat switches*/
@@ -114,66 +114,6 @@ void thermo_heat_up();
/** pendant to \ref thermo_heat_up */
void thermo_cool_down();
#ifdef ROTATION
inline void thermo_define_rotation_matrix(Particle *p, double A[9]) {
double q0q0 = p->r.quat[0];
q0q0 *= q0q0;
double q1q1 = p->r.quat[1];
q1q1 *= q1q1;
double q2q2 = p->r.quat[2];
q2q2 *= q2q2;
double q3q3 = p->r.quat[3];
q3q3 *= q3q3;
A[0 + 3 * 0] = q0q0 + q1q1 - q2q2 - q3q3;
A[1 + 3 * 1] = q0q0 - q1q1 + q2q2 - q3q3;
A[2 + 3 * 2] = q0q0 - q1q1 - q2q2 + q3q3;
A[0 + 3 * 1] =
2 * (p->r.quat[1] * p->r.quat[2] + p->r.quat[0] * p->r.quat[3]);
A[0 + 3 * 2] =
2 * (p->r.quat[1] * p->r.quat[3] - p->r.quat[0] * p->r.quat[2]);
A[1 + 3 * 0] =
2 * (p->r.quat[1] * p->r.quat[2] - p->r.quat[0] * p->r.quat[3]);
A[1 + 3 * 2] =
2 * (p->r.quat[2] * p->r.quat[3] + p->r.quat[0] * p->r.quat[1]);
A[2 + 3 * 0] =
2 * (p->r.quat[1] * p->r.quat[3] + p->r.quat[0] * p->r.quat[2]);
A[2 + 3 * 1] =
2 * (p->r.quat[2] * p->r.quat[3] - p->r.quat[0] * p->r.quat[1]);
}
inline void thermo_convert_forces_body_to_space(Particle *p, double *force) {
double A[9];
thermo_define_rotation_matrix(p, A);
force[0] = A[0 + 3 * 0] * p->f.f[0] + A[1 + 3 * 0] * p->f.f[1] +
A[2 + 3 * 0] * p->f.f[2];
force[1] = A[0 + 3 * 1] * p->f.f[0] + A[1 + 3 * 1] * p->f.f[1] +
A[2 + 3 * 1] * p->f.f[2];
force[2] = A[0 + 3 * 2] * p->f.f[0] + A[1 + 3 * 2] * p->f.f[1] +
A[2 + 3 * 2] * p->f.f[2];
}
inline void thermo_convert_vel_space_to_body(Particle *p,
const Vector3d &vel_space,
Vector3d &vel_body) {
double A[9];
thermo_define_rotation_matrix(p, A);
vel_body[0] = A[0 + 3 * 0] * vel_space[0] + A[0 + 3 * 1] * vel_space[1] +
A[0 + 3 * 2] * vel_space[2];
vel_body[1] = A[1 + 3 * 0] * vel_space[0] + A[1 + 3 * 1] * vel_space[1] +
A[1 + 3 * 2] * vel_space[2];
vel_body[2] = A[2 + 3 * 0] * vel_space[0] + A[2 + 3 * 1] * vel_space[1] +
A[2 + 3 * 2] * vel_space[2];
}
#endif // ROTATION
#ifdef NPT
/** add velocity-dependent noise and friction for NpT-sims to the particle's
velocity
@@ -279,10 +219,8 @@ inline void friction_thermo_langevin(Particle *p) {
(langevin_pref1_temp[1] != langevin_pref1_temp[2]) ||
(langevin_pref2_temp[0] != langevin_pref2_temp[1]) ||
(langevin_pref2_temp[1] != langevin_pref2_temp[2]);
Vector3d velocity_body = {0.0, 0.0, 0.0};
if (aniso_flag) {
thermo_convert_vel_space_to_body(p, velocity, velocity_body);
}
auto const velocity_body =
(aniso_flag) ? convert_vector_space_to_body(*p, velocity) : Vector3d{};
#endif
// Do the actual thermostatting
@@ -326,9 +264,8 @@ inline void friction_thermo_langevin(Particle *p) {
#ifdef PARTICLE_ANISOTROPY
if (aniso_flag) {
double particle_force[3] = {0.0, 0.0, 0.0};
auto const particle_force = convert_vector_body_to_space(*p, p->f.f);
thermo_convert_forces_body_to_space(p, particle_force);
for (int j = 0; j < 3; j++) {
#ifdef EXTERNAL_FORCES
if (!(p->p.ext_flag & COORD_FIXED(j)))
@@ -18,14 +18,16 @@
*/
#include "VirtualSitesRelative.hpp"
#ifdef VIRTUAL_SITES_RELATIVE
#include "cells.hpp"
#include "config.hpp"
#include "errorhandling.hpp"
#include "grid.hpp"
#include "integrate.hpp"
#include "rotation.hpp"
#ifdef VIRTUAL_SITES_RELATIVE
void VirtualSitesRelative::update(bool recalc_positions) const {
for (auto &p : local_cells.particles()) {
@@ -27,7 +27,7 @@ NPT
GHMC
SWIMMER_REACTIONS
ENGINE implies ROTATION, EXTERNAL_FORCES
PARTICLE_ANISOTROPY
PARTICLE_ANISOTROPY implies ROTATION
/* Rotation */
ROTATION

0 comments on commit 40e9490

Please sign in to comment.