2022년 4월 19일 화요일

compile of the code for Eigenvector Continuation for elastic scattering

 Original Reference 

https://github.com/buqeye/eigenvector-continuation

which is the code for  arXiv:2007.03635,

To use the code in Windows, some modification is necessary.

Environment: Mingw64, gfortran, python, no lapack

(1) change the code of fortran file to use internal subroutine instead of lapack library. 

    this can be done simple commenting. 

(2) compile all fortran source code with f2py 

    python -m numpy.f2py -c  -m rmatrix_f2py   rmatrix_f2py.f

    python -m numpy.f2py -c  -m rmatrix_f2py_complex_potential rmatrix_f2py_complex_potential.f

    python -m numpy.f2py -c  -m coulomb_Barnett coulomb_Barnett.f 

(3) copy created dll files(in each sub-directories) to the source directory.

(4) Now we can use the fortran subroutines in python. 

(5) The jupyter notebook works now. 


2022년 1월 11일 화요일

2021년 10월 7일 목요일

interpolation with multi-dimensional grid data

Suppose we want to interpolate a multi-dimensional function

y = f(x1, x2, x3...) 

and we have numerical table of values at grid points of each axis. 

This interpolation can be done by using scipy.interpolate.interpn 

However, the data have to be prepared in specific forms. 


scipy.interpolate.interpn(pointsvaluesximethod='linear'bounds_error=Truefill_value=nan)


(1) "points" are tuple of grid points in each axis. 
     points = ( [array of possible grid points in 1st axis], [array of possible grid points in 2nd axis],...) 
     in other words, points=(x1,x2,...xn) such that  xn[i] gives i-th grid value in n-th axis. 

(2) "values" are n-dimensional array such that 

     value[ i1][i2][i3]...[in] = f( x1[i1],  x2[i2],..., xn[in] ) 

(3) "xi" is a coordinate to sample the value 



2021년 7월 8일 목요일

Physics journals

Let us list impact factors of related with my research.  (may be not so recent.) 

I am surprised that the rank of Physical Review C is not so high. 


1 REVIEWS OF MODERN PHYSICS 45.037

7 PHYSICS REPORTS-REVIEW SECTION OF PHYSICS LETTERS 25.798

9 Nature Physics 19.256

11 REPORTS ON PROGRESS IN PHYSICS 17.032

14 ADVANCES IN PHYSICS 16.375

17 PROGRESS IN PARTICLE AND NUCLEAR PHYSICS 13.421

18 Physical Review X 12.577

28 Annual Review of Nuclear and Particle Science 8.778

29 PHYSICAL REVIEW LETTERS 8.385

47 NUCLEAR DATA SHEETS 5.944

59 PHYSICAL REVIEW D 4.833

64 PHYSICS LETTERS B 4.384 

72 PHYSICS TODAY 3.875

79 COMPUTER PHYSICS COMMUNICATIONS 3.627

82 PHYSICAL REVIEW B 3.575

115 PHYSICAL REVIEW C 2.988

129 NUCLEAR PHYSICS B 2.817 

130 PHYSICAL REVIEW A 2.777

135 Frontiers in Physics 2.638

353 FEW-BODY SYSTEMS 0.823

396 JOURNAL OF THE KOREAN PHYSICAL SOCIETY 0.535

2021년 6월 11일 금요일

Creating personal library in Linux : 1. Fortran library to be used in Fortran (working)

 The purpose of this post is to summarize the procedure to make personal library of routines so that re-use previous works. 

(1) Fortran library to be used in Fortran 

(2) C/C++ library to be used in C/C++

(3) Fortran library to be used in C/C++

(4) C/C++ library to be used in Fortran

(5) Fortran library to be used in Python 

(6) C/C++ library to be used in Python 


Let us start from the first/second case. 

(1) to make a static library use "ar  crvs" 

ar rc liball.a dog.o cat.o bird.o #rc=replace/create

ranlib liball.a # make symbol indexing or use "s" for ar

to use

gcc main.c -L -l<filename>

(2) to make dynamic/shared library use linker like "gcc" ,"gfortran"

gcc -g -fPIC -Wall -Werror -Wextra -pedantic *.c -shared -o liball.so

to use dynamic library

gcc -g -wall -o app app.c liball.so

* if source file *.f use .mod file, one have to keep them to make shared library.
But once the shared library is created, .mod files are no more necessary. 

-------------------To be continued---------------------------------------------

2021년 6월 8일 화요일

tip: find "*.xxx" files recursively and remove them in linux

my solution: combine "find" and python

(1) find . -type f -name "*.xxx" > tt

(2) do following in python 

    import os

    ff= open('tt','r');fnames=ff.readlines();ff.close()

   for i in fnames:

    os.remove(i[:-1]) # remove \n in the end 


2021년 2월 14일 일요일