Loading [MathJax]/extensions/TeX/AMSmath.js
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
polymer.cpp File Reference

This file contains everything needed to create a start-up configuration of (possibly charged) polymer chains with counterions and salt molecules, assigning velocities to the particles and cross-linking the polymers if necessary. More...

#include "polymer.hpp"
#include "BoxGeometry.hpp"
#include "cell_system/CellStructure.hpp"
#include "communication.hpp"
#include "constraints/Constraints.hpp"
#include "constraints/ShapeBasedConstraint.hpp"
#include "random.hpp"
#include "system/System.hpp"
#include <utils/Vector.hpp>
#include <utils/math/vec_rotate.hpp>
#include <boost/mpi/collectives/all_reduce.hpp>
#include <cmath>
#include <cstddef>
#include <functional>
#include <memory>
#include <numbers>
#include <optional>
#include <stdexcept>
#include <vector>
+ Include dependency graph for polymer.cpp:

Go to the source code of this file.

Functions

template<class RNG >
static Utils::Vector3d random_position (BoxGeometry const &box_geo, RNG &rng)
 
template<class RNG >
static Utils::Vector3d random_unit_vector (RNG &rng)
 
static bool is_valid_position (System::System const &system, Utils::Vector3d const &pos, std::vector< std::vector< Utils::Vector3d > > const &positions, BoxGeometry const &box_geo, double const min_distance, int const respect_constraints)
 Determines whether a given position pos is valid, i.e., it doesn't collide with existing or buffered particles, nor with existing constraints (if respect_constraints).
 
std::vector< std::vector< Utils::Vector3d > > draw_polymer_positions (System::System const &system, int const n_polymers, int const beads_per_chain, double const bond_length, std::vector< Utils::Vector3d > const &start_positions, double const min_distance, int const max_tries, int const use_bond_angle, double const bond_angle, int const respect_constraints, int const seed)
 Determines valid polymer positions and returns them.
 

Detailed Description

This file contains everything needed to create a start-up configuration of (possibly charged) polymer chains with counterions and salt molecules, assigning velocities to the particles and cross-linking the polymers if necessary.

The corresponding header file is polymer.hpp.

Definition in file polymer.cpp.

Function Documentation

◆ draw_polymer_positions()

std::vector< std::vector< Utils::Vector3d > > draw_polymer_positions ( System::System const &  system,
int  n_polymers,
int  beads_per_chain,
double  bond_length,
std::vector< Utils::Vector3d > const &  start_positions,
double  min_distance,
int  max_tries,
int  use_bond_angle,
double  bond_angle,
int  respect_constraints,
int  seed 
)

Determines valid polymer positions and returns them.

Parameters
systemparticle system
n_polymershow many polymers to create
beads_per_chainmonomers per chain
bond_lengthlength of the bonds between two monomers
start_positionsstarting positions of each polymers
min_distanceminimum distance between all particles
max_trieshow often a monomer/polymer should be reset if current position collides with a previous particle
use_bond_anglewhether to use the bond_angle argument
bond_angledesired bond-angle to be fixed
respect_constraintswhether to respect constraints
seedseed for RNG

Definition at line 143 of file polymer.cpp.

References System::System::box_geo, is_valid_position(), Random::mt19937(), random_position(), random_unit_vector(), Utils::vec_rotate(), and vector_product().

Referenced by ScriptInterface::Particles::Polymer::do_call_method().

◆ is_valid_position()

static bool is_valid_position ( System::System const &  system,
Utils::Vector3d const &  pos,
std::vector< std::vector< Utils::Vector3d > > const &  positions,
BoxGeometry const &  box_geo,
double const  min_distance,
int const  respect_constraints 
)
static

Determines whether a given position pos is valid, i.e., it doesn't collide with existing or buffered particles, nor with existing constraints (if respect_constraints).

Parameters
systemthe system containing the particles
posthe trial position in question
positionsbuffered positions to respect
box_geoBox geometry
min_distancethreshold for the minimum distance between trial position and buffered/existing particles
respect_constraintswhether to respect constraints
Returns
true if valid position, false if not.

Definition at line 86 of file polymer.cpp.

References System::System::cell_structure, comm_cart, System::System::constraints, BoxGeometry::folded_position(), and BoxGeometry::get_mi_vector().

Referenced by draw_polymer_positions().

◆ random_position()

template<class RNG >
static Utils::Vector3d random_position ( BoxGeometry const &  box_geo,
RNG &  rng 
)
static

Definition at line 55 of file polymer.cpp.

References BoxGeometry::length().

Referenced by draw_polymer_positions().

◆ random_unit_vector()

template<class RNG >
static Utils::Vector3d random_unit_vector ( RNG &  rng)
static

Definition at line 62 of file polymer.cpp.

References Utils::Vector< T, N >::norm().

Referenced by draw_polymer_positions().