yambo-code / yambo

This is the official GPL repository of the yambo code
http://www.yambo-code.eu/
GNU General Public License v2.0
91 stars 35 forks source link

explicit interface needed for X_irredux_residuals #72

Open sangallidavide opened 4 months ago

sangallidavide commented 4 months ago

In fortran, if I'm not wrong, an "explicit interface" is needed every time a dummy argument that has one of these attributes ALLOCATABLE, ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE http://ahamodel.uib.no/intel/GUID-79A3D50D-99F2-409F-AE8A-6A84FD1E47FA.html

The arguments of X_irredux residuals are

 type(elemental_collision), target :: Xo_scatt                          
 type(levels), intent(in) :: Xen                                        
 type(bz_samp),intent(in) :: Xk                                         
 type(X_t),    intent(in) :: X                                          
 type(DIPOLE_t),intent(in):: Dip                                        
 integer,      intent(in) :: i_cg,iq,i_comp                             
 character(*), intent(in) :: what                                       
 complex(SP),  intent(out) DEV_ATTR :: Xo_res(X_rows(1):X_rows(2),X_cols(1):X_cols(2))

which means an explicit interface should be declared

andrea-ferretti commented 2 months ago

Thanks Davide for pointing this out... Thinking a bit about, it makes sense the explicit interface is required, though I don't know about how critical the risks of doing otherwise are (probably little, since everything seems to work now)...

Nevertheless, the earlier we sort this out, the better. Coming to the technical details: X_irredux_residuals is only called by X_irredux.F, so probably not a big deal to add an explicit interface. The same problem is surely present also in other calls (scatter_Bamp, for instance, where the target attributes is used, if I am not mistaken)... Even in this case adding an explicit interface should not hurt too much