add 4 pulse ste

This commit is contained in:
Dominik Demuth
2024-11-30 16:15:38 +01:00
parent d844aac0e8
commit 60ef1b0bcf
5 changed files with 36 additions and 22 deletions

View File

@ -87,9 +87,10 @@ void run_ste(
) {
const int num_walker = static_cast<int>(parameter[std::string("num_walker")]);
const int num_mix_times = static_cast<int>(parameter[std::string("tmix_steps")]);
const int num_mix_times = static_cast<int>(parameter["tmix_steps"]);
const std::vector<double> evolution_times = linspace(parameter["tevo_start"], parameter["tevo_stop"], static_cast<int>(parameter["tevo_steps"]));
const std::vector<double> mixing_times = logspace(parameter["tmix_start"], parameter["tmix_stop"], num_mix_times);
const double tpulse4= parameter["tpulse4"];
// make ste decay vectors and set them to zero
std::map<double, std::vector<double>> cc_dict;
@ -103,7 +104,7 @@ void run_ste(
std::vector<double> f2(num_mix_times);
// each trajectory must have a duration of at least tmax
const double tmax = *std::max_element(evolution_times.begin(), evolution_times.end()) * 2 + *std::max_element(mixing_times.begin(), mixing_times.end());
const double tmax = *std::max_element(evolution_times.begin(), evolution_times.end()) * 2 + *std::max_element(mixing_times.begin(), mixing_times.end()) + 2*tpulse4;
// set parameter in distribution and motion model
dist.setParameters(parameter);
@ -127,6 +128,7 @@ void run_ste(
f2[f2_idx] += traj_omega[f2_pos] * motion.getInitOmega() / num_walker;
}
for (auto& [t_evo_j, _] : cc_dict) {
auto& cc_j = cc_dict[t_evo_j];
auto& ss_j = ss_dict[t_evo_j];
@ -138,16 +140,20 @@ void run_ste(
const double ss_tevo = std::sin(dephased);
for (int mix_idx = 0; mix_idx < num_mix_times; mix_idx++) {
// get phase at end of mixing time
const double time_end_mix = mixing_times[mix_idx] + t_evo_j;
current_pos = nearest_index(traj_time, time_end_mix, current_pos);
const double phase_mix_end = lerp(traj_time, traj_phase, time_end_mix, current_pos);
// get phase at position of 4th pulse
const double time_pulse4 = time_end_mix + tpulse4;
current_pos = nearest_index(traj_time, time_pulse4, current_pos);
const double phase_4pulse = lerp(traj_time, traj_phase, time_pulse4, current_pos);
// get phase at echo position
const double time_echo = mixing_times[mix_idx] + 2 * t_evo_j;
const double time_echo = time_pulse4 + tpulse4 + t_evo_j;
current_pos = nearest_index(traj_time, time_echo, current_pos);
const double rephased = lerp(traj_time, traj_phase, time_echo, current_pos) - phase_mix_end;
double rephased = lerp(traj_time, traj_phase, time_echo, current_pos) + phase_mix_end - 2*phase_4pulse;
cc_j[mix_idx] += cc_tevo * std::cos(rephased) / num_walker;
ss_j[mix_idx] += ss_tevo * std::sin(rephased) / num_walker;