![]() |
ESPResSo 3.2.0-167-g2c9ead1-git
Extensible Simulation Package for Soft Matter Research
|
Pressure calculation. More...
#include "utils.h"#include "integrate.h"#include "statistics.h"#include "thermostat.h"#include "adresso.h"#include "forces.h"#include "npt.h"

Go to the source code of this file.
Functions | |
Exported Functions | |
| void | init_virials (Observable_stat *stat) |
| Initializes a virials Observable stat. | |
| void | init_virials_non_bonded (Observable_stat_non_bonded *stat_nb) |
| Initializes a virials Observable stat. | |
| void | init_p_tensor_non_bonded (Observable_stat_non_bonded *stat_nb) |
| Initializes stat_nb to be used by pressure_calc. | |
| void | init_p_tensor (Observable_stat *stat) |
| Initializes stat to be used by pressure_calc. | |
| void | master_pressure_calc (int v_comp) |
| on the master node: calc energies only if necessary | |
| void | pressure_calc (double *result, double *result_t, double *result_nb, double *result_t_nb, int v_comp) |
| Calculates the pressure in the system from a virial expansion using the terms from calculate_verlet_virials or nsq_calculate_virials dependeing on the used cell system. | |
| MDINLINE void | add_non_bonded_pair_virials (Particle *p1, Particle *p2, double d[3], double dist, double dist2) |
| Calculate non bonded energies between a pair of particles. | |
| MDINLINE void | calc_bonded_force (Particle *p1, Particle *p2, Bonded_ia_parameters *iaparams, int *i, double dx[3], double force[3]) |
| MDINLINE void | calc_three_body_bonded_forces (Particle *p1, Particle *p2, Particle *p3, Bonded_ia_parameters *iaparams, double force1[3], double force2[3], double force3[3]) |
| MDINLINE void | add_bonded_virials (Particle *p1) |
| Calculate bonded virials for one particle. | |
| MDINLINE void | add_three_body_bonded_stress (Particle *p1) |
| Calculate the contribution to the stress tensor from angular potentials. | |
| MDINLINE void | add_kinetic_virials (Particle *p1, int v_comp) |
| Calculate kinetic pressure (aka energy) for one particle. | |
| int | local_stress_tensor_calc (DoubleList *TensorInBin, int bins[3], int periodic[3], double range_start[3], double range[3]) |
| implementation of 'analyse local_stress_tensor | |
| int | observable_compute_stress_tensor (int v_comp, double *A, unsigned int n_A) |
| function to calculate stress tensor for the observables | |
Variables | |
Exported Variables | |
| Observable_stat | virials |
| Observable_stat | total_pressure |
| Observable_stat | p_tensor |
| Observable_stat | total_p_tensor |
| Observable_stat_non_bonded | virials_non_bonded |
| Observable_stat_non_bonded | total_pressure_non_bonded |
| Observable_stat_non_bonded | p_tensor_non_bonded |
| Observable_stat_non_bonded | total_p_tensor_non_bonded |
| MDINLINE void add_bonded_virials | ( | Particle * | p1 | ) |
Calculate bonded virials for one particle.
For performance reasons the force routines add their values directly to the particles. So here we do some tricks to get the value out without changing the forces.
| p1 | particle for which to calculate virials |
Definition at line 311 of file pressure.h.
References Particle::bl, BONDED_IA_HARMONIC, bonded_ia_params, calc_bonded_force(), IntList::e, ERROR_SPRINTF, ES_INTEGER_SPACE, get_mi_vector(), Bonded_ia_parameters::harmonic, i, ParticleProperties::identity, local_particles, obsstat_bonded(), ParticlePosition::p, Particle::p, Bonded_ia_parameters::p, Particle::r, and runtime_error().
Referenced by calculate_link_cell_virials(), calculate_verlet_virials(), layered_calculate_virials(), and nsq_calculate_virials().
| MDINLINE void add_kinetic_virials | ( | Particle * | p1, |
| int | v_comp | ||
| ) |
Calculate kinetic pressure (aka energy) for one particle.
| p1 | particle for which to calculate pressure |
| v_comp | flag which enables (1) compensation of the velocities required for deriving a pressure reflecting nptiso_struct::p_inst (hence it only works with domain decomposition); naturally it therefore doesn't make sense to use it without NpT. |
Definition at line 508 of file pressure.h.
References Observable_stat::data, DoubleList::e, ParticleForce::f, Particle::f, Particle::m, PMASS, SQR(), and ParticleMomentum::v.
Referenced by calculate_link_cell_virials(), calculate_verlet_virials(), layered_calculate_virials(), and nsq_calculate_virials().
| MDINLINE void add_non_bonded_pair_virials | ( | Particle * | p1, |
| Particle * | p2, | ||
| double | d[3], | ||
| double | dist, | ||
| double | dist2 | ||
| ) |
Calculate non bonded energies between a pair of particles.
| p1 | pointer to particle 1. |
| p2 | pointer to particle 2. |
| d | vector between p1 and p2. |
| dist | distance between p1 and p2. |
| dist2 | distance squared between p1 and p2. |
Definition at line 73 of file pressure.h.
References add_dh_coulomb_pair_force(), add_rf_coulomb_pair_force(), calc_non_bonded_pair_force_simple(), Observable_stat::coulomb, coulomb, COULOMB_DH, COULOMB_INTER_RF, COULOMB_NONE, COULOMB_P3M, COULOMB_P3M_GPU, COULOMB_RF, DIPOLAR_NONE, Coulomb_parameters::Dmethod, Coulomb_parameters::method, ParticleProperties::mol_id, obsstat_nonbonded(), obsstat_nonbonded_inter(), obsstat_nonbonded_intra(), Particle::p, p3m_pair_energy(), ParticleProperties::q, and ParticleProperties::type.
Referenced by calculate_link_cell_virials(), calculate_verlet_virials(), layered_calculate_virials(), and nsq_calculate_virials().
| MDINLINE void add_three_body_bonded_stress | ( | Particle * | p1 | ) |
Calculate the contribution to the stress tensor from angular potentials.
The central particle of the three-particle interaction is responsible for the contribution of the entire interaction - this is the coding not the physics.
Definition at line 355 of file pressure.h.
References Particle::bl, BONDED_IA_ANGLE_COSINE, BONDED_IA_ANGLE_COSSQUARE, BONDED_IA_ANGLE_HARMONIC, BONDED_IA_ANGLEDIST, BONDED_IA_AREA_FORCE_GLOBAL, BONDED_IA_AREA_FORCE_LOCAL, BONDED_IA_BENDING_FORCE, BONDED_IA_DIHEDRAL, BONDED_IA_FENE, BONDED_IA_HARMONIC, bonded_ia_params, BONDED_IA_RIGID_BOND, BONDED_IA_STRETCHING_FORCE, BONDED_IA_SUBT_LJ, BONDED_IA_TABULATED, BONDED_IA_VIRTUAL_BOND, BONDED_IA_VOLUME_FORCE, calc_three_body_bonded_forces(), IntList::e, ERROR_SPRINTF, ES_INTEGER_SPACE, get_mi_vector(), i, ParticleProperties::identity, local_particles, obsstat_bonded(), ParticlePosition::p, Particle::p, Bonded_ia_parameters::p, Particle::r, runtime_error(), Bonded_ia_parameters::tab, TAB_BOND_ANGLE, TAB_BOND_DIHEDRAL, TAB_BOND_LENGTH, and Bonded_ia_parameters::type.
Referenced by calculate_link_cell_virials(), calculate_verlet_virials(), layered_calculate_virials(), and nsq_calculate_virials().
| MDINLINE void calc_bonded_force | ( | Particle * | p1, |
| Particle * | p2, | ||
| Bonded_ia_parameters * | iaparams, | ||
| int * | i, | ||
| double | dx[3], | ||
| double | force[3] | ||
| ) |
Definition at line 156 of file pressure.h.
References adress_non_bonded_force_weight(), BONDED_IA_ANGLE_COSINE, BONDED_IA_ANGLE_COSSQUARE, BONDED_IA_ANGLE_HARMONIC, BONDED_IA_ANGLEDIST, BONDED_IA_DIHEDRAL, BONDED_IA_FENE, BONDED_IA_HARMONIC, BONDED_IA_OVERLAPPED, BONDED_IA_RIGID_BOND, BONDED_IA_SUBT_LJ, BONDED_IA_TABULATED, BONDED_IA_VIRTUAL_BOND, calc_fene_pair_force(), calc_harmonic_pair_force(), calc_overlap_bond_force(), calc_subt_lj_pair_force(), calc_tab_bond_force(), ERROR_SPRINTF, ES_INTEGER_SPACE, get_mol_com_particle(), ParticleProperties::identity, Bonded_ia_parameters::overlap, OVERLAP_BOND_ANGLE, OVERLAP_BOND_DIHEDRAL, OVERLAP_BOND_LENGTH, Particle::p, Bonded_ia_parameters::p, ROUND_ERROR_PREC, runtime_error(), Bonded_ia_parameters::tab, TAB_BOND_ANGLE, TAB_BOND_DIHEDRAL, TAB_BOND_LENGTH, and Bonded_ia_parameters::type.
Referenced by add_bonded_virials(), and local_stress_tensor_calc().
| MDINLINE void calc_three_body_bonded_forces | ( | Particle * | p1, |
| Particle * | p2, | ||
| Particle * | p3, | ||
| Bonded_ia_parameters * | iaparams, | ||
| double | force1[3], | ||
| double | force2[3], | ||
| double | force3[3] | ||
| ) |
Definition at line 255 of file pressure.h.
References BONDED_IA_ANGLE_COSINE, BONDED_IA_ANGLE_COSSQUARE, BONDED_IA_ANGLE_HARMONIC, BONDED_IA_ANGLE_OLD, BONDED_IA_TABULATED, calc_angle_3body_forces(), calc_angle_3body_tabulated_forces(), calc_angle_cosine_3body_forces(), calc_angle_cossquare_3body_forces(), calc_angle_harmonic_3body_forces(), ERROR_SPRINTF, ES_INTEGER_SPACE, ParticleProperties::identity, Particle::p, Bonded_ia_parameters::p, runtime_error(), Bonded_ia_parameters::tab, TAB_BOND_ANGLE, and Bonded_ia_parameters::type.
Referenced by add_three_body_bonded_stress().
| void init_p_tensor | ( | Observable_stat * | stat | ) |
Initializes stat to be used by pressure_calc.
Definition at line 270 of file pressure.c.
References coulomb, COULOMB_NONE, COULOMB_P3M, COULOMB_P3M_GPU, DIPOLAR_ALL_WITH_ALL_AND_NO_REPLICA, DIPOLAR_DS, DIPOLAR_NONE, DIPOLAR_P3M, Coulomb_parameters::Dmethod, Observable_stat::init_status, Coulomb_parameters::method, n_bonded_ia, n_particle_types, and obsstat_realloc_and_clear().
Referenced by observable_compute_stress_tensor(), pressure_calc(), tclcommand_analyze_parse_and_print_pressure(), and tclcommand_analyze_parse_and_print_stress_tensor().
| void init_p_tensor_non_bonded | ( | Observable_stat_non_bonded * | stat_nb | ) |
Initializes stat_nb to be used by pressure_calc.
Definition at line 303 of file pressure.c.
References Observable_stat_non_bonded::init_status_nb, n_particle_types, and obsstat_realloc_and_clear_non_bonded().
Referenced by observable_compute_stress_tensor(), pressure_calc(), tclcommand_analyze_parse_and_print_pressure(), and tclcommand_analyze_parse_and_print_stress_tensor().
| void init_virials | ( | Observable_stat * | stat | ) |
Initializes a virials Observable stat.
Definition at line 225 of file pressure.c.
References coulomb, COULOMB_NONE, COULOMB_P3M, COULOMB_P3M_GPU, DIPOLAR_ALL_WITH_ALL_AND_NO_REPLICA, DIPOLAR_DS, DIPOLAR_NONE, DIPOLAR_P3M, Coulomb_parameters::Dmethod, Observable_stat::init_status, Coulomb_parameters::method, n_bonded_ia, n_particle_types, and obsstat_realloc_and_clear().
Referenced by observable_compute_stress_tensor(), pressure_calc(), tclcommand_analyze_parse_and_print_pressure(), and tclcommand_analyze_parse_and_print_stress_tensor().
| void init_virials_non_bonded | ( | Observable_stat_non_bonded * | stat_nb | ) |
Initializes a virials Observable stat.
Definition at line 258 of file pressure.c.
References Observable_stat_non_bonded::init_status_nb, n_particle_types, and obsstat_realloc_and_clear_non_bonded().
Referenced by observable_compute_stress_tensor(), pressure_calc(), tclcommand_analyze_parse_and_print_pressure(), and tclcommand_analyze_parse_and_print_stress_tensor().
| int local_stress_tensor_calc | ( | DoubleList * | TensorInBin, |
| int | bins[3], | ||
| int | periodic[3], | ||
| double | range_start[3], | ||
| double | range[3] | ||
| ) |
implementation of 'analyse local_stress_tensor
Definition at line 877 of file pressure.c.
References Particle::bl, bonded_ia_params, box_l, calc_bonded_force(), CellPList::cell, DomainDecomposition::cell_inter, dd, distribute_tensors(), drem_down(), IntList::e, DoubleList::e, ERROR_SPRINTF, ES_INTEGER_SPACE, get_mi_vector(), get_nonbonded_interaction(), i, ParticleProperties::identity, incubewithskin(), local_cells, local_particles, Particle::m, max_cut, PairList::n, CellPList::n, ParticleList::n, IA_Neighbor_List::n_neighbors, IA_Neighbor_List::nList, ParticlePosition::p, Particle::p, PairList::pair, ParticleList::part, PMASS, PTENSOR_TRACE, Particle::r, runtime_error(), skin, this_node, time_step, ParticleMomentum::v, IA_Neighbor::vList, and whichbin().
Referenced by mpi_local_stress_tensor(), and mpi_local_stress_tensor_slave().
| void master_pressure_calc | ( | int | v_comp | ) |
on the master node: calc energies only if necessary
| v_comp | flag which enables (1) compensation of the velocities required for deriving a pressure reflecting nptiso_struct::p_inst (hence it only works with domain decomposition); naturally it therefore doesn't make sense to use it without NpT. |
Definition at line 313 of file pressure.c.
References Observable_stat::data, Observable_stat_non_bonded::data_nb, DoubleList::e, Observable_stat::init_status, Observable_stat_non_bonded::init_status_nb, and mpi_gather_stats().
Referenced by observable_compute_stress_tensor(), tclcommand_analyze_parse_and_print_pressure(), and tclcommand_analyze_parse_and_print_stress_tensor().
| int observable_compute_stress_tensor | ( | int | v_comp, |
| double * | A, | ||
| unsigned int | n_A | ||
| ) |
function to calculate stress tensor for the observables
Definition at line 1008 of file pressure.c.
References Observable_stat::data, nptiso_struct::dimension, DoubleList::e, nptiso_struct::geometry, i, init_p_tensor(), init_p_tensor_non_bonded(), Observable_stat::init_status, init_virials(), init_virials_non_bonded(), INTEG_METHOD_NPT_ISO, integ_switch, nptiso_struct::invalidate_p_vel, master_pressure_calc(), MPI_COMM_WORLD, MPI_DOUBLE, MPI_Reduce(), MPI_SUM, DoubleList::n, nptiso_struct::nptgeom_dir, nptiso_struct::p_vel, and nptiso_struct::volume.
Referenced by observable_stress_tensor(), and observable_stress_tensor_acf_obs().
| void pressure_calc | ( | double * | result, |
| double * | result_t, | ||
| double * | result_nb, | ||
| double * | result_t_nb, | ||
| int | v_comp | ||
| ) |
Calculates the pressure in the system from a virial expansion using the terms from calculate_verlet_virials or nsq_calculate_virials dependeing on the used cell system.
| result | here the data about the scalar pressure are stored |
| result_t | here the data about the stress tensor are stored |
| result_nb | here the data about the intra- and inter- molecular nonbonded contributions to scalar pressure are stored |
| result_t_nb | here the data about the intra- and inter- molecular nonbonded contributions to stress tensor are stored |
| v_comp | flag which enables (1) compensation of the velocities required for deriving a pressure reflecting nptiso_struct::p_inst (hence it only works with domain decomposition); naturally it therefore doesn't make sense to use it without NpT. |
Definition at line 82 of file pressure.c.
References box_l, build_verlet_lists(), calc_long_range_virials(), calculate_link_cell_virials(), calculate_verlet_virials(), cell_structure, CELL_STRUCTURE_DOMDEC, CELL_STRUCTURE_LAYERED, CELL_STRUCTURE_NSQUARE, check_obs_calc_initialized(), comm_cart, Observable_stat::data, Observable_stat_non_bonded::data_nb, dd, DoubleList::e, i, init_p_tensor(), init_p_tensor_non_bonded(), init_virials(), init_virials_non_bonded(), layered_calculate_virials(), MPI_DOUBLE, MPI_Reduce(), MPI_SUM, DoubleList::n, nsq_calculate_virials(), on_observable_calc(), rebuild_verletlist, time_step, CellStructure::type, and DomainDecomposition::use_vList.
Referenced by mpi_gather_stats(), and mpi_gather_stats_slave().
Definition at line 34 of file pressure.c.
Referenced by tclcommand_analyze_parse_and_print_stress_tensor().
Definition at line 41 of file pressure.c.
Definition at line 35 of file pressure.c.
Referenced by tclcommand_analyze_parse_and_print_pressure(), tclcommand_analyze_parse_and_print_stress_tensor(), and tclcommand_analyze_print_stress_tensor_all().
Definition at line 42 of file pressure.c.
Referenced by tclcommand_analyze_parse_and_print_pressure(), tclcommand_analyze_parse_and_print_stress_tensor(), and tclcommand_analyze_print_stress_tensor_all().
Definition at line 33 of file pressure.c.
Referenced by invalidate_obs(), tclcommand_analyze_parse_and_print_pressure(), tclcommand_analyze_parse_and_print_stress_tensor(), and tclcommand_analyze_print_pressure_all().
Definition at line 40 of file pressure.c.
Referenced by tclcommand_analyze_parse_and_print_pressure(), tclcommand_analyze_parse_and_print_stress_tensor(), and tclcommand_analyze_print_pressure_all().
Definition at line 32 of file pressure.c.
Definition at line 39 of file pressure.c.
1.7.5.1