Skip to content

Commit

Permalink
Fix autocorrelation_fit
Browse files Browse the repository at this point in the history
  • Loading branch information
lmantill committed Mar 21, 2024
1 parent 91b7927 commit e4cbafd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions examples/semiclassical_micelles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from radicalpy.data import Molecule
from radicalpy.estimations import (
autocorrelation,
autocorrelation_fit,
exchange_interaction_in_solution_MC,
k_STD,
Expand All @@ -20,7 +19,7 @@
)
from radicalpy.relaxation import SingletTripletDephasing
from radicalpy.simulation import Basis, SemiclassicalSimulation, State
from radicalpy.utils import Bhalf_fit, is_fast_run, read_trajectory_files
from radicalpy.utils import autocorrelation, Bhalf_fit, is_fast_run, read_trajectory_files


def main(
Expand All @@ -32,24 +31,24 @@ def main(
trp = Molecule.all_nuclei("tryptophan_cation")
sim = SemiclassicalSimulation([flavin, trp], basis=Basis.ZEEMAN)

# trajectory_data = read_trajectory_files("./examples/data/md_fad_trp_aot")
# trajectory_data = read_trajectory_files("./examples/data/md_fad_trp_aot", scale=1e-10)
# trajectory_ts = (
# np.linspace(0, len(trajectory_data), len(trajectory_data)) * 5e-12 * 1e9
# )
# j = exchange_interaction_in_solution_MC(trajectory_data[:, 1], J0=5)

#
# plot_exchange_interaction_in_solution(trajectory_ts, trajectory_data, j)

#
# acf_j = autocorrelation(j, factor=1)
# zero_point_crossing_j = np.where(np.diff(np.sign(acf_j)))[0][0]
# t_j_max = max(trajectory_ts[:zero_point_crossing_j]) * 1e-9
# t_j = np.linspace(5e-12, t_j_max, zero_point_crossing_j)

#
# acf_j_fit = autocorrelation_fit(t_j, j, 5e-12, t_j_max)
# plot_autocorrelation_fit(t_j, acf_j, acf_j_fit, zero_point_crossing_j)

# kstd = k_STD(j, acf_j_fit["tau_c"])
kstd = 462.10479319787896
#
# kstd = k_STD(-j, acf_j_fit["tau_c"])
kstd = 11681368.059456564
triplet_excited_state_quenching_rate = 5e6
recombination_rate = 8e6
free_radical_escape_rate = 5e5
Expand Down
2 changes: 1 addition & 1 deletion radicalpy/estimations.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def multiexponential(x, *params):
p0=np.zeros(num_exp),
)
fit = multiexponential(ts, *acf_popt)
tau_c = sum(acf_popt * taus) * np.var(mT_to_MHz(trajectory)) / 1e6
tau_c = sum(acf_popt * taus) # * np.var(mT_to_MHz(trajectory)) / 1e6
return {"fit": fit, "tau_c": tau_c}


Expand Down

0 comments on commit e4cbafd

Please sign in to comment.