add files for public distribution
based on internal repository 0a462b6 2017-11-22 14:41:39 +0100
This commit is contained in:
3
pmsco/edac/.gitignore
vendored
Normal file
3
pmsco/edac/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
edac.py
|
||||
edac_wrap.cxx
|
||||
revision.py
|
1
pmsco/edac/__init__.py
Normal file
1
pmsco/edac/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
__author__ = 'muntwiler_m'
|
7
pmsco/edac/edac.i
Normal file
7
pmsco/edac/edac.i
Normal file
@ -0,0 +1,7 @@
|
||||
/* EDAC interface for other programs */
|
||||
%module edac
|
||||
%{
|
||||
extern int run_script(char *scriptfile);
|
||||
%}
|
||||
|
||||
extern int run_script(char *scriptfile);
|
130
pmsco/edac/edac_all.patch
Normal file
130
pmsco/edac/edac_all.patch
Normal file
@ -0,0 +1,130 @@
|
||||
*** /home/muntwiler_m/mnt/pearl_data/software/edac/edac_all.cpp 2011-04-14 23:38:44.000000000 +0200
|
||||
--- edac_all.cpp 2016-02-11 12:15:45.322049772 +0100
|
||||
***************
|
||||
*** 10117,10122 ****
|
||||
--- 10117,10123 ----
|
||||
void scan_imfp(char *name);
|
||||
void scan_imfp(FILE *fout);
|
||||
numero iimfp_TPP(numero kr);
|
||||
+ numero iimfp_SD(numero kr);
|
||||
numero TPP_rho, TPP_Nv, TPP_Ep, TPP_Eg;
|
||||
numero screening_length;
|
||||
int scattering_so;
|
||||
***************
|
||||
*** 10230,10235 ****
|
||||
--- 10231,10237 ----
|
||||
|
||||
int n_th;
|
||||
int n_fi;
|
||||
+ int n_ang;
|
||||
numero *th, *fi;
|
||||
|
||||
numero *th_out,
|
||||
***************
|
||||
*** 10239,10244 ****
|
||||
--- 10241,10247 ----
|
||||
void free(void);
|
||||
void init_th(numero thi, numero thf, int nth);
|
||||
void init_phi(numero fii, numero fif, int nfi);
|
||||
+ void read_angles(FILE *fin, char *my_file);
|
||||
void init_refraction(
|
||||
numero refraction);
|
||||
void init_transmission(
|
||||
***************
|
||||
*** 12485,12490 ****
|
||||
--- 12488,12494 ----
|
||||
else {
|
||||
kr=sqrt(sqr(calc.k[ik])+2*V0);
|
||||
if(iimfp_flag==0) ki=iimfp.val(kr)/2;
|
||||
+ else if(iimfp_flag==3) ki=iimfp_SD(kr)/2;
|
||||
else ki=iimfp_TPP(kr)/2;
|
||||
set_k(complex(kr,ki));
|
||||
} } else if(calc.k_flag==2) set_k(calc.kc[ik]);
|
||||
***************
|
||||
*** 12507,12512 ****
|
||||
--- 12511,12522 ----
|
||||
numero imfp=E/(TPP_Ep*TPP_Ep*(beta*log(gamma*E)-C/E+D/(E*E)))/a0_au;
|
||||
return 1/imfp;
|
||||
}
|
||||
+ numero propagation::iimfp_SD(numero kr)
|
||||
+ {
|
||||
+ numero E=sqr(kr)/2*au_eV;
|
||||
+ numero imfp = (1.43e3/sqr(E) + 0.54*sqrt(E))/a0_au;
|
||||
+ return 1/imfp;
|
||||
+ }
|
||||
void propagation::scan_imfp(char *name)
|
||||
{
|
||||
FILE *fout=NULL;
|
||||
***************
|
||||
*** 13202,13208 ****
|
||||
}
|
||||
final_state::final_state(void)
|
||||
{
|
||||
! n_th=n_fi=0;
|
||||
n_1=n_2=0;
|
||||
Ylm0_th_flag=Ylm0_fi_flag=0;
|
||||
mesh_flag=0;
|
||||
--- 13212,13218 ----
|
||||
}
|
||||
final_state::final_state(void)
|
||||
{
|
||||
! n_th=n_fi=n_ang=0;
|
||||
n_1=n_2=0;
|
||||
Ylm0_th_flag=Ylm0_fi_flag=0;
|
||||
mesh_flag=0;
|
||||
***************
|
||||
*** 13233,13238 ****
|
||||
--- 13243,13271 ----
|
||||
if(n_fi==1) fi[0]=fii;
|
||||
else for(j=0; j<n_fi; j++) fi[j]=fii+j*(fif-fii)/(n_fi-1);
|
||||
} }
|
||||
+ void final_state::read_angles(FILE *fin, char *my_file)
|
||||
+ {
|
||||
+ FILE *fang; int i, nang;
|
||||
+ if(!strcmpC(my_file,"inline")) fang=fin;
|
||||
+ else fang=open_file(foutput,my_file,"r");
|
||||
+ nang=read_int(fang);
|
||||
+ free_mesh();
|
||||
+ if(nang>1) {
|
||||
+ delete [] th; delete [] th_out; delete [] transmission; delete [] fi;
|
||||
+ n_th=nang;
|
||||
+ th=new numero [n_th];
|
||||
+ th_out=new numero [n_th];
|
||||
+ transmission=new numero [n_th];
|
||||
+ n_fi=nang;
|
||||
+ fi=new numero [n_fi];
|
||||
+ for(i=0; i<nang; i++) {
|
||||
+ th[i]=th_out[i]=read_numero(fang);
|
||||
+ transmission[i]=1;
|
||||
+ fi[i]=read_numero(fang);
|
||||
+ }
|
||||
+ }
|
||||
+ if(strcmpC(my_file,"inline")) fclose(fang);
|
||||
+ }
|
||||
void final_state::init_refraction(numero refraction)
|
||||
{
|
||||
int i;
|
||||
***************
|
||||
*** 14743,14748 ****
|
||||
--- 14776,14783 ----
|
||||
|| scat.TPP_Ep<=0 || scat.TPP_Eg<0)
|
||||
on_error(foutput,"(input) imfp TPP-2M", "wrong parameters");
|
||||
scat.iimfp_flag=1;
|
||||
+ } else if(!strcmpC(name,"SD-UC")) {
|
||||
+ scat.iimfp_flag=3;
|
||||
} else {
|
||||
scat.read_imfp(fprog,name);
|
||||
scat.iimfp_flag=0;
|
||||
***************
|
||||
*** 15162,15164 ****
|
||||
--- 15197,15206 ----
|
||||
fprintf(foutput,"That's all, folks!\n");
|
||||
return 0;
|
||||
}
|
||||
+ int run_script(char *scriptfile)
|
||||
+ {
|
||||
+ particle_type=electrones;
|
||||
+ init_fact();
|
||||
+ electron.program(scriptfile);
|
||||
+ return 0;
|
||||
+ }
|
52
pmsco/edac/makefile
Normal file
52
pmsco/edac/makefile
Normal file
@ -0,0 +1,52 @@
|
||||
SHELL=/bin/sh
|
||||
|
||||
# makefile for EDAC program and module
|
||||
#
|
||||
# the EDAC source code is not included in the public distribution.
|
||||
# please obtain it from the original author,
|
||||
# copy it to this directory,
|
||||
# and apply the edac_all.patch patch before compilation.
|
||||
#
|
||||
# see the top-level makefile for additional information.
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .cpp .cxx .exe .f .h .i .o .py .pyf .so
|
||||
.PHONY: all clean edac
|
||||
|
||||
FC=gfortran
|
||||
FCCOPTS=
|
||||
F2PY=f2py
|
||||
F2PYOPTS=
|
||||
CC=g++
|
||||
CCOPTS=-Wno-write-strings
|
||||
SWIG=swig
|
||||
SWIGOPTS=
|
||||
PYTHON=python
|
||||
PYTHONOPTS=
|
||||
|
||||
all: edac
|
||||
|
||||
edac: edac.exe _edac.so edac.py
|
||||
|
||||
edac.exe: edac_all.cpp
|
||||
$(CC) $(CCOPTS) -o edac.exe edac_all.cpp
|
||||
|
||||
edac_wrap.cxx: edac_all.cpp edac.i
|
||||
$(SWIG) $(SWIGOPTS) -c++ -python edac.i
|
||||
|
||||
edac.py _edac.so: edac_wrap.cxx setup.py
|
||||
$(PYTHON) $(PYTHONOPTS) setup.py build_ext --inplace
|
||||
|
||||
revision.py: _edac.so
|
||||
git log --pretty=format:"code_rev = 'Code revision %h, %ad'" --date=iso -1 > $@ || echo "code_rev = 'Code revision unknown, "`date +"%F %T %z"`"'" > $@
|
||||
echo "" >> revision.py
|
||||
|
||||
revision.txt: _edac.so edac.exe
|
||||
git log --pretty=format:"Code revision %h, %ad" --date=iso -1 > $@ || echo "Code revision unknown, "`date +"%F %T %z"` > $@
|
||||
echo "" >> revision.txt
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o *.exe
|
||||
rm -f *_wrap.cxx
|
||||
rm -f revision.py
|
||||
rm -f revision.txt
|
20
pmsco/edac/setup.py
Normal file
20
pmsco/edac/setup.py
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
setup.py file for EDAC
|
||||
"""
|
||||
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
|
||||
edac_module = Extension('_edac',
|
||||
sources=['edac_wrap.cxx', 'edac_all.cpp'],
|
||||
)
|
||||
|
||||
setup (name = 'edac',
|
||||
version = '0.1',
|
||||
author = "Matthias Muntwiler",
|
||||
description = """EDAC module in Python""",
|
||||
ext_modules = [edac_module],
|
||||
py_modules = ["edac"], requires=['numpy']
|
||||
)
|
Reference in New Issue
Block a user