From bd542efa52002e7564ac46b249f679e020dbf617 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 16 Sep 2020 14:12:14 -0400 Subject: [PATCH] include math_eigen.h, remove it from .gitignore --- doc/src/pg_dev_utils.rst | 10 +++++----- src/.gitignore | 1 - src/math_eigen.h | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/math_eigen.h diff --git a/doc/src/pg_dev_utils.rst b/doc/src/pg_dev_utils.rst index 5a1668f20d..ce5ecf2e7a 100644 --- a/doc/src/pg_dev_utils.rst +++ b/doc/src/pg_dev_utils.rst @@ -428,11 +428,11 @@ Eigensolver functions The ``MathEigen`` sub-namespace of the ``LAMMPS_NS`` namespace contains functions and classes for eigensolvers. Currently only the -:cpp:func:`jacobi3 function ` -is used in various places in LAMMPS. That function is built on top -of a group of more generic eigensolvers that are maintained in the -``math_eigen_impl.h`` header file. This header contains the implementation -of three template classes: +:cpp:func:`jacobi3 function ` is used in various +places in LAMMPS. That function is built on top of a group of more +generic eigensolvers that are maintained in the ``math_eigen_impl.h`` +header file. This header contains the implementation of three template +classes: #. "Jacobi" calculates all of the eigenvalues and eigenvectors of a dense, symmetric, real matrix. diff --git a/src/.gitignore b/src/.gitignore index 54b5edd8e3..ebeb7076da 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -33,7 +33,6 @@ /pair_kim.h /superpose3d.h -/math_eigen.h /kokkos.cpp /kokkos.h diff --git a/src/math_eigen.h b/src/math_eigen.h new file mode 100644 index 0000000000..b30dbc7f89 --- /dev/null +++ b/src/math_eigen.h @@ -0,0 +1,40 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. (Some of the code in this file is also + available using a more premissive license. See below for details.) + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: Yuya Kurebayashi (Tohoku University, Lanczos algorithm) + Andrew Jewett (Scripps Research, Jacobi algorithm) +------------------------------------------------------------------------- */ + +#ifndef LMP_MATH_EIGEN_H +#define LMP_MATH_EIGEN_H + +namespace MathEigen { + +/** A specialized function which finds the eigenvalues and eigenvectors + * of a 3x3 matrix (in double ** format). + * + * \param mat the 3x3 matrix you wish to diagonalize + * \param eval store the eigenvalues here + * \param evec store the eigenvectors here... + * \return 0 if eigenvalue calculation converged, 1 if it failed */ + +int jacobi3(double const* const* mat, double *eval, double **evec); + +/** \overload */ + +int jacobi3(double const mat[3][3], double *eval, double evec[3][3]); + +} + +#endif //#ifndef LMP_MATH_EIGEN_H