46 integer :: in_file, out_file, ref_file, ii, jj, kk, ierr, ib, num_col, num_col_cart
47 integer :: time_steps, time_steps_ref, energy_steps, istart, iend, ntiter, iq
48 real(real64) :: dt, tt, ww, dt_ref
49 real(real64),
allocatable :: ftreal(:,:), ftimag(:,:)
50 real(real64),
allocatable :: m_cart(:,:), m_cart_ref(:,:), magnetization(:,:,:)
51 type(spectrum_t) :: spectrum
52 type(batch_t) :: vecpotb, ftrealb, ftimagb
54 character(len=256) :: header
55 character(len=MAX_PATH_LEN) :: fname, ref_filename
56 complex(real64),
allocatable :: chi(:,:)
84 time_steps = time_steps + 1
86 num_col_cart = 12*kick%nqvec
87 safe_allocate(m_cart(1:time_steps, 1:num_col_cart))
92 read(in_file, *) jj, tt, (m_cart(ii,ib),ib = 1, num_col_cart)
115 time_steps_ref = time_steps_ref + 1
117 if (time_steps_ref < time_steps)
then
118 message(1) =
"The reference calculation does not contain enought time steps"
122 if (.not.
is_close(dt_ref, dt))
then
123 message(1) =
"The time step of the reference calculation is different from the current calculation"
128 safe_allocate(m_cart_ref(1:time_steps_ref, 1:num_col_cart))
130 do ii = 1, time_steps_ref
131 read(ref_file, *) jj, tt, (m_cart_ref(ii, kk), kk = 1, num_col_cart)
134 do ii = 1, time_steps
135 do kk = 1, num_col_cart
136 m_cart(ii, kk) = m_cart(ii, kk) - m_cart_ref(ii, kk)
139 safe_deallocate_a(m_cart_ref)
146 safe_allocate(magnetization(1:time_steps, 1:num_col, 1:kick%nqvec))
148 do iq = 1, kick%nqvec
150 magnetization(:,1,iq) = m_cart(:,(iq-1)*12+1)*kick%trans_vec(1,1) &
151 + m_cart(:,(iq-1)*12+3)*kick%trans_vec(2,1) &
152 + m_cart(:,(iq-1)*12+5)*kick%trans_vec(3,1)
154 magnetization(:,1,iq) = magnetization(:,1,iq) -(m_cart(:,(iq-1)*12+2)*kick%trans_vec(1,2) &
155 + m_cart(:,(iq-1)*12+4)*kick%trans_vec(2,2) &
156 + m_cart(:,(iq-1)*12+6)*kick%trans_vec(3,2))
159 magnetization(:,2,iq) = m_cart(:,(iq-1)*12+2)*kick%trans_vec(1,1) &
160 + m_cart(:,(iq-1)*12+4)*kick%trans_vec(2,1) &
161 + m_cart(:,(iq-1)*12+6)*kick%trans_vec(3,1)
163 magnetization(:,2,iq) = magnetization(:,2,iq) +(m_cart(:,(iq-1)*12+1)*kick%trans_vec(1,2) &
164 + m_cart(:,(iq-1)*12+3)*kick%trans_vec(2,2) &
165 + m_cart(:,(iq-1)*12+5)*kick%trans_vec(3,2))
168 magnetization(:,3,iq) = m_cart(:,(iq-1)*12+7)*kick%trans_vec(1,1) &
169 + m_cart(:,(iq-1)*12+9)*kick%trans_vec(2,1) &
170 + m_cart(:,(iq-1)*12+11)*kick%trans_vec(3,1)
172 magnetization(:,3,iq) = magnetization(:,3,iq) +(m_cart(:,(iq-1)*12+8)*kick%trans_vec(1,2) &
173 + m_cart(:,(iq-1)*12+10)*kick%trans_vec(2,2) &
174 + m_cart(:,(iq-1)*12+12)*kick%trans_vec(3,2))
177 magnetization(:,4,iq) = m_cart(:,(iq-1)*12+8)*kick%trans_vec(1,1) &
178 + m_cart(:,(iq-1)*12+10)*kick%trans_vec(2,1) &
179 + m_cart(:,(iq-1)*12+12)*kick%trans_vec(3,1)
181 magnetization(:,4,iq) = magnetization(:,4,iq) -(m_cart(:,(iq-1)*12+7)*kick%trans_vec(1,2) &
182 + m_cart(:,(iq-1)*12+9)*kick%trans_vec(2,2) &
183 + m_cart(:,(iq-1)*12+11)*kick%trans_vec(3,2))
186 magnetization(:,5,iq) = m_cart(:,(iq-1)*12+1)*kick%easy_axis(1) &
187 + m_cart(:,(iq-1)*12+3)*kick%easy_axis(2) &
188 + m_cart(:,(iq-1)*12+5)*kick%easy_axis(3)
189 magnetization(:,6,iq) = m_cart(:,(iq-1)*12+2)*kick%easy_axis(1) &
190 + m_cart(:,(iq-1)*12+4)*kick%easy_axis(2) &
191 + m_cart(:,(iq-1)*12+6)*kick%easy_axis(3)
192 magnetization(:,7,iq) = m_cart(:,(iq-1)*12+7)*kick%easy_axis(1) &
193 + m_cart(:,(iq-1)*12+9)*kick%easy_axis(2) &
194 + m_cart(:,(iq-1)*12+11)*kick%easy_axis(3)
195 magnetization(:,8,iq) = m_cart(:,(iq-1)*12+8)*kick%easy_axis(1) &
196 + m_cart(:,(iq-1)*12+10)*kick%easy_axis(2) &
197 + m_cart(:,(iq-1)*12+12)*kick%easy_axis(3)
200 safe_deallocate_a(m_cart)
202 write(
message(1),
'(a, i7, a)')
"Info: Read ", time_steps,
" steps from file '"// &
206 write(header,
'(9a15)')
'# time',
'Re[m_+(q,t)]',
'Im[m_+(q,t)]', &
207 'Re[m_-(-q, t)]',
'Im[m_-(-q,t)]', &
208 'Re[m_z(q,t)]',
'Im[m_z(q,t)]',
'Re[m_z(-q,t)]',
'Im[m_z(-q,t)]'
210 do iq = 1, kick%nqvec
212 write(fname,
'(a,i3.3)')
'td.general/transverse_magnetization_q', iq
214 write(out_file,
'(a)') trim(header)
215 do kk = 1, time_steps
216 write(out_file,
'(9e15.6)') (kk - 1)*dt, (magnetization(kk,ii,iq), ii = 1,8)
224 istart = max(1, istart)
228 safe_allocate(ftreal(1:energy_steps, 1:num_col))
229 safe_allocate(ftimag(1:energy_steps, 1:num_col))
231 call batch_init(vecpotb, 1, 1, num_col, magnetization(:, :, iq))
232 call batch_init(ftrealb, 1, 1, num_col, ftreal)
233 call batch_init(ftimagb, 1, 1, num_col, ftimag)
236 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart, iend, spectrum%start_time, dt, vecpotb)
239 istart, iend, spectrum%start_time, dt, vecpotb, spectrum%min_energy, &
240 spectrum%max_energy, spectrum%energy_step, ftrealb)
243 istart, iend, spectrum%start_time, dt, vecpotb, spectrum%min_energy, &
244 spectrum%max_energy, spectrum%energy_step, ftimagb)
252 safe_allocate(chi(1:energy_steps, 1:num_col/2))
254 do kk = 1, energy_steps
255 chi(kk,ii) = (ftreal(kk,(ii-1)*2+1) +
m_zi*ftimag(kk, (ii-1)*2+1)&
256 -ftimag(kk, (ii-1)*2+2) +
m_zi*ftreal(kk, (ii-1)*2+2))/kick%delta_strength
260 safe_deallocate_a(ftreal)
261 safe_deallocate_a(ftimag)
264 write(header,
'(9a18)')
'# energy',
'Re[\chi_{+-}(q)]',
'Im[\chi_{+-}(q)]', &
265 'Re[\chi_{-+}(-q)]',
'Im[\chi_{-+}(-q)]', &
266 'Re[\chi_{zz}(q)]',
'Im[\chi_{zz}(q)]',
'Re[\chi_{zz}(-q)]',
'Im[\chi_{zz}(-q)]'
268 write(fname,
'(a,i3.3)')
'td.general/spin_susceptibility_q', iq
270 write(out_file,
'(a)') trim(header)
271 do kk = 1, energy_steps
272 ww = (kk-1)*spectrum%energy_step + spectrum%min_energy
273 write(out_file,
'(13e15.6)') ww, &
274 (real(chi(kk,ii), real64), aimag(chi(kk,ii)), ii = 1, num_col/2)
278 safe_deallocate_a(chi)
281 safe_deallocate_a(magnetization)
initialize a batch with existing memory
This module implements batches of mesh functions.
This module provides an interface to the getopt C library, so that the command line arguments can be ...
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
type(mpi_comm), parameter, public serial_dummy_comm
Alias MPI_COMM_UNDEFINED for the specific use case of initialising Octopus utilities with no MPI supp...
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
complex(real64), parameter, public m_zi
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_half
subroutine, public io_init(defaults)
If the argument defaults is present and set to true, then the routine will not try to read anything f...
subroutine, public io_close(iunit, grp)
subroutine, public io_skip_header(iunit)
subroutine, public io_end()
character(len=max_path_len) function, public io_workpath(path, namespace)
construct path name from given name and namespace
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public kick_read(kick, iunit, namespace)
subroutine, public kick_end(kick)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public messages_end()
subroutine, public messages_init(output_dir)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
type(namespace_t), public global_namespace
logical function, public parse_is_defined(namespace, name)
subroutine, public parser_init()
Initialise the Octopus parser.
subroutine, public parser_end()
End the Octopus parser.
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public profiling_end(namespace)
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
subroutine, public spectrum_fix_time_limits(spectrum, time_steps, dt, istart, iend, ntiter)
subroutine, public spectrum_fourier_transform(method, transform, noise, time_start, time_end, t0, time_step, time_function, energy_start, energy_end, energy_step, energy_function)
Computes the sine, cosine, (or "exponential") Fourier transform of the real function given in the tim...
subroutine, public spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
subroutine, public spectrum_signal_damp(damp_type, damp_factor, time_start, time_end, t0, time_step, time_function)
integer, parameter, public spectrum_transform_cos
integer, parameter, public spectrum_transform_sin
subroutine, public spectrum_count_time_steps(namespace, iunit, time_steps, dt)
pure integer function, public spectrum_nenergy_steps(spectrum)
subroutine, public spin_susceptibility_main()
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
subroutine, public unit_system_init(namespace)