31 use,
intrinsic :: iso_fortran_env
59 class(*),
intent(inout) :: system
65 message(1) =
"CalculationMode = vib_modes not implemented for multi-system calculations"
76 type(electrons_t),
intent(inout) :: sys
78 type(vibrations_t) :: vib
80 type(restart_t) :: gs_restart
84 if (sys%hm%pcm%run_pcm)
then
91 if (sys%st%symmetrize_density .or. sys%kpoints%use_symmetries)
then
92 message(1) =
"Cannot compute vibrational modes by finite differences when symmetry is being used."
93 message(2) =
"Set KPointsUseSymmetries = no and SymmetrizeDensity = no, for gs run and this run."
102 call states_elec_load(gs_restart, sys%namespace, sys%space, sys%st, sys%gr, sys%kpoints, &
103 fixed_occ=.false., ierr=ierr)
106 message(1) =
"Unable to read wavefunctions."
109 call gs_restart%end()
112 message(1) =
'Info: Setting up Hamiltonian.'
114 call v_ks_h_setup(sys%namespace, sys%space, sys%gr, sys%ions, sys%ext_partners, sys%st, sys%ks, sys%hm)
116 call vibrations_init(vib, sys%ions%space, sys%ions%natoms, sys%ions%mass,
"fd", sys%namespace)
131 call get_dyn_matrix(sys%gr, sys%namespace, sys%mc, sys%ions, sys%ext_partners, sys%st, sys%ks, &
132 sys%hm, vib, sys%space)
145 subroutine get_dyn_matrix(gr, namespace, mc, ions, ext_partners, st, ks, hm, vib, space)
146 type(grid_t),
target,
intent(inout) :: gr
147 type(namespace_t),
intent(in) :: namespace
148 type(multicomm_t),
intent(in) :: mc
149 type(ions_t),
intent(inout) :: ions
150 type(partner_list_t),
intent(in) :: ext_partners
151 type(states_elec_t),
intent(inout) :: st
152 type(v_ks_t),
intent(inout) :: ks
158 integer :: iatom, jatom, alpha, beta, imat, jmat
159 real(real64),
allocatable :: forces(:, :), forces0(:, :)
164 call scf_init(scf, namespace, gr, ions, st, mc, hm, space)
165 safe_allocate(forces0(1:space%dim, 1:ions%natoms))
166 safe_allocate(forces(1:space%dim, 1:ions%natoms))
170 do iatom = 1, ions%natoms
171 do alpha = 1, space%dim
176 write(
message(1),
'(a,i5,3a)')
'Info: Moving atom ', iatom,
' in the +',
index2axis(alpha),
'-direction.'
181 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) + vib%disp
185 forces0(:, :) = ions%tot_force(:, :)
189 write(
message(1),
'(a,i5,3a)')
'Info: Moving atom ', iatom,
' in the -',
index2axis(alpha),
'-direction.'
193 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) -
m_two*vib%disp
197 forces(:, :) = ions%tot_force(:, :)
199 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) + vib%disp
201 do jatom = 1, ions%natoms
202 do beta = 1, space%dim
204 vib%dyn_matrix(jmat, imat) = (forces0(beta, jatom) - forces(beta, jatom)) / (
m_two*vib%disp) &
212 safe_deallocate_a(forces0)
213 safe_deallocate_a(forces)
229 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.
true.)
232 call scf_run(scf, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, verbosity =
verb_compact)
This module implements a calculator for the density and defines related functions.
subroutine, public density_calc(st, gr, density, istin)
Computes the density from the orbitals in st.
subroutine, public energy_calc_total(namespace, space, hm, gr, st, ext_partners, iunit, full)
This subroutine calculates the total energy of the system. Basically, it adds up the KS eigenvalues,...
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
This module implements the underlying real-space grid.
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
This module defines classes and functions for interaction partners.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_new_line()
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)
This module handles the communicators for the various parallelization strategies.
This module implements the basic mulsisystem class, a container system for other systems.
subroutine get_dyn_matrix(gr, namespace, mc, ions, ext_partners, st, ks, hm, vib, space)
Computes the second-order force constant from finite differences.
subroutine phonons_run_legacy(sys)
subroutine, public phonons_run(system)
integer, parameter, public restart_gs
integer, parameter, public restart_type_load
subroutine, public scf_mix_clear(scf)
integer, parameter, public verb_compact
subroutine, public scf_init(scf, namespace, gr, ions, st, mc, hm, space)
subroutine, public scf_end(scf)
subroutine, public scf_run(scf, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, verbosity, iters_done, restart_dump)
Legacy version of the SCF code.
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
This module handles reading and writing restart information for the states_elec_t.
subroutine, public states_elec_load(restart, namespace, space, st, mesh, kpoints, fixed_occ, ierr, iter, lr, lowest_missing, label, verbose, skip)
returns in ierr: <0 => Fatal error, or nothing read =0 => read all wavefunctions >0 => could only rea...
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
This module is intended to contain simple general-purpose utility functions and procedures.
character pure function, public index2axis(idir)
subroutine, public v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval, time, calc_energy, calc_current, force_semilocal)
subroutine, public v_ks_h_setup(namespace, space, gr, ions, ext_partners, st, ks, hm, calc_eigenval, calc_current)
real(real64) pure function, public vibrations_norm_factor(this, iatom, jatom)
subroutine, public vibrations_diag_dyn_matrix(this)
Diagonalize the dynamical matrix.
subroutine, public vibrations_out_dyn_matrix_row(this, imat)
Outputs one row of the dynamical matrix.
subroutine, public vibrations_init(this, space, natoms, mass, suffix, namespace)
subroutine, public vibrations_symmetrize_dyn_matrix(this)
Symmetrize the dynamical matric, which is real symmetric matrix.
integer pure function, public vibrations_get_index(this, iatom, idim)
subroutine, public vibrations_output(this)
Outputs the eigenvectors and eigenenergies of the dynamical matrix.
subroutine, public vibrations_end(this)
subroutine run_displacement()
Runs GS for a given displaced atomic position.
Extension of space that contains the knowledge of the spin dimension.
Class describing the electron system.
Container class for lists of system_oct_m::system_t.
some variables used for the SCF cycle