@@ -148,7 +148,7 @@ subroutine model_berkeley_crust(x,theta,phi,vp,vs,rho,moho,found_crust,elem_in_c
148148
149149 depth = (1.d0 - x) * EARTH_R_KM
150150
151- call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth)
151+ call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth,moho_only )
152152
153153 ! using crustal values
154154 if (USE_OLD_VERSION_FORMAT) then
@@ -226,7 +226,7 @@ subroutine model_berkeley_crust_aniso(x,theta,phi,vpv,vph,vsv,vsh,eta_aniso,rho,
226226
227227 depth = (1.d0 - x) * EARTH_R_KM
228228
229- call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth)
229+ call get_crust_val_csem(theta,phi,depth,rho,vp,vsv,vsh,moho_depth,moho_only )
230230
231231 ! using crustal values
232232 if (USE_OLD_VERSION_FORMAT) then
@@ -266,14 +266,15 @@ end subroutine model_berkeley_crust_aniso
266266!- -------------------------------------------------------------------------------------------------
267267!
268268
269- subroutine get_crust_val_csem (theta ,phi ,z ,rho ,vp ,vsv ,vsh ,moho_depth )
269+ subroutine get_crust_val_csem (theta ,phi ,z ,rho ,vp ,vsv ,vsh ,moho_depth , moho_only )
270270
271271 use model_crust_berkeley_par
272272
273273 implicit none
274274
275275 double precision ,intent (in ) :: theta,phi,z
276276 double precision ,intent (out ) :: rho,vp,vsv,vsh,moho_depth
277+ logical ,intent (in ) :: moho_only
277278
278279 ! local parameters
279280 ! 4-th order GLL positions
@@ -290,13 +291,22 @@ subroutine get_crust_val_csem(theta,phi,z,rho,vp,vsv,vsh,moho_depth)
290291 double precision ,external :: moho_filtre
291292 double precision ,external :: lagrange
292293
294+ ! initialize
295+ rho = 0.d0
296+ vp = 0.d0
297+ vsv = 0.d0
298+ vsh = 0.d0
299+
293300 ! get moho depth
294301 moho_depth = moho1D_depth - moho_filtre(theta,phi)
295302
296303 ! debug
297304 ! print *,"debug: [get_crust_val_csem] Moho depth:",moho_depth, &
298305 ! "moho1D_depth:",moho1D_depth,"moho_filtre:",moho_filtre(theta,phi)
299306
307+ ! check if anything further to do or return only moho
308+ if (moho_only) return
309+
300310 !
301311 ! horizontal interpolation for all registered depths
302312 !
0 commit comments