-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aesthetic changes to the source code.
- Loading branch information
1 parent
afc22bc
commit de452d5
Showing
8 changed files
with
131 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,29 +3,31 @@ | |
* Lesser Public License. If a copy of the LGPL was not -/ | ||
* distributed with this file, you can obtain one at -/ | ||
* https://www.gnu.org/licenses/lgpl.html. -/ | ||
********************************************************/ | ||
******************************************************** | ||
/** \file commonFunctions.h | ||
/** \file commonFunctions.h | ||
* | ||
* \author Joey Dumont <[email protected]> | ||
* | ||
* \since 2014-07-10 | ||
* | ||
* \brief Defines some common functions to the C++ and Fortran code. | ||
* \brief Defines some common functions to the C++ and Fortran code. | ||
* | ||
* We define some functions that will be of use in both the C++ and Fortran | ||
* parts of this library. | ||
* parts of this library. | ||
* | ||
*/ | ||
|
||
namespace WignerSymbols { | ||
template <typename T> | ||
double sgn(T val) | ||
|
||
template <typename T> | ||
double sgn(T val) | ||
{ | ||
int sgn = (T(0) < val) - (val < T(0)); | ||
if (sgn == 0) | ||
return 1.0; | ||
else | ||
return (double)sgn; | ||
} | ||
} | ||
|
||
} // namespace WignerSymbols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,28 +3,28 @@ | |
* Lesser Public License. If a copy of the LGPL was not -/ | ||
* distributed with this file, you can obtain one at -/ | ||
* https://www.gnu.org/licenses/lgpl.html. -/ | ||
********************************************************/ | ||
********************************************************/ | ||
|
||
#ifndef WIGNER_SYMBOLS_CPP_H | ||
#define WIGNER_SYMBOLS_CPP_H | ||
|
||
/** \file wignerSymbols-cpp.h | ||
/** \file wignerSymbols-cpp.h | ||
* | ||
* \author Joey Dumont <[email protected]> | ||
* | ||
* \since 2013-08-16 | ||
* | ||
* \brief Defines utility functions for the evaluation of Wigner-3j and -6j symbols. | ||
* \brief Defines utility functions for the evaluation of Wigner-3j and -6j symbols. | ||
* | ||
* We compute the Wigner-3j and -6j symbols | ||
* We compute the Wigner-3j and -6j symbols | ||
* f(L1) = ( L1 L2 L3) | ||
* (-M2-M3 M2 M3) | ||
* for all allowed values of L1, the other parameters | ||
* being held fixed. The algorithm is based on the work | ||
* being held fixed. The algorithm is based on the work | ||
* by Schulten and Gordon. | ||
* K. Schulten, "Exact recursive evaluation of 3j- and 6j-coefficients for quantum-mechanical coupling of angular momenta," | ||
* J. Math. Phys. 16, 1961 (1975). | ||
* K. Schulten and R. G. Gordon, "Recursive evaluation of 3j and 6j coefficients," | ||
* K. Schulten and R. G. Gordon, "Recursive evaluation of 3j and 6j coefficients," | ||
* Comput. Phys. Commun. 11, 269–278 (1976). | ||
*/ | ||
|
||
|
@@ -36,8 +36,8 @@ | |
|
||
namespace WignerSymbols { | ||
|
||
/*! @name Evaluation of Wigner-3j and -6j symbols. | ||
* We implement Schulten's algorithm in C++. | ||
/*! @name Evaluation of Wigner-3j and -6j symbols. | ||
* We implement Schulten's algorithm in C++. | ||
*/ | ||
///@{ | ||
std::vector<double> wigner3j(double l2, double l3, | ||
|
@@ -64,12 +64,12 @@ double wigner6j_auxB(double l1, double l2, double l3, | |
double l4, double l5, double l6); | ||
|
||
/*! Computes the Clebsch-Gordan coefficient by relating it to the | ||
* Wigner 3j symbol. It sometimes eases the notation to use the | ||
* Wigner 3j symbol. It sometimes eases the notation to use the | ||
* Clebsch-Gordan coefficients directly. */ | ||
inline double clebschGordan(double l1, double l2, double l3, | ||
double m1, double m2, double m3) | ||
{ | ||
// We simply compute it via the 3j symbol. | ||
// We simply compute it via the 3j symbol. | ||
return (pow(-1.0,l1-l2+m3)*sqrt(2.0*l3+1.0)*wigner3j(l1,l2,l3,m1,m2,-m3)); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,30 @@ | |
* Lesser Public License. If a copy of the LGPL was not -/ | ||
* distributed with this file, you can obtain one at -/ | ||
* https://www.gnu.org/licenses/lgpl.html. -/ | ||
********************************************************/ | ||
********************************************************/ | ||
|
||
#ifndef WIGNER_SYMBOLS_FORTRAN_H | ||
#define WIGNER_SYMBOLS_FORTRAN_H | ||
|
||
/** \file wignerSymbols-fortran.h | ||
/** \file wignerSymbols-fortran.h | ||
* | ||
* \author Joey Dumont <[email protected]> | ||
* | ||
* \since 2013-08-16 | ||
* | ||
* \brief Defines utility functions for the evaluation of Wigner-3j and -6j symbols. | ||
* \brief Defines utility functions for the evaluation of Wigner-3j and -6j symbols. | ||
* | ||
* We use modified SLATEC (http:https://netlib.org/slatec) Fortran subroutines to compute | ||
* Wigner-3j and -6j symbols. We modified the subroutines so that they do not depend | ||
* d1mach, r1mach or i1mach as these are obsolete routines. They have been replaced | ||
* We use modified SLATEC (http:https://netlib.org/slatec) Fortran subroutines to compute | ||
* Wigner-3j and -6j symbols. We modified the subroutines so that they do not depend | ||
* d1mach, r1mach or i1mach as these are obsolete routines. They have been replaced | ||
* by intrinsics such as huge(), tiny(), epsilon() and spacing(), which are guaranteed | ||
* to work. The file wignerSymbols.f contain the subroutines and their | ||
* dependencies. | ||
* dependencies. | ||
* | ||
* We rely on the ISO C Binding to bind the Fortran subroutines to C++. This method | ||
* of working insures that proper type casts are performed, among other things. We | ||
* then use the same method as we did before (extern "C"). | ||
* | ||
* | ||
*/ | ||
|
||
#include <cmath> | ||
|
@@ -50,11 +50,11 @@ std::vector<double> wigner3j_f(double l2, double l3, double m1, double m2, doubl | |
double wigner3j_f(double l1, double l2, double l3, double m1, double m2, double m3); | ||
|
||
/*! Computes the Clebsch-Gordan coefficient by relating it to the | ||
* Wigner 3j symbol. It sometimes eases the notation to use the | ||
* Wigner 3j symbol. It sometimes eases the notation to use the | ||
* Clebsch-Gordan coefficients directly. */ | ||
inline double clebschGordan_f(double l1, double l2, double l3, double m1, double m2, double m3) | ||
{ | ||
// We simply compute it via the 3j symbol. | ||
// We simply compute it via the 3j symbol. | ||
return (pow(-1.0,l1-l2+m3)*sqrt(2.0*l3+1.0)*wigner3j_f(l1,l2,l3,m1,m2,-m3)); | ||
} | ||
|
||
|
Oops, something went wrong.