IGMPlot 3.17.3
Optimized IGMplot version able to use wfn/wfx/rkf/xyz files
Loading...
Searching...
No Matches
toolbox.h
Go to the documentation of this file.
1/*
2 * Copyright University of Reims Champagne-Ardenne
3 * Authors and Contributors: Akilan RAJAMANI, Corentin LEFEBVRE, Johanna KLEIN,
4 * Emmanuel PLUOT, Gaetan RUBEZ, Hassan KHARTABIL,
5 * Jean-Charles BOISSON and Eric HENON
6 * (24/07/2017)
7 * jean-charles.boisson@univ-reims.fr, eric.henon@univ-reims.fr
8 *
9 * This software is a computer program whose purpose is to
10 * detect and quantify interactions from electron density
11 * obtained either internally from promolecular density or
12 * calculated from an input wave function input file. It also
13 * prepares for the visualization of isosurfaces representing
14 * several descriptors (dg) coming from the IGM methodology.
15 *
16 * This software is governed by the CeCILL-C license under French law and
17 * abiding by the rules of distribution of free software. You can use,
18 * modify and/ or redistribute the software under the terms of the CeCILL-C
19 * license as circulated by CEA, CNRS and INRIA at the following URL
20 * "http://www.cecill.info".
21 *
22 * As a counterpart to the access to the source code and rights to copy,
23 * modify and redistribute granted by the license, users are provided only
24 * with a limited warranty and the software's author, the holder of the
25 * economic rights, and the successive licensors have only limited
26 * liability.
27 *
28 * In this respect, the user's attention is drawn to the risks associated
29 * with loading, using, modifying and/or developing or reproducing the
30 * software by the user in light of its specific status of free software,
31 * that may mean that it is complicated to manipulate, and that also
32 * therefore means that it is reserved for developers and experienced
33 * professionals having in-depth computer knowledge. Users are therefore
34 * encouraged to load and test the software's suitability as regards their
35 * requirements in conditions enabling the security of their systems and/or
36 * data to be ensured and, more generally, to use and operate it in the
37 * same conditions as regards security.
38 *
39 * The fact that you are presently reading this means that you have had
40 * knowledge of the CeCILL-C license and that you accept its terms.
41 *
42 * */
43
48
49#ifndef _TOOLBOX_H_
50#define _TOOLBOX_H_
51
52
53// STL
54// JC Move to general
55//#include <set>
56//#include <sstream>
57//#include <iostream>
58//#include <fstream>
59//#include <iomanip>
60//#include <fstream>
61//#include <cstdlib>
62//#include <vector>
63
64// LOCAL
65//#include <general.h>
66#include <eig3.h>
67//#include <reader.h> fait planter la compil ...
68// donc, je redefinis les atomnames ici ...: pas propre ...
69const std::string ATOM_NAMES_ERIC [] =
70 {
71 "H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc", "Ru","Rh","Pd","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"
72 };
73
74
86double getMaxFromPrec3DMatrix (double*** _3DMatrix, const unsigned int dimX, const unsigned int dimY,
87 const unsigned int dimZ, double *** rho, const double lowerlimit, const double upperlimit);
88
100double getMinFromPrec3DMatrix (double*** _3DMatrix, const unsigned int dimX, const unsigned int dimY,
101 const unsigned int dimZ, double *** rho, const double lowerlimit, const double upperlimit);
102
103
114double getMaxFrom2Matrices(double*** cube1, double*** cube2,double threshold, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ);
115// this method returns the maximum value found in cube1 for which cube2 >threshold
116
117
130//double getMaxFromPrecVectorized3DMatrix (double* _Vectorized3DMatrix, double* cubeRho, const double threshold, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ);
131double getMaxFromPrecVectorized3DMatrix (double* _Vectorized3DMatrix, double* cubeRho, const double lowerlimit, const double upperlimit,
132 unsigned int dimX, const unsigned int dimY, const unsigned int dimZ);
133
134
140std::string getCondensedInformationFromNumericSet(std::set<int> numericValues);
141
147void space(size_t nbSpaces, size_t limit=100);
148
155//void printCurrentState(bool start=true, bool end=false, unsigned int currentValue=0, unsigned int totalToReach=0);
156void printCurrentState(unsigned int done, unsigned int total, time_t ellapsed);
157
158
159void printDEBUG(std::string message);
160
167double getScalarProduct( const double *vectorA, const double *vectorB );
168
175double getCrossProductMagn(const double *vectorA, const double *vectorB);
176
177
183double getNormOfVector( const double *vectorA);
184
190/*double getNormOfVector(const double vectorA[3]);*/
191
192
201void computeRotationMatrix(const double V[3], const double alpha, double rotMat[3][3]);
202
209void fortranMatMul33Matrix3Vector(const double matrix[3][3], const double V[3], double VR[3]);
210
215void print_3_3_matrix(const double matrix[3][3]);
216
222std::string getAtomName(const unsigned int iatom);
223
229bool isStringInt(const std::string s);
230
237bool invSym33(double M[3][3], double MINV[3][3]);
238
245int modulo(int a, int b);
246
247
254double distance(double a[3], double b[3]);
255
256
262void getTransposed(double **M1, double M2[3][3]);
263
269void getTransposed(double M1[3][3], double M2[3][3]);
270
275bool isNumeric(std::string const &str);
276
287double getSelfMaxRange(double*** cube,double*** cube2, double threshold,const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ);
288
297void merge(double* arr, double* temp, int left, int mid, int right);
298
299
308void parallelMergeSort(double* arr, double* temp, int left, int right, int depth = 0);
309
310
311
312#endif
313
Eigen-decomposition for symmetric 3x3 real matrices.Public domain, copied from the public domain Java...
bool isNumeric(std::string const &str)
function that takes a string as input and check it is numeric
Definition toolbox.cpp:773
double getMaxFrom2Matrices(double ***cube1, double ***cube2, double threshold, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ)
From cube1, return the maximum value found for which cube2 > threshold.
Definition toolbox.cpp:209
double getMaxFromPrec3DMatrix(double ***_3DMatrix, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ, double ***rho, const double lowerlimit, const double upperlimit)
From a 3D matrix, return the maximum value found.
Definition toolbox.cpp:55
double getSelfMaxRange(double ***cube, double ***cube2, double threshold, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ)
function that returns the 90e percentil of a given cube of values
Definition toolbox.cpp:115
double distance(double a[3], double b[3])
function that returns the distance between two points a and b
Definition toolbox.cpp:733
double getScalarProduct(const double *vectorA, const double *vectorB)
Tool procedure computing scalar product between two 3D vectors.
Definition toolbox.cpp:487
std::string getCondensedInformationFromNumericSet(std::set< int > numericValues)
From a set of numeric value, return a string version of the content with interval (if the information...
Definition toolbox.cpp:274
void parallelMergeSort(double *arr, double *temp, int left, int right, int depth=0)
Recursively sorts the array segment [left, right) using Merge Sort,with parallelism enabled for large...
Definition toolbox.cpp:173
void fortranMatMul33Matrix3Vector(const double matrix[3][3], const double V[3], double VR[3])
Specific version of Fortran MatMul for 3*3 matrix and a vector.
void space(size_t nbSpaces, size_t limit=100)
Print spaces characters.
Definition toolbox.cpp:343
void merge(double *arr, double *temp, int left, int mid, int right)
function Merging two sorted subarrays into one sorted array segment:
Definition toolbox.cpp:156
double getCrossProductMagn(const double *vectorA, const double *vectorB)
computes the magnitude of the cross product between two given vectors
Definition toolbox.cpp:492
void getTransposed(double **M1, double M2[3][3])
function that take the transposed matrix of M1 and put it in M2
Definition toolbox.cpp:744
double getMaxFromPrecVectorized3DMatrix(double *_Vectorized3DMatrix, double *cubeRho, const double lowerlimit, const double upperlimit, unsigned int dimX, const unsigned int dimY, const unsigned int dimZ)
From a Vectorized 3D matrix, return the maximum value found.
Definition toolbox.cpp:237
void printCurrentState(unsigned int done, unsigned int total, time_t ellapsed)
Tool to display timing info for user.
Definition toolbox.cpp:358
bool invSym33(double M[3][3], double MINV[3][3])
function that computes the inverse of a 3x3 symmetric matrix
Definition toolbox.cpp:662
double getMinFromPrec3DMatrix(double ***_3DMatrix, const unsigned int dimX, const unsigned int dimY, const unsigned int dimZ, double ***rho, const double lowerlimit, const double upperlimit)
From a 3D matrix, return the maximum value found.
Definition toolbox.cpp:85
double getNormOfVector(const double *vectorA)
Tool procedure computing the norm of a given 3D vector.
Definition toolbox.cpp:601
bool isStringInt(const std::string s)
function to test that a string really represents an integer
Definition toolbox.cpp:655
int modulo(int a, int b)
function that returns the modulo of a by b (works for negative a values)
Definition toolbox.cpp:722