Numerical Recipes Online is available here. As the
note says there, it is not instead of a license for using their routines.
Sample
programs are available from the author of Computational Physics (J.M.
Thijssen). Please do not plan on using these instead of writing your code
(that will be pretty obvious!) but they can be useful checks, and can help show
you what to do if you are stuck.
Simple spherical bessel function routine from Thijssen.
Note: I recommend using double precision (Real*8 in FORTRAN,
and double in C). The reason for this is that the course is oriented towards
first-principles computation of materials properties, and extremely high
accuracy is needed to compute chemically or mechanically important energies.
Sometimes the important contributions are in the 10th or 12th significant
figure of the total energy. Numerical Recipes routines are in single precision,
and must be modified for double. They advocate single precision, because that
is suitable for many applications, and points out to the student more clearly when
their algorithm is unstable. If you are using FORTRAN 90, a single change I
found is to change the lines in NRTYPE.F90 to:
INTEGER, PARAMETER :: SP = KIND(1.0D0)
INTEGER, PARAMETER :: DP = KIND(1.0)
which switches double and single! Another reason to always use double, is to
avoid incompatibilities in functions and subroutines, and save time in
debugging.
How to call Fortran from C (thanks to Matthew Fago)
extern void dsygv_(int *,char [],char [],int *,double *,int *,double *,int *,double *,double *,int *,int *);
C routines for generalized eigenproblem (Thanks to Peter Bogdanoff)
APW program from Thjissen and potential for Cu 11/22/00