Commit d41bdc00 authored by bors[bot]'s avatar bors[bot]

Merge #2923

2923: Move c_analyze.pxd into analyze.pxd r=KaiSzuttor a=jngrad

Fixes #1835

Description of changes:
- merged the two analyze.pxd files
- cleaned up documentation in analyze.pyx
- discovered and fixed an issue in a Sphinx plugin (3fb78244)
Co-authored-by: Jean-Noël Grad's avatarJean-Noël Grad <jgrad@icp.uni-stuttgart.de>
parents b7812cb4 25bda148
Pipeline #7740 passed with stages
in 59 minutes and 57 seconds
......@@ -193,8 +193,8 @@ html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
# If true, "(C) Copyright (C) 2018 The ESPResSo project
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# If true, "(C) Copyright (C) 2018 The ESPResSo project" is shown
# in the HTML footer. Default is True.
html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
......@@ -241,6 +241,9 @@ rst_prolog = """
rst_epilog = """
.. |es| replace:: `ESPResSo`
"""
# Re-enable grouping of arguments in numpydoc
# https://github.com/sphinx-doc/sphinx/issues/2227
napoleon_use_param = False
# -- Other options --------------------------------------------------------
......
......@@ -32,7 +32,7 @@
regex_sphinx_broken_link='<code class=\"xref py py-[a-z]+ docutils literal notranslate\"><span class=\"pre\">(?!(int|float|bool|str|object|list|tuple|dict)<)[^<>]+?</span></code>(?!</a>)'
# list of espresso modules not compiled in CI (visualization, scafacos)
regex_ignored_es_features_ci='^(espressomd\.)?(visualization|([a-z]+\.)?[sS]cafacos)'
regex_ignored_es_features_ci='(espressomd\.)?(visualization|([a-z]+\.)?[sS]cafacos)'
if [ ! -f doc/sphinx/html/index.html ]; then
echo "Please run Sphinx first."
......@@ -57,7 +57,7 @@ if [ $? = "0" ]; then
# skip espresso modules not compiled in CI (visualization, scafacos)
is_es_feature_skipped="false"
if [ "${CI}" != "" ]; then
grep -Pq "${regex_ignored_es_features_ci}" <<< "${reference}"
grep -Pq "^${regex_ignored_es_features_ci}" <<< "${reference}"
[ "$?" = "0" ] && is_es_feature_skipped="true"
fi
# private objects are not documented and cannot be linked
......
......@@ -16,14 +16,104 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For C-extern Analysis
from __future__ import print_function, absolute_import
cimport numpy as np
from espressomd.utils cimport *
from .utils cimport Vector9d
from libcpp.string cimport string # import std::string as string
from libcpp.vector cimport vector # import std::vector as vector
from libcpp.map cimport map # import std::map as map
cdef extern from "PartCfg.hpp":
cppclass PartCfg:
pass
cdef extern from "partCfg_global.hpp":
PartCfg & partCfg()
cdef extern from "particle_data.hpp":
int max_seen_particle_type
cdef extern from "statistics.hpp":
int n_part
int n_part_conf
int n_configs
ctypedef struct Observable_stat:
int init_status
List[double] data
int n_coulomb
int n_dipolar
int n_non_bonded
int n_virtual_sites
double * bonded
double * non_bonded
double * coulomb
double * dipolar
double * virtual_sites
double * external_fields
ctypedef struct Observable_stat_non_bonded:
pass
cdef void calc_structurefactor(PartCfg &, int * p_types, int n_types, int order, double ** sf)
cdef vector[vector[double]] modify_stucturefactor(int order, double * sf)
cdef double mindist(PartCfg &, const List[int] & set1, const List[int] & set2)
cdef double min_distance2(double pos1[3], double pos2[3])
cdef List[int] nbhood(PartCfg &, double pos[3], double r_catch, int planedims[3])
cdef double distto(PartCfg &, double pos[3], int pid)
cdef double * obsstat_bonded(Observable_stat * stat, int j)
cdef double * obsstat_nonbonded(Observable_stat * stat, int i, int j)
cdef double * obsstat_nonbonded_inter(Observable_stat_non_bonded * stat, int i, int j)
cdef double * obsstat_nonbonded_intra(Observable_stat_non_bonded * stat, int i, int j)
cdef vector[double] calc_linear_momentum(int include_particles, int include_lbfluid)
cdef vector[double] centerofmass(PartCfg &, int part_type)
cdef int calc_cylindrical_average(
PartCfg &, vector[double] center, vector[double] direction,
double length, double radius, int bins_axial, int bins_radial,
vector[int] types, map[string, vector[vector[vector[double]]]] & distribution)
void calc_rdf(PartCfg &, vector[int] p1_types, vector[int] p2_types,
double r_min, double r_max, int r_bins, vector[double] rdf)
void calc_rdf_av(PartCfg &, vector[int] p1_types, vector[int] p2_types,
double r_min, double r_max, int r_bins, vector[double] rdf,
int n_conf)
void angularmomentum(PartCfg &, int p_type, double * com)
void momentofinertiamatrix(PartCfg &, int p_type, double * MofImatrix)
void analyze_append(PartCfg &)
void calc_part_distribution(
PartCfg & , int * p1_types, int n_p1, int * p2_types, int n_p2,
double r_min, double r_max, int r_bins, int log_flag, double * low,
double * dist)
cdef extern from "statistics_chain.hpp":
int chain_start
int chain_n_chains
int chain_length
void calc_re(PartCfg & , double ** re)
void calc_rg(PartCfg & , double ** rg)
void calc_rh(PartCfg & , double ** rh)
cdef extern from "pressure.hpp":
cdef Observable_stat total_pressure
cdef Observable_stat_non_bonded total_pressure_non_bonded
cdef Observable_stat total_p_tensor
cdef Observable_stat_non_bonded total_p_tensor_non_bonded
cdef void update_pressure(int)
cdef extern from "energy.hpp":
cdef Observable_stat total_energy
cdef Observable_stat_non_bonded total_energy_non_bonded
cdef void master_energy_calc()
cdef void init_energies(Observable_stat * stat)
double calculate_current_potential_energy_of_system()
cdef extern from "dpd.hpp":
......
This diff is collapsed.
#
# Copyright (C) 2013-2018 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 <http://www.gnu.org/licenses/>.
#
# For C-extern Analysis
#
# TODO: Merge blocks of cdef extern for same headers.
#
from __future__ import print_function, absolute_import
cimport numpy as np
from espressomd.utils cimport *
from libcpp.string cimport string # import std::string as string
from libcpp.vector cimport vector # import std::vector as vector
from libcpp.map cimport map # import std::map as map
cdef extern from "PartCfg.hpp":
cppclass PartCfg:
pass
cdef extern from "partCfg_global.hpp":
PartCfg & partCfg()
cdef extern from "particle_data.hpp":
int max_seen_particle_type
cdef extern from "statistics.hpp":
cdef void calc_structurefactor(PartCfg &, int * p_types, int n_types, int order, double ** sf)
cdef vector[vector[double]] modify_stucturefactor(int order, double * sf)
cdef extern from "statistics.hpp":
ctypedef struct Observable_stat:
int init_status
List[double] data
int n_coulomb
int n_dipolar
int n_non_bonded
int n_virtual_sites
double * bonded
double * non_bonded
double * coulomb
double * dipolar
double * virtual_sites
double * external_fields
cdef extern from "statistics.hpp":
ctypedef struct Observable_stat_non_bonded:
pass
cdef double mindist(PartCfg &, const List[int] & set1, const List[int] & set2)
cdef double min_distance2(double pos1[3], double pos2[3])
cdef List[int] nbhood(PartCfg &, double pos[3], double r_catch, int planedims[3])
cdef double distto(PartCfg &, double pos[3], int pid)
cdef double * obsstat_bonded(Observable_stat * stat, int j)
cdef double * obsstat_nonbonded(Observable_stat * stat, int i, int j)
cdef double * obsstat_nonbonded_inter(Observable_stat_non_bonded * stat, int i, int j)
cdef double * obsstat_nonbonded_intra(Observable_stat_non_bonded * stat, int i, int j)
cdef vector[double] calc_linear_momentum(int include_particles, int include_lbfluid)
cdef vector[double] centerofmass(PartCfg &, int part_type)
cdef int calc_cylindrical_average(PartCfg & , vector[double] center,
vector[double] direction, double length,
double radius, int bins_axial,
int bins_radial, vector[int] types,
map[string, vector[vector[vector[double]]]] & distribution)
cdef extern from "pressure.hpp":
cdef Observable_stat total_pressure
cdef Observable_stat_non_bonded total_pressure_non_bonded
cdef Observable_stat total_p_tensor
cdef Observable_stat_non_bonded total_p_tensor_non_bonded
cdef void update_pressure(int)
cdef extern from "energy.hpp":
cdef Observable_stat total_energy
cdef Observable_stat_non_bonded total_energy_non_bonded
cdef void master_energy_calc()
cdef void init_energies(Observable_stat * stat)
cdef extern from "statistics_chain.hpp":
int chain_start
int chain_n_chains
int chain_length
void calc_re(PartCfg & , double ** re)
void calc_rg(PartCfg & , double ** rg)
void calc_rh(PartCfg & , double ** rh)
cdef extern from "statistics.hpp":
void calc_rdf(PartCfg &, vector[int] p1_types, vector[int] p2_types,
double r_min, double r_max, int r_bins, vector[double] rdf)
void calc_rdf_av(PartCfg &, vector[int] p1_types, vector[int] p2_types,
double r_min, double r_max, int r_bins, vector[double] rdf, int n_conf)
void angularmomentum(PartCfg &, int p_type, double * com)
void momentofinertiamatrix(PartCfg &, int p_type, double * MofImatrix)
cdef extern from "statistics.hpp":
int n_part
int n_part_conf
int n_configs
void analyze_append(PartCfg &)
cdef extern from "statistics.hpp":
void calc_part_distribution(
PartCfg & , int * p1_types, int n_p1, int * p2_types, int n_p2,
double r_min, double r_max, int r_bins, int log_flag,
double * low, double * dist)
from .c_analyze cimport PartCfg, partCfg
from .analyze cimport PartCfg, partCfg
from libcpp cimport bool
cdef extern from "utils/checks/charge_neutrality.hpp" namespace "Utils":
......
from __future__ import print_function, absolute_import
include "myconfig.pxi"
from .c_analyze cimport PartCfg, partCfg
from .analyze cimport PartCfg, partCfg
cdef extern from "diamond.hpp":
int create_diamond(PartCfg &, double a, double bond_length, int MPC, int N_CI, double val_nodes, double val_cM, double val_CI, int cM_dist, int nonet)
......
......@@ -30,7 +30,7 @@ IF SCAFACOS == 1:
from espressomd.utils cimport handle_errors
from espressomd.utils import is_valid_type, to_str
from . cimport checks
from .c_analyze cimport partCfg, PartCfg
from .analyze cimport partCfg, PartCfg
from .particle_data cimport particle
......@@ -215,17 +215,13 @@ IF P3M == 1:
The Ewald parameter.
cao : :obj:`float`, optional
The charge-assignment order, an integer between 0 and 7.
epsilon : :obj:`str`, optional
Use ``'metallic'`` to set the dielectric constant of the
surrounding medium to infinity (Default).
epsilon : :obj:`float`, optional
epsilon : :obj:`float` or :obj:`str`, optional
A positive number for the dielectric constant of the
surrounding medium.
mesh : :obj:`int`, optional
The number of mesh points.
mesh : array_like, optional
The number of mesh points in x, y and z direction. This is
relevant for noncubic boxes.
surrounding medium. Use ``'metallic'`` to set the dielectric
constant of the surrounding medium to infinity (default).
mesh : :obj:`int` or array_like of :obj:`int`, optional
The number of mesh points in x, y and z direction. Use a single
value for cubic boxes.
r_cut : :obj:`float`, optional
The real space cutoff.
tune : :obj:`bool`, optional
......@@ -245,12 +241,14 @@ IF P3M == 1:
if not (self._params["r_cut"] >= 0 or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"])):
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")
if (isinstance(self._params["mesh"], basestring) and len(self._params["mesh"]) == 3):
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or (self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or (self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or \
(self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or \
(self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
raise ValueError(
"P3M requires an even number of mesh points in all directions")
......@@ -357,17 +355,13 @@ IF P3M == 1:
The Ewald parameter.
cao : :obj:`float`, optional
The charge-assignment order, an integer between 0 and 7.
epsilon : :obj:`str`, optional
Use ``'metallic'`` to set the dielectric constant of the
surrounding medium to infinity (Default).
epsilon : :obj:`float`, optional
epsilon : :obj:`float` or :obj:`str`, optional
A positive number for the dielectric constant of the
surrounding medium.
mesh : :obj:`int`, optional
The number of mesh points.
mesh : array_like, optional
The number of mesh points in x, y and z direction. This is
relevant for noncubic boxes.
surrounding medium. Use ``'metallic'`` to set the dielectric
constant of the surrounding medium to infinity (default).
mesh : :obj:`int` or array_like of :obj:`int`, optional
The number of mesh points in x, y and z direction. Use a single
value for cubic boxes.
r_cut : :obj:`float`, optional
The real space cutoff
tune : :obj:`bool`, optional
......@@ -385,12 +379,14 @@ IF P3M == 1:
if not (self._params["r_cut"] >= 0 or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"])):
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")
if (isinstance(self._params["mesh"], basestring) and len(self._params["mesh"]) == 3):
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or (self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or (self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or \
(self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or \
(self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
raise ValueError(
"P3M requires an even number of mesh points in all directions")
......@@ -619,13 +615,15 @@ IF ELECTROSTATICS and MMM1D_GPU:
set_prefactor(self._params["prefactor"])
default_params = self.default_params()
self.thisptr.set_params(grid.box_l[2], coulomb.prefactor, self._params[
"maxPWerror"], self._params["far_switch_radius"], self._params["bessel_cutoff"])
self.thisptr.set_params(
grid.box_l[2], coulomb.prefactor, self._params["maxPWerror"],
self._params["far_switch_radius"], self._params["bessel_cutoff"])
def _tune(self):
self.thisptr.setup(dereference(self.interface))
self.thisptr.tune(dereference(self.interface), self._params[
"maxPWerror"], self._params["far_switch_radius"], self._params["bessel_cutoff"])
self.thisptr.tune(
dereference(self.interface), self._params["maxPWerror"],
self._params["far_switch_radius"], self._params["bessel_cutoff"])
def _activate_method(self):
check_neutrality(self._params)
......@@ -735,19 +733,21 @@ IF ELECTROSTATICS:
def _set_params_in_es_core(self):
set_prefactor(self._params["prefactor"])
if self._params["dielectric"]:
self._params["delta_mid_top"] = (self._params[
"mid"] - self._params["top"]) / (self._params["mid"] + self._params["top"])
self._params["delta_mid_bot"] = (self._params[
"mid"] - self._params["bot"]) / (self._params["mid"] + self._params["bot"])
self._params["delta_mid_top"] = (
self._params["mid"] - self._params["top"]) / (self._params["mid"] + self._params["top"])
self._params["delta_mid_bot"] = (
self._params["mid"] - self._params["bot"]) / (self._params["mid"] + self._params["bot"])
if self._params["const_pot"]:
self._params["delta_mid_top"] = -1
self._params["delta_mid_bot"] = -1
res = MMM2D_set_params(self._params["maxPWerror"],
self._params["far_cut"], self._params[
"delta_mid_top"],
self._params["delta_mid_bot"], self._params["const_pot"], self._params["pot_diff"])
self._params["far_cut"],
self._params["delta_mid_top"],
self._params["delta_mid_bot"],
self._params["const_pot"],
self._params["pot_diff"])
handle_errors("MMM2d setup")
if res:
raise Exception("MMM2D setup failed")
......
......@@ -77,8 +77,9 @@ IF DP3M == 1:
Ewald parameter.
cao : :obj:`int`
Charge-assignment order, an integer between -1 and 7.
mesh : :obj:`int` or array_like
Number of mesh points.
mesh : :obj:`int` or array_like of :obj:`int`
The number of mesh points in x, y and z direction. Use a single
value for cubic boxes.
mesh_off : array_like :obj:`float`
Mesh offset.
r_cut : :obj:`float`
......@@ -99,7 +100,7 @@ IF DP3M == 1:
if not (self._params["r_cut"] >= 0 or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"])):
if not (is_valid_type(self._params["mesh"], int) or len(self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")
......
......@@ -23,7 +23,7 @@ include "myconfig.pxi"
from libcpp.vector cimport vector
from .utils cimport Vector3d
from .c_analyze cimport PartCfg, partCfg
from .analyze cimport PartCfg, partCfg
cdef extern from "polymer.hpp":
vector[vector[Vector3d]] draw_polymer_positions(PartCfg &, int n_polymers, int beads_per_polymer, double bond_length, vector[Vector3d] & start_positions, double min_distance, int max_tries, int use_bond_angle, double bond_angle, int respect_constraints, int seed) except +
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment