48 #include "./base/base_uses.f90"
54 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'tip_scan_methods'
71 TYPE(qs_environment_type),
POINTER :: qs_env
72 TYPE(section_vals_type),
POINTER :: input_section
74 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tip_scanning'
76 CHARACTER(LEN=default_string_length) :: cname
77 INTEGER :: handle, iounit, iscan, iset, nscan, &
79 LOGICAL :: do_tip_scan, expot, scf_converged
80 REAL(kind=
dp),
DIMENSION(3) :: rpos
81 TYPE(cp_logger_type),
POINTER :: logger
82 TYPE(dft_control_type),
POINTER :: dft_control
83 TYPE(mo_set_type),
ALLOCATABLE,
DIMENSION(:) :: mos_ref
84 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mos
85 TYPE(pw_c1d_gs_type) :: sf, vref
86 TYPE(pw_env_type),
POINTER :: pw_env
87 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
88 TYPE(pw_r3d_rs_type),
POINTER :: vee, vtip
89 TYPE(qs_ks_env_type),
POINTER :: ks_env
90 TYPE(scanning_type) :: scan_env
92 CALL timeset(routinen, handle)
100 cname = logger%iter_info%project_name
101 logger%iter_info%project_name = logger%iter_info%project_name//
"+TIP_SCAN"
102 plevel = logger%iter_info%print_level
106 WRITE (iounit,
"(T2,A)")
"TIP SCAN| Perform a Tip Scanning Calculation"
112 CALL read_tip_file(qs_env, scan_env)
114 CALL get_qs_env(qs_env, ks_env=ks_env, pw_env=pw_env, &
115 dft_control=dft_control)
116 expot = dft_control%apply_external_potential
117 dft_control%apply_external_potential = .true.
124 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
127 CALL auxbas_pw_pool%create_pw(vtip)
129 CALL auxbas_pw_pool%create_pw(vref)
131 CALL auxbas_pw_pool%create_pw(sf)
134 CALL pw_transfer(scan_env%tip_pw_g, vref)
139 ALLOCATE (mos_ref(nset))
144 nscan = scan_env%num_scan_points
146 WRITE (iounit,
"(T2,A,T74,I7)")
"TIP SCAN| Number of scanning points ", nscan
147 WRITE (iounit,
"(T2,A)")
"TIP SCAN| Start scanning ..."
152 WRITE (iounit,
"(T2,A,I7)", advance=
"NO")
"TIP SCAN| Scan point ", iscan
156 rpos(1:3) = scan_env%tip_pos(1:3, iscan) - scan_env%ref_point(1:3)
157 CALL shift_tip_potential(vref, sf, vtip, rpos)
159 IF (
ASSOCIATED(vee))
THEN
160 CALL pw_axpy(vee, vtip, alpha=1.0_dp)
171 CALL scf(qs_env, has_converged=scf_converged, total_scf_steps=tsteps)
174 IF (scf_converged)
THEN
175 WRITE (iounit,
"(T25,A,I4,A)")
"SCF converged in ", tsteps,
" steps"
177 WRITE (iounit,
"(T31,A)")
"SCF did not converge!"
184 WRITE (iounit,
"(T2,A)")
"TIP SCAN| ... end scanning"
186 dft_control%apply_external_potential = expot
194 CALL auxbas_pw_pool%give_back_pw(vtip)
195 CALL auxbas_pw_pool%give_back_pw(vref)
196 CALL auxbas_pw_pool%give_back_pw(sf)
199 logger%iter_info%print_level = plevel
200 logger%iter_info%project_name = cname
211 CALL timestop(handle)
224 SUBROUTINE shift_tip_potential(vref, sf, vtip, rpos)
226 TYPE(pw_c1d_gs_type),
INTENT(INOUT) :: vref, sf
227 TYPE(pw_r3d_rs_type),
INTENT(INOUT) :: vtip
228 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rpos
230 CHARACTER(LEN=*),
PARAMETER :: routinen =
'shift_tip_potential'
234 CALL timeset(routinen, handle)
237 CALL pw_multiply_with(sf, vref)
238 CALL pw_transfer(sf, vtip)
240 CALL timestop(handle)
242 END SUBROUTINE shift_tip_potential
251 SUBROUTINE read_tip_file(qs_env, scan_env)
252 TYPE(qs_environment_type),
POINTER :: qs_env
253 TYPE(scanning_type),
INTENT(INOUT) :: scan_env
255 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_tip_file'
257 INTEGER :: extunit, handle, i, nat
258 INTEGER,
DIMENSION(3) :: npts
259 REAL(kind=
dp) :: scaling
260 REAL(kind=
dp),
DIMENSION(3) :: rdum
261 REAL(kind=
dp),
DIMENSION(3, 3) :: dcell
262 TYPE(mp_para_env_type),
POINTER :: para_env
263 TYPE(pw_grid_type),
POINTER :: pw_grid
265 CALL timeset(routinen, handle)
269 IF (para_env%is_source())
THEN
270 CALL open_file(file_name=scan_env%tip_cube_file, &
272 file_form=
"FORMATTED", &
273 file_action=
"READ", &
279 READ (extunit, *) nat, rdum
281 READ (extunit, *) npts(i), dcell(i, 1:3)
282 dcell(i, 1:3) = npts(i)*dcell(i, 1:3)
287 CALL para_env%bcast(npts)
288 CALL para_env%bcast(dcell)
293 CALL scan_env%tip_pw_r%create(pw_grid)
297 CALL cp_cube_to_pw(scan_env%tip_pw_r, scan_env%tip_cube_file, scaling, silent=.true.)
298 CALL scan_env%tip_pw_g%create(pw_grid)
299 CALL pw_transfer(scan_env%tip_pw_r, scan_env%tip_pw_g)
302 CALL timestop(handle)
304 END SUBROUTINE read_tip_file
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public silent_print_level
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_cube_to_pw(grid, filename, scaling, silent)
Thin wrapper around routine cube_to_pw.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Interface to the message passing library MPI.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
This module defines the grid data type and some basic operations on it.
subroutine, public pw_grid_release(pw_grid)
releases the given pw grid
subroutine, public pw_grid_setup(cell_hmat, pw_grid, grid_span, cutoff, bounds, bounds_local, npts, spherical, odd, fft_usage, ncommensurate, icommensurate, blocked, ref_grid, rs_dims, iounit)
sets up a pw_grid
subroutine, public pw_grid_create(pw_grid, pe_group, local)
Initialize a PW grid with all defaults.
subroutine, public pw_structure_factor(sf, r)
Calculate the structure factor for point r.
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
Definition and initialisation of the mo data type.
subroutine, public duplicate_mo_set(mo_set_new, mo_set_old)
allocate a new mo_set, and copy the old data
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
subroutine, public reassign_allocated_mos(mo_set_new, mo_set_old)
reassign an already allocated mo_set
Routines for the Quickstep SCF run.
subroutine, public scf(qs_env, has_converged, total_scf_steps)
perform an scf procedure in the given qs_env
subroutine, public tip_scanning(qs_env, input_section)
Perform tip scanning calculation.
subroutine, public release_scanning_type(scan_info)
...
subroutine, public read_scanning_section(scan_info, input_section)
...