有一个名为GranFilm 的程序,用于计算球的极化率。我想从程序中提取该值。您可能会猜到,我没有使用Fortran的经验。我学会了如何仅从单个.f90文件成功导入Fortran函数...在程序中,有十几个文件。我试图将它们全部列出,如下所示:F2py example无济于事。我不确定命令中应该包含什么。
可极化性是在Opticals_mod.f90中计算的。该文件使用Global_definitions.f90和Interaction_mod.f90。
我尝试过的事情:
f2py -m test -h Test.py global_def.f90 optics_mod.f90 integral_mod.f90
我得到的是:
(base) C:\Users\Intel\Desktop\Sphere>call "C:\Anaconda3\Scripts\\..\python.exe" "C:\Anaconda3\Scripts\\f2py.py" -m test -h test.py global_def.f90 optics_mod.f90 integral_mod.f90
Reading fortran codes...
Reading file 'global_def.f90' (format:free)
Reading file 'os.h' (format:fix)
Reading file 'optics_mod.f90' (format:free)
Reading file 'integral_mod.f90' (format:free)
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "type" with "type_bn".
rmbadname1: Replacing "type" with "type_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
rmbadname1: Replacing "int" with "int_bn".
Post-processing...
Block: test
Block: global_definitions
In: :test:global_def.f90:global_definitions
get_parameters: got "invalid syntax (<string>, line 1)" on '(0.wp,1.'
Block: parameters
Block: surface_constitutive
Block: invariants
Block: mumubar
Block: integrals
Block: polynomials
Block: arth
Block: arth_sp
Block: arth_dp
Block: locate
Block: optics_mod
In: :test:optics_mod.f90:optics_mod
get_parameters: got "invalid syntax (<string>, line 1)" on '(0.wp,1.'
,然后对于许多额外的行,我得到相同的“无效语法”,但它仍保存到签名文件中。我想知道造成这个问题的原因是什么?
我想计算的内容并不简单,因此代码重用对于我的研究生项目而言非常有利。任何帮助是极大的赞赏!