jameskermode / f90wrap

F90 to Python interface generator with derived type support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In python, what is the equivalent of the cell type data used in Fortran?

ashleyzcy opened this issue · comments

I have created a python wrapper for a LARGE fortran library of code using f2py. One of the problem I have is to call one of the subroutines function(cell) which takes in a cell as input and then update the input cell at the end of the subroutine [intent(inout)]. what is correct way of calling this kind of subroutine? Is the equivalent of the cell in python a dictionary? its a unitcell that contains many attributes (properties) of an object. this unitcell is later exported as an hdf5 data set

Fortran source code:

subroutine function_name(cell)
use ...
IMPLICIT NONE
type(unitcell),intent(inout) :: cell
cell%name1=a
cell%name2=b
...
end subroutine function_name

Python help(function_name)
function_name(self)
function_name(self)
Defined at function_name.f90 lines ...
Parameters

cell : Unitcell