From 32e6a23e65b0f46e8969d9f1a8213ce3f91a72e0 Mon Sep 17 00:00:00 2001 From: Gaspard Jankowiak Date: Wed, 15 May 2024 15:27:01 +0200 Subject: [PATCH] add negative water check --- PLUV.jl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/PLUV.jl b/PLUV.jl index f979c64..2c49bb0 100644 --- a/PLUV.jl +++ b/PLUV.jl @@ -285,7 +285,10 @@ function intensity(P::AbstractArray{Float64}, q) I = vec(sum(Am .^ 2 .* Normal'; dims=2)) * integration_step alp = Rm / (Z + 1) - return @. (Norm * nv * 1e-6) * I * (16 * pi^2 * mu4(q, Z, alp)) + Con * (0.99 * (1.0 / (1 + exp(-8 * (q - 1.0)))) + 0.01) + + neg_H20 = negative_water(P) + + return @. ((Norm * nv * 1e-6) * I * (16 * pi^2 * mu4(q, Z, alp)) + Con * (0.99 * (1.0 / (1 + exp(-8 * (q - 1.0)))) + 0.01), neg_H20) end ################## @@ -310,7 +313,6 @@ function negative_water(P::AbstractArray{Float64}) V_PCN = CONST_V_HL_PC * r_PCN # Volume of PCN group V_Chol = CONST_V_HL_PC * (1 - r_PCN - r_CG) # Volume of CholCH3 group - check = 0 z_array = range(0.0, 4.0, length=81) CG = Gauss.(z_array, V_CG, D_C + d_CG / 2.0, s_CG, A_L) @@ -319,13 +321,8 @@ function negative_water(P::AbstractArray{Float64}) TRIS = Gauss.(z_array, n_TR * CONST_V_tris, D_C + d_TR / 2.0, s_TR, A_L) BW = Slab.(z_array, D_C + (d_CG + d_PCN + d_Chol + CONST_d_shl) / 2.0, d_CG + d_PCN + d_Chol + CONST_d_shl, s_CH2) - CG - PCN - Chol - TRIS - for i in (BW) - if i < -1e-3 - check += 1 - end - end - - return check + # return the number of points where BW < -1e-3 + return count(<(-1e-3), BW) end function get_free_parameters_idx(metadata::Dict)