32 use,
intrinsic :: iso_fortran_env
61 class(*),
intent(inout) :: system
67 message(1) =
"CalculationMode = vib_modes not implemented for multi-system calculations"
78 type(electrons_t),
intent(inout) :: sys
80 type(vibrations_t) :: vib
82 type(restart_t) :: gs_restart
86 if (sys%hm%pcm%run_pcm)
then
93 if (sys%st%symmetrize_density .or. sys%kpoints%use_symmetries)
then
94 message(1) =
"Cannot compute vibrational modes by finite differences when symmetry is being used."
95 message(2) =
"Set KPointsUseSymmetries = no and SymmetrizeDensity = no, for gs run and this run."
104 call states_elec_load(gs_restart, sys%namespace, sys%space, sys%st, sys%gr, sys%kpoints, ierr)
107 message(1) =
"Unable to read wavefunctions."
113 message(1) =
'Info: Setting up Hamiltonian.'
115 call v_ks_h_setup(sys%namespace, sys%space, sys%gr, sys%ions, sys%ext_partners, sys%st, sys%ks, sys%hm)
117 call vibrations_init(vib, sys%ions%space, sys%ions%natoms, sys%ions%mass,
"fd", sys%namespace)
132 call get_dyn_matrix(sys%gr, sys%namespace, sys%mc, sys%ions, sys%ext_partners, sys%st, sys%ks, &
133 sys%hm, sys%outp, vib, sys%space)
146 subroutine get_dyn_matrix(gr, namespace, mc, ions, ext_partners, st, ks, hm, outp, vib, space)
147 type(grid_t),
target,
intent(inout) :: gr
148 type(namespace_t),
intent(in) :: namespace
149 type(multicomm_t),
intent(in) :: mc
150 type(ions_t),
intent(inout) :: ions
151 type(partner_list_t),
intent(in) :: ext_partners
152 type(states_elec_t),
intent(inout) :: st
160 integer :: iatom, jatom, alpha, beta, imat, jmat
161 real(real64),
allocatable :: forces(:,:), forces0(:,:)
166 call scf_init(scf, namespace, gr, ions, st, mc, hm, space)
167 safe_allocate(forces0(1:space%dim, 1:ions%natoms))
168 safe_allocate(forces(1:space%dim, 1:ions%natoms))
172 do iatom = 1, ions%natoms
173 do alpha = 1, space%dim
178 write(
message(1),
'(a,i3,3a)')
'Info: Moving atom ', iatom,
' in the +',
index2axis(alpha),
'-direction.'
183 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) + vib%disp
187 forces0 = ions%tot_force
191 write(
message(1),
'(a,i3,3a)')
'Info: Moving atom ', iatom,
' in the -',
index2axis(alpha),
'-direction.'
195 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) -
m_two*vib%disp
199 forces = ions%tot_force
201 ions%pos(alpha, iatom) = ions%pos(alpha, iatom) + vib%disp
203 do jatom = 1, ions%natoms
204 do beta = 1, space%dim
206 vib%dyn_matrix(jmat, imat) = (forces0(beta, jatom) - forces(beta, jatom)) / (
m_two*vib%disp) &
214 safe_deallocate_a(forces0)
215 safe_deallocate_a(forces)
231 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.
true.)
234 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_info(no_lines, iunit, verbose_limit, stress, all_nodes, 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)
This module handles the communicators for the various parallelization strategies.
This module implements the basic mulsisystem class, a container system for other systems.
this module contains the output system
subroutine get_dyn_matrix(gr, namespace, mc, ions, ext_partners, st, ks, hm, outp, 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
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
integer, parameter, public restart_type_load
subroutine, public restart_end(restart)
subroutine, public scf_mix_clear(scf)
subroutine, public scf_run(scf, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, verbosity, iters_done, restart_load, restart_dump)
integer, parameter, public verb_compact
subroutine, public scf_init(scf, namespace, gr, ions, st, mc, hm, space)
subroutine, public scf_end(scf)
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, 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