Skip to content

FAC - Flexible Atomic Code by Ming Feng Gu

License

Notifications You must be signed in to change notification settings

Liu0813/fac

 
 

Repository files navigation

Flexible Atomic Code

travis

A software packge for the calculation of various atomic processes.

Installation

There are two interfaces available to the FAC numerical lib. One makes use of the Python scripting language, implemented as a package "pfac". The other interface uses a simple command parser, compiled into executables. The two interfaces are independent. Either one or both can be installed.

1. Download

Download the latest source packages from here, gunzip, and extract it.

2. Configure

Execute configure command. You may need to specify some of the following options depending on your environment.

2-1. C/fortran compiler

If your C compiler is not gcc, then you need to supply the PIC (position independent code) option with --enable-cpic=***. If your F77 compiler is not g77, then you need to supply the PIC option with --enable-fpic=***

Supply the optimization option for C and F77 compilers with --enable-copt=*** and --enable-fopt=*** respectively if desired.

2-2. cfortran

If your F77 compiler is not g77 or sun's f77, specify the option --with-cfortran=xxFortran see faclib/cfortran.doc for supported F77 compilers.

2-3. Installation directory

If the default /usr/local is not what you want, specify --prefix=my/dir. This dir only affects the installation of SFAC executables.

2-4. Parallel computation

Some of the functions have a parallel version using MPI. You can build with MPI enabled using the option --with-mpi=***, where *** is the MPI implementation installed on your machine. It has been tested with lammpi and openmp. If you are using openmp, specify --with-mpi=omp.

If a different version of MPI is used, you have to supply the compile and link flags to the C compiler with --with-mpicompile and --with-mpilink.

2-5. MacOS X Big Sur

Big Sur handles dynamically loaded libraries very differently. It no longer has libSystem.dylib and libSystem.B.dylib files, and no longer has standard C headers and librarries in the /usr/include and /usr/lib direrctores. It therefore breaks the third party gcc compilers, e.g., the one from MacPort installation. Here are steps to work around these issues:

  1. In /usr/local/lib directory, create two files libSystem.dylib and libSystem.B.dylib. It does not matter what are in the files, as long as they are reasonably sized. You can simply create two symlinks to some existing dylib files, and make sure /usr/local/lib is in your LD_LIBRARY_PATH env variable. This is to simply fool gcc and linker to believe that the two dylib files exist. The linker will actually find the libraries from Big Sur's shared cache, instead of from the files.

  2. Set env variable CC="gcc -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include -L/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib" This is to instruct gcc and linker to find the standard C header and library files from the SDK locations, and the /usr/include and /usr/lib no longer have links to them.

  3. Proceed with ./configure as usual.

3. Install SFAC interface

To installs the SFAC interface, do

make
make install

4. Install Python interface

If you have Python 2.7 or later installed, then:

make pfac
make install-pfac

This installs the PFAC interface into Python's default site-package dir.

4-1 Anaconda distribution

If your are using Anaconda distribution for Python environment, it may be necessary to install gcc compilers from Anacona. Linux:

  • gcc_linux-64
  • gfortran_linux-64

macOS:

  • clang_osx-64
  • clangxx_osx-64
conda install gcc_linux-64 gfortran_linux-64

For the details of the Anaconda's compiler, see the official page.

It would be better to create a new virtual environment for FAC, as the compiler installation sometimes affects other Python packages. For the details of the virtual environment, see Anaconda's documentation

Usage

PFAC interface

The modules can be called just like any python modules, either from the interpreter interactively, or pass the script to python. e.g.,

python fe24_level.py

Some example scripts can be found in demo directory.

Note that PFAC is not thread safe. Only one instance of calculation can be done in one Python kernel.

SFAC Interface

The non-python interface produces 3 executables, "sfac", "scrm" and "spol", accepting input files as arguments. The syntax of the input file for both programs is identical, and is very similar to the Python syntax, except for the missing of flow controls.

Manual

For more details, please read the manual, including the FAQ section of it.

Contents of FAC

Third party content that cannot be distributed under GPL.

These directories are bundled in fac_util.tar.gz, and are listed in the UtilList file.

  • blas/, BLAS routines in fortran.
  • coul/, fortran routines related to coulomb functions.
  • ionis/, ionization balance calculation of Arnaud&Raymond, and that of Mazzotta et al. Rates fitted by Verner et al.
  • lapack/, fortran routines from LAPACK.
  • minpack/, minpack optimization package.
  • quadpack/, some routines from quadpack for quadrature.
  • mpfun/, it used to be the multi-precision floating point arithmetic package by Beiley. Since v0.8.6, it was replaced by my own implementation of quad-precision arithmetics. The associated Legendre functions are also put into this directory.
  • ode/, Livermore Solver for odinary differential equations.
  • toms/, some numerical routines from TOMS.

Contents distributed under GPL.

These files are bundled in fac_core.tar.gz

  • README, this file.
  • ChangeLog, changes.
  • configure.ac,AutoConf input file
  • configure, configure script after parsing configure.ac
  • setup.py, python setup script for building the pfac interface
  • demo/, some demo scripts.
  • doc/, reference guide for FAC
  • doc/papers/, papers describe the theoretical backgrounds.
  • faclib/, core numerical library.
  • python/, python interface.
  • sfac/, non-python interface.

Contribution

For bugs and suggestions, please report to our issue page.

Contact

[email protected] Ming Feng Gu. Space Science Laboratory University of California Berkeley

About

FAC - Flexible Atomic Code by Ming Feng Gu

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Fortran 52.5%
  • C 44.6%
  • Python 2.6%
  • Makefile 0.1%
  • M4 0.1%
  • Shell 0.1%