Skip to content

Draft: fix: td_write_vel

Cristian Le requested to merge LecrisUT/octopus:fix/td_write_vel into main

td_write_vel was not properly parallelized (see td_write_accel) and would hang indefinitely. But after fixing this, other segmentation fault issues have popped up, and it seems to depend on the number of mpi processes. That part needs further investigation.

Example input file
## Calculation parameters
CalculationMode = td
FromScratch = True
ExperimentalFeatures = yes
Debug = info + trace
DebugTrapSignals = True
MPIDebugHook = False

## Physical parameters
Dimensions = 1
PeriodicDimensions = 1

# theory level parameters:
TheoryLevel = independent_particles

# grid parameters:
BoxShape = parallelepiped # sphere, cylinder (around x-axis), minimum, user_defined, parallelepiped (Lsize or lattice vectors, parameters, etc.)
a0 = 8  # the periodic spacing
Spacing = 0.25

%Lsize
  a0/2
%

%LatticeParameters
  a0
%

nk = 101
%KPointsGrid
 nk
%
KPointsUseSymmetries = no
KPointsUseTimeReversal = no
SymmetrizeDensity = no

# species related inputs

# parameters for Matheiu potential:
V0 = 0.37

%Species
 "matheiu_1d" | species_user_defined | valence | 4 | potential_formula | "-V0*(1 + cos(2*pi*x/a0))*step(x+a0/2)*(1-step(x-a0/2))"
# "matheiu_1d" | species_user_defined | valence | 4 | potential_formula | "-V0*(1 + cos(2*pi*x/a0))"
%

% ReducedCoordinates
 "matheiu_1d" | 0 | no # no means no beyond BO approx. motion of atoms.
%

## CalcMode parameters

# Parallelization setup
ParDomains = no
ParOther = no
ParStates = no
ParKPoints = auto

TDPropagator = etrs
# Dummy value because we are using the legacy code
TDSystemPropagator = prop_aetrs
TDEXPOrder = 16
TDExponentialMethod = lanczos
MoveIons = no
TDFreezeHXC = no

# laser details:
I0 = 600000000000.0 # maximal laser intensity in W/cm^2
lam = 3000 # in nm.
light_speed = 137.03640 # in a.u. - 1 over the f.s.c.

# resulting qunatities in a.u.:
amp = (5.33685*1e-9)*sqrt(I0) # derived in a.u from I0.
om = 2*pi*(1/7.2973525664e-3)/(10*lam/0.52917725) # the resulting frequency in atomic units.
t_cyc = 2*pi/om
n_cyc = 8
T_pulse = n_cyc*t_cyc

TDPropagationTime = T_pulse
TDTimeStep = 0.15

%TDExternalFields
#  vector_potential | 1 | 0 | 0 | om | "envelope_super_sin"
  vector_potential | 1 | 0 | 0 | om | "envelope_super_sin" | "phi"
%

sigma = 0.75; # sigma parameter for super-sin.

%TDFunctions
  "envelope_super_sin" | tdf_from_expr | "-(amp/om)*light_speed*(sin(pi*t/T_pulse)^(abs(pi*t/T_pulse-pi/2)/sigma))*(1-step(t-T_pulse))*(step(t))"
  "envelope_sine_square" | tdf_from_expr | "-(amp/om)*light_speed*sin(pi*t/T_pulse)^2"
  "phi" | tdf_from_expr | "pi/2" # phase must be defined by a string as a td_func, even if this is a constant. phase is wrt a cosine field- phi=pi/2 gives a sin(wt) field.
%


## Extension parameters

## Output parameters
OutputInterval = 20
OutputFormat = netcdf

%TDOutput
  laser
  total_current
  dipole_acceleration
  dipole_velocity
%
Edited by Cristian Le

Merge request reports