-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp_control_types.F
1175 lines (1065 loc) · 57.5 KB
/
cp_control_types.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Defines control structures, which contain the parameters and the
!> settings for the DFT-based calculations.
! **************************************************************************************************
MODULE cp_control_types
USE cp_fm_types, ONLY: cp_fm_release,&
cp_fm_type
USE input_constants, ONLY: do_full_density
USE kinds, ONLY: default_path_length,&
default_string_length,&
dp
USE pair_potential_types, ONLY: pair_potential_p_release,&
pair_potential_p_type
USE qs_cdft_types, ONLY: cdft_control_create,&
cdft_control_release,&
cdft_control_type
USE xas_control, ONLY: xas_control_release,&
xas_control_type
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
! **************************************************************************************************
! \brief Control parameters for pw grids
! **************************************************************************************************
TYPE pw_grid_option
LOGICAL :: spherical
LOGICAL :: fullspace
INTEGER, DIMENSION(2) :: distribution_layout
INTEGER :: blocked
END TYPE pw_grid_option
! **************************************************************************************************
! \brief parameters for EMD/RTP calculations involving MO projections
! **************************************************************************************************
TYPE proj_mo_type
INTEGER, DIMENSION(:), ALLOCATABLE :: ref_mo_index
INTEGER :: ref_mo_spin = 1
LOGICAL :: sum_on_all_ref = .FALSE.
INTEGER, DIMENSION(:), ALLOCATABLE :: td_mo_index
INTEGER :: td_mo_spin = 1
LOGICAL :: sum_on_all_td = .FALSE.
CHARACTER(LEN=default_path_length) :: ref_mo_file_name = ""
TYPE(cp_fm_type), DIMENSION(:), &
ALLOCATABLE :: mo_ref
END TYPE proj_mo_type
TYPE proj_mo_p_type
TYPE(proj_mo_type), POINTER :: proj_mo => NULL()
END TYPE proj_mo_p_type
! **************************************************************************************************
! \brief Control parameters for REAL_TIME_PROPAGATION calculations
! **************************************************************************************************
TYPE rtp_control_type
LOGICAL :: converged
REAL(KIND=dp) :: eps_ener
INTEGER :: max_iter
INTEGER :: mat_exp
INTEGER :: propagator
LOGICAL :: fixed_ions
INTEGER :: initial_wfn
REAL(dp) :: eps_exp
LOGICAL :: initial_step
LOGICAL :: hfx_redistribute
INTEGER :: aspc_order
INTEGER :: sc_check_start
LOGICAL :: apply_delta_pulse
LOGICAL :: apply_delta_pulse_mag
LOGICAL :: periodic
LOGICAL :: linear_scaling
LOGICAL :: write_restart
INTEGER :: mcweeny_max_iter
INTEGER :: acc_ref
REAL(dp) :: mcweeny_eps
INTEGER, DIMENSION(3) :: delta_pulse_direction
REAL(KIND=dp) :: delta_pulse_scale
LOGICAL :: velocity_gauge
REAL(KIND=dp), DIMENSION(3) :: vec_pot
LOGICAL :: nl_gauge_transform
LOGICAL :: is_proj_mo
TYPE(proj_mo_p_type), DIMENSION(:), &
POINTER :: proj_mo_list => NULL()
END TYPE rtp_control_type
! **************************************************************************************************
! \brief Control parameters for DFTB calculations
! **************************************************************************************************
TYPE dftb_control_type
LOGICAL :: self_consistent
LOGICAL :: orthogonal_basis
LOGICAL :: dispersion
INTEGER :: dispersion_type
LOGICAL :: dftb3_diagonal
LOGICAL :: hb_sr_damp
REAL(KIND=dp) :: hb_sr_para
REAL(KIND=dp) :: eps_disp
REAL(KIND=dp) :: epscn
REAL(KIND=dp) :: exp_pre
REAL(KIND=dp) :: scaling
REAL(KIND=dp) :: rcdisp
REAL(KIND=dp), DIMENSION(3) :: sd3
REAL(KIND=dp), DIMENSION(4) :: sd3bj
LOGICAL :: do_ewald
CHARACTER(LEN=default_path_length) :: sk_file_path
CHARACTER(LEN=default_path_length) :: sk_file_list
CHARACTER(LEN=default_string_length), &
DIMENSION(:, :), POINTER :: sk_pair_list
CHARACTER(LEN=default_path_length) :: uff_force_field
CHARACTER(LEN=default_path_length) :: dispersion_parameter_file
END TYPE dftb_control_type
! **************************************************************************************************
! \brief Control parameters for xTB calculations
! **************************************************************************************************
TYPE xtb_control_type
!
LOGICAL :: do_ewald
!
INTEGER :: sto_ng
INTEGER :: h_sto_ng
!
CHARACTER(LEN=default_path_length) :: parameter_file_path
CHARACTER(LEN=default_path_length) :: parameter_file_name
!
CHARACTER(LEN=default_path_length) :: dispersion_parameter_file
REAL(KIND=dp) :: epscn
REAL(KIND=dp) :: rcdisp
REAL(KIND=dp) :: s6, s8
REAL(KIND=dp) :: a1, a2
!
REAL(KIND=dp) :: ks, kp, kd, ksp, k2sh
REAL(KIND=dp) :: kg, kf
REAL(KIND=dp) :: kcns, kcnp, kcnd
REAL(KIND=dp) :: ken
REAL(KIND=dp) :: kxr, kx2
!
LOGICAL :: xb_interaction
LOGICAL :: do_nonbonded
LOGICAL :: coulomb_interaction
LOGICAL :: coulomb_lr
LOGICAL :: tb3_interaction
LOGICAL :: check_atomic_charges
LOGICAL :: old_coulomb_damping
!
REAL(KIND=dp) :: xb_radius
REAL(KIND=dp) :: coulomb_sr_cut
REAL(KIND=dp) :: coulomb_sr_eps
!
CHARACTER(LEN=default_string_length), &
DIMENSION(:, :), POINTER :: kab_param
INTEGER, DIMENSION(:, :), POINTER :: kab_types
INTEGER :: kab_nval
REAL, DIMENSION(:), POINTER :: kab_vals
!
TYPE(pair_potential_p_type), POINTER :: nonbonded
END TYPE xtb_control_type
! **************************************************************************************************
! \brief Control parameters for semi empirical calculations
! **************************************************************************************************
TYPE semi_empirical_control_type
LOGICAL :: orthogonal_basis
LOGICAL :: analytical_gradients
LOGICAL :: force_kdsod_EX
LOGICAL :: do_ewald, do_ewald_r3, do_ewald_gks
INTEGER :: integral_screening, periodic_type
INTEGER :: max_multipole
INTEGER :: ga_ncells
REAL(KIND=dp) :: delta
! Dispersion pair potential
LOGICAL :: dispersion
REAL(KIND=dp) :: rcdisp
REAL(KIND=dp) :: epscn
REAL(KIND=dp), DIMENSION(3) :: sd3
CHARACTER(LEN=default_path_length) :: dispersion_parameter_file
! Parameters controlling the evaluation of the integrals
REAL(KIND=dp) :: cutoff_lrc, taper_lrc, range_lrc
REAL(KIND=dp) :: cutoff_cou, taper_cou, range_cou
REAL(KIND=dp) :: cutoff_exc, taper_exc, range_exc
REAL(KIND=dp) :: taper_scr, range_scr
END TYPE semi_empirical_control_type
! **************************************************************************************************
! \brief Control parameters for GAPW method within QUICKSTEP ***
! **************************************************************************************************
TYPE gapw_control_type
INTEGER :: basis_1c
REAL(KIND=dp) :: eps_fit, &
eps_iso, &
eps_Vrho0, &
eps_svd, &
eps_cpc
INTEGER :: ladd_rho0, &
lmax_rho0, &
lmax_sphere, &
quadrature
LOGICAL :: lrho1_eq_lrho0
LOGICAL :: alpha0_hard_from_input, &
force_paw, &
non_paw_atoms, &
nopaw_as_gpw
REAL(KIND=dp) :: alpha0_hard
REAL(KIND=dp) :: max_rad_local
END TYPE gapw_control_type
! **************************************************************************************************
! \brief parameters for calculations involving a time dependent electric field
! **************************************************************************************************
TYPE efield_type
REAL(KIND=dp) :: actual_time
REAL(KIND=dp), DIMENSION(:), POINTER :: polarisation => NULL()
INTEGER :: envelop_id
REAL(KIND=dp), DIMENSION(:), POINTER :: envelop_r_vars => NULL()
INTEGER, DIMENSION(:), POINTER :: envelop_i_vars
REAL(KIND=dp) :: strength
REAL(KIND=dp) :: phase_offset
REAL(KIND=dp) :: wavelength
REAL(KIND=dp), DIMENSION(3) :: vec_pot_initial = 0.0_dp
END TYPE efield_type
TYPE efield_p_type
TYPE(efield_type), POINTER :: efield
END TYPE efield_p_type
! **************************************************************************************************
! \brief parameters for calculations involving a time dependent electric field
! **************************************************************************************************
TYPE period_efield_type
LOGICAL :: displacement_field
REAL(KIND=dp), DIMENSION(3) :: polarisation
REAL(KIND=dp), DIMENSION(3) :: d_filter
REAL(KIND=dp) :: strength
END TYPE period_efield_type
! **************************************************************************************************
! \brief some parameters useful for mulliken_restraints
! **************************************************************************************************
TYPE mulliken_restraint_type
REAL(KIND=dp) :: strength
REAL(KIND=dp) :: TARGET
INTEGER :: natoms
INTEGER, POINTER, DIMENSION(:) :: atoms
END TYPE mulliken_restraint_type
! **************************************************************************************************
! \brief some parameters useful for ddapc_restraints
! **************************************************************************************************
TYPE ddapc_restraint_type
INTEGER :: ref_count
REAL(KIND=dp) :: strength
REAL(KIND=dp) :: TARGET
REAL(KIND=dp) :: ddapc_order_p
INTEGER :: functional_form
INTEGER :: natoms
INTEGER, POINTER, DIMENSION(:) :: atoms
REAL(KIND=dp), POINTER, DIMENSION(:) :: coeff
INTEGER :: density_type
END TYPE ddapc_restraint_type
! **************************************************************************************************
! \brief some parameters useful for s2_restraints
! **************************************************************************************************
TYPE s2_restraint_type
REAL(KIND=dp) :: strength
REAL(KIND=dp) :: TARGET
REAL(KIND=dp) :: s2_order_p
INTEGER :: functional_form
END TYPE s2_restraint_type
! **************************************************************************************************
! \brief some parameters useful for auxiliary density matrix method
! **************************************************************************************************
TYPE admm_block_type
INTEGER, DIMENSION(:), ALLOCATABLE :: list
END TYPE admm_block_type
TYPE admm_control_type
REAL(KIND=dp) :: eps_filter
INTEGER :: purification_method
INTEGER :: method
LOGICAL :: charge_constrain
INTEGER :: scaling_model
INTEGER :: aux_exch_func
LOGICAL :: aux_exch_func_param
REAL(KIND=dp), DIMENSION(3) :: aux_x_param
TYPE(admm_block_type), DIMENSION(:), &
ALLOCATABLE :: blocks
END TYPE admm_control_type
! **************************************************************************************************
! \brief Parameters for external potential
! **************************************************************************************************
TYPE expot_control_type
LOGICAL :: read_from_cube
LOGICAL :: maxwell_solver
LOGICAL :: static
REAL(KIND=dp) :: scaling_factor
END TYPE expot_control_type
! **************************************************************************************************
! \brief Parameters useful for Maxwell equation evaluation of external potential
! **************************************************************************************************
TYPE maxwell_control_type
LOGICAL :: log_test
INTEGER :: int_test
REAL(KIND=dp) :: real_test
END TYPE maxwell_control_type
! **************************************************************************************************
! \brief Control parameters for a QUICKSTEP and KIM-GORDON calculation ***
! eps_pgf_orb: Cutoff value for the interaction of the primitive
! Gaussian-type functions (primitive basis functions).
! **************************************************************************************************
TYPE qs_control_type
INTEGER :: method_id
REAL(KIND=dp) :: eps_core_charge, &
eps_kg_orb, &
eps_pgf_orb, &
eps_ppl, &
eps_ppnl, &
eps_rho_gspace, &
eps_rho_rspace, &
eps_filter_matrix, &
eps_gvg_rspace, &
progression_factor, &
relative_cutoff
LOGICAL :: do_almo_scf
LOGICAL :: do_ls_scf
LOGICAL :: do_kg
LOGICAL :: commensurate_mgrids
LOGICAL :: realspace_mgrids
LOGICAL :: gapw, gapw_xc, gpw, pao
LOGICAL :: lrigpw, rigpw
LOGICAL :: lri_optbas
LOGICAL :: ofgpw
LOGICAL :: dftb
LOGICAL :: xtb
LOGICAL :: semi_empirical
LOGICAL :: mulliken_restraint
LOGICAL :: ddapc_restraint
LOGICAL :: ddapc_restraint_is_spin
LOGICAL :: ddapc_explicit_potential
LOGICAL :: cdft
LOGICAL :: et_coupling_calc
LOGICAL :: s2_restraint
INTEGER :: do_ppl_method
INTEGER :: wf_interpolation_method_nr
INTEGER :: wf_extrapolation_order
INTEGER :: periodicity
REAL(KIND=dp) :: pairlist_radius
REAL(KIND=dp) :: cutoff
REAL(KIND=dp), DIMENSION(:), POINTER :: e_cutoff
TYPE(mulliken_restraint_type), &
POINTER :: mulliken_restraint_control
TYPE(ddapc_restraint_type), &
DIMENSION(:), POINTER :: ddapc_restraint_control
TYPE(cdft_control_type), POINTER :: cdft_control
TYPE(s2_restraint_type), POINTER :: s2_restraint_control
TYPE(dftb_control_type), POINTER :: dftb_control
TYPE(xtb_control_type), POINTER :: xtb_control
TYPE(semi_empirical_control_type), &
POINTER :: se_control
TYPE(gapw_control_type), POINTER :: gapw_control
TYPE(pw_grid_option) :: pw_grid_opt
LOGICAL :: skip_load_balance_distributed
! Types of subsystems for embedding
LOGICAL :: ref_embed_subsys
LOGICAL :: cluster_embed_subsys
LOGICAL :: high_level_embed_subsys
LOGICAL :: dfet_embedded
LOGICAL :: dmfet_embedded
END TYPE qs_control_type
! **************************************************************************************************
! \brief Control parameters for the SCCS models
! **************************************************************************************************
TYPE sccs_control_type
LOGICAL :: sccs_activated = .FALSE.
INTEGER :: derivative_method = 0, &
max_iter = 0, &
method_id = 0
REAL(KIND=dp) :: alpha_solvent = 0.0_dp, &
beta = 0.0_dp, &
beta_solvent = 0.0_dp, &
delta_rho = 0.0_dp, &
eps_sccs = 0.0_dp, &
eps_scf = 0.0_dp, &
epsilon_solvent = 0.0_dp, &
gamma_solvent = 0.0_dp, &
mixing = 0.0_dp, &
rho_zero = 0.0_dp, &
rho_max = 0.0_dp, &
rho_min = 0.0_dp
END TYPE sccs_control_type
! **************************************************************************************************
! \brief Control parameters for a TIME-DEPENDENT PERTURBATION calculation
! \par ATTRIBUTES
! - n_ev : number of eigenvalues to calculate
! - n_reortho : how many time to reorthogonalize (in the lanczos algorithm)
! - do_kernel : wether to evaluate the kernel (this is a debugging option)
! - res_etype : { SINGLET | TRIPLET } which excitations
! to calculate
! - lumos_eigenvalues : holds the eigenvalues of the lumos (if calculated in QS)
!
! \par NOTES
! The lumos are helpful in choosing a initial vector for the TDDFPT
! calculation, since they can be used to construct the solutions of the
! TDDFPT operator without the perturbation kernel.
! **************************************************************************************************
TYPE tddfpt_control_type
TYPE(cp_fm_type), DIMENSION(:), &
POINTER :: lumos
REAL(KIND=dp) :: tolerance
INTEGER :: n_ev
INTEGER :: max_kv
INTEGER :: n_restarts
INTEGER :: n_reortho
LOGICAL :: do_kernel
LOGICAL :: lsd_singlets
LOGICAL :: invert_S
LOGICAL :: precond
LOGICAL :: drho_by_collocation
LOGICAL :: use_kinetic_energy_density
INTEGER :: res_etype
INTEGER :: diag_method
INTEGER :: oe_corr
INTEGER :: sic_method_id
INTEGER :: sic_list_id
REAL(KIND=dp) :: sic_scaling_a, sic_scaling_b
REAL(KIND=dp), DIMENSION(:, :), &
POINTER :: lumos_eigenvalues
END TYPE tddfpt_control_type
! **************************************************************************************************
! \brief Control parameters for simplified Tamm Dancoff approximation (sTDA)
! \par ATTRIBUTES
! \par NOTES
! **************************************************************************************************
TYPE stda_control_type
LOGICAL :: do_ewald
LOGICAL :: do_exchange
REAL(KIND=dp) :: hfx_fraction
REAL(KIND=dp) :: eps_td_filter
REAL(KIND=dp) :: mn_alpha
REAL(KIND=dp) :: mn_beta
REAL(KIND=dp) :: coulomb_sr_cut
REAL(KIND=dp) :: coulomb_sr_eps
END TYPE stda_control_type
! **************************************************************************************************
! \brief Control parameters for a Time-Dependent DFT calculation.
! **************************************************************************************************
TYPE tddfpt2_control_type
!> compute TDDFPT excitation energies and oscillator strengths
LOGICAL :: enabled
!> number of excited states to converge
INTEGER :: nstates
!> maximal number of iterations to be performed
INTEGER :: niters
!> maximal number of Krylov space vectors
INTEGER :: nkvs
!> number of unoccupied (virtual) molecular orbitals to consider
INTEGER :: nlumo
!> minimal number of MPI processes to be used per excited state
INTEGER :: nprocs
!> type of kernel function/approximation to use
INTEGER :: kernel
!> for full kernel, do we have HFX/ADMM
LOGICAL :: do_hfx
LOGICAL :: do_admm
!> for full kernel, do we have long-range HFX and/or Kxc potential
LOGICAL :: do_hfxlr
LOGICAL :: do_exck
!> options used in sTDA calculation (Kernel)
TYPE(stda_control_type) :: stda_control
!> algorithm to correct orbital energies
INTEGER :: oe_corr
!> eigenvalue shifts
REAL(KIND=dp) :: ev_shift, eos_shift
!> target accuracy
REAL(kind=dp) :: conv
!> the smallest excitation amplitude to print
REAL(kind=dp) :: min_excitation_amplitude
!> threshold which controls when two wave functions considered to be orthogonal:
!> maxabs(Ci^T * S * Cj) <= orthogonal_eps
REAL(kind=dp) :: orthogonal_eps
!> read guess wave functions from restart file if exists
LOGICAL :: is_restart
!> compute triplet excited states using spin-unpolarised molecular orbitals
LOGICAL :: rks_triplets
!> local resolution of identity for Coulomb contribution
LOGICAL :: do_lrigpw
! automatic generation of auxiliary basis for LRI-TDDFT
INTEGER :: auto_basis_p_lri_aux = 1
!> use symmetric definition of ADMM Kernel correction
LOGICAL :: admm_symm
!> Use/Ignore possible ADMM Kernel XC correction
LOGICAL :: admm_xc_correction
!
! DIPOLE_MOMENTS subsection
!
! form of the dipole operator used to compute oscillator strengths
INTEGER :: dipole_form
!> type of the reference point used for calculation of electrostatic dipole moments
INTEGER :: dipole_reference
!> user-defined reference point
REAL(kind=dp), DIMENSION(:), POINTER :: dipole_ref_point
!
! MGRID subsection
!
!> number of plain-wave grids
INTEGER :: mgrid_ngrids
!> create commensurate grids (progression factor and cutoff values of sub-grids will be ignored)
LOGICAL :: mgrid_commensurate_mgrids
!> signals that MGRID section has been explicitly given. Other mgrid_* variables
!> are not initialised when it is equal to .FALSE. as in this case the default
!> set of plain-wave grids will be used
LOGICAL :: mgrid_is_explicit
!> same as qs_control%realspace_mgrids
LOGICAL :: mgrid_realspace_mgrids
!> do not perform load balancing
LOGICAL :: mgrid_skip_load_balance
!> cutoff value at the finest grid level
REAL(kind=dp) :: mgrid_cutoff
!> cutoff at the next grid level will be smaller then the cutoff
!> at the current grid by this number of times
REAL(kind=dp) :: mgrid_progression_factor
!> cutoff that determines to which grid a particular Gaussian function will be mapped
REAL(kind=dp) :: mgrid_relative_cutoff
!> manually provided the list of cutoff values for each grid level
!> (when it is null(), the cutoff values will be assigned automatically)
REAL(kind=dp), DIMENSION(:), POINTER :: mgrid_e_cutoff
END TYPE tddfpt2_control_type
! **************************************************************************************************
! \brief Control parameters for a DFT calculation
! \par History
! 10.2019 added variables related to surface dipole correction [Soumya Ghosh]
! **************************************************************************************************
TYPE dft_control_type
TYPE(admm_control_type), POINTER :: admm_control
TYPE(period_efield_type), POINTER :: period_efield
TYPE(qs_control_type), POINTER :: qs_control
TYPE(rtp_control_type), POINTER :: rtp_control
TYPE(sccs_control_type), POINTER :: sccs_control
TYPE(tddfpt_control_type), POINTER :: tddfpt_control
TYPE(tddfpt2_control_type), POINTER :: tddfpt2_control
TYPE(xas_control_type), POINTER :: xas_control
TYPE(expot_control_type), POINTER :: expot_control
TYPE(maxwell_control_type), POINTER :: maxwell_control
TYPE(efield_p_type), POINTER, &
DIMENSION(:) :: efield_fields
INTEGER :: nspins, &
charge, &
multiplicity, &
sic_method_id, &
plus_u_method_id, &
dir_surf_dip, &
nimages = 1
INTEGER :: sic_list_id
INTEGER :: auto_basis_ri_aux = 1, &
auto_basis_aux_fit = 1, &
auto_basis_lri_aux = 1, &
auto_basis_p_lri_aux = 1, &
auto_basis_ri_hxc = 1, &
auto_basis_ri_xas = 1, &
auto_basis_ri_hfx = 1
REAL(KIND=dp) :: relax_multiplicity, &
sic_scaling_a, &
sic_scaling_b, &
pos_dir_surf_dip
LOGICAL :: do_tddfpt_calculation, &
do_xas_calculation, &
do_xas_tdp_calculation, &
drho_by_collocation, &
use_kinetic_energy_density, &
restricted, &
roks, &
uks, &
lsd, &
dft_plus_u, &
apply_efield, &
apply_efield_field, &
apply_vector_potential, &
apply_period_efield, &
apply_external_potential, &
eval_external_potential, &
do_admm, &
do_admm_dm, &
do_admm_mo, &
smear, &
low_spin_roks, &
apply_external_density, &
read_external_density, &
apply_external_vxc, &
read_external_vxc, &
correct_surf_dip, &
surf_dip_correct_switch, &
switch_surf_dip, &
correct_el_density_dip, &
do_sccs, &
apply_embed_pot, &
apply_dmfet_pot
END TYPE dft_control_type
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_control_types'
! Public data types
PUBLIC :: dft_control_type, &
qs_control_type, &
gapw_control_type, &
tddfpt_control_type, &
tddfpt2_control_type, &
proj_mo_type, &
efield_type, &
mulliken_restraint_type, &
ddapc_restraint_type, &
dftb_control_type, &
xtb_control_type, &
semi_empirical_control_type, &
s2_restraint_type, &
admm_control_type, &
maxwell_control_type, &
expot_control_type, &
rtp_control_type, &
sccs_control_type, &
stda_control_type
! Public subroutines
PUBLIC :: dft_control_release, &
dft_control_create, &
tddfpt_control_create, &
admm_control_create, &
maxwell_control_create, &
expot_control_create, &
ddapc_control_create
CONTAINS
! **************************************************************************************************
!> \brief create the mulliken_restraint_type
!> \param mulliken_restraint_control ...
!> \par History
!> 02.2005 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE mulliken_control_create(mulliken_restraint_control)
TYPE(mulliken_restraint_type), INTENT(OUT) :: mulliken_restraint_control
mulliken_restraint_control%strength = 0.1_dp
mulliken_restraint_control%target = 1.0_dp
mulliken_restraint_control%natoms = 0
NULLIFY (mulliken_restraint_control%atoms)
END SUBROUTINE mulliken_control_create
! **************************************************************************************************
!> \brief release the mulliken_restraint_type
!> \param mulliken_restraint_control ...
!> \par History
!> 02.2005 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE mulliken_control_release(mulliken_restraint_control)
TYPE(mulliken_restraint_type), INTENT(INOUT) :: mulliken_restraint_control
IF (ASSOCIATED(mulliken_restraint_control%atoms)) &
DEALLOCATE (mulliken_restraint_control%atoms)
mulliken_restraint_control%strength = 0.0_dp
mulliken_restraint_control%target = 0.0_dp
mulliken_restraint_control%natoms = 0
END SUBROUTINE mulliken_control_release
! **************************************************************************************************
!> \brief create the ddapc_restraint_type
!> \param ddapc_restraint_control ...
!> \par History
!> 02.2006 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE ddapc_control_create(ddapc_restraint_control)
TYPE(ddapc_restraint_type), INTENT(OUT) :: ddapc_restraint_control
ddapc_restraint_control%density_type = do_full_density
ddapc_restraint_control%strength = 0.1_dp
ddapc_restraint_control%ddapc_order_p = 0.0_dp
ddapc_restraint_control%functional_form = -1
ddapc_restraint_control%target = 1.0_dp
ddapc_restraint_control%natoms = 0
NULLIFY (ddapc_restraint_control%atoms)
NULLIFY (ddapc_restraint_control%coeff)
END SUBROUTINE ddapc_control_create
! **************************************************************************************************
!> \brief release the ddapc_restraint_type
!> \param ddapc_restraint_control ...
!> \par History
!> 02.2006 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE ddapc_control_release(ddapc_restraint_control)
TYPE(ddapc_restraint_type), INTENT(INOUT) :: ddapc_restraint_control
IF (ASSOCIATED(ddapc_restraint_control%atoms)) &
DEALLOCATE (ddapc_restraint_control%atoms)
IF (ASSOCIATED(ddapc_restraint_control%coeff)) &
DEALLOCATE (ddapc_restraint_control%coeff)
ddapc_restraint_control%strength = 0.0_dp
ddapc_restraint_control%target = 0.0_dp
ddapc_restraint_control%natoms = 0
END SUBROUTINE ddapc_control_release
! **************************************************************************************************
!> \brief create the s2_restraint_type
!> \param s2_restraint_control ...
!> \par History
!> 03.2006 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE s2_control_create(s2_restraint_control)
TYPE(s2_restraint_type), INTENT(OUT) :: s2_restraint_control
s2_restraint_control%strength = 0.1_dp
s2_restraint_control%s2_order_p = 0.0_dp
s2_restraint_control%functional_form = -1
s2_restraint_control%target = 1.0_dp
END SUBROUTINE s2_control_create
! **************************************************************************************************
!> \brief release the s2_restraint_type
!> \param s2_restraint_control ...
!> \par History
!> 03.2006 created [Joost VandeVondele]
! **************************************************************************************************
SUBROUTINE s2_control_release(s2_restraint_control)
TYPE(s2_restraint_type), INTENT(INOUT) :: s2_restraint_control
s2_restraint_control%strength = 0.0_dp
s2_restraint_control%target = 0.0_dp
END SUBROUTINE s2_control_release
! **************************************************************************************************
!> \brief allocates and perform a very basic initialization
!> \param dft_control the object to create
!> \par History
!> 02.2003 created [fawzi]
!> \author fawzi
! **************************************************************************************************
SUBROUTINE dft_control_create(dft_control)
TYPE(dft_control_type), INTENT(OUT) :: dft_control
NULLIFY (dft_control%xas_control)
NULLIFY (dft_control%qs_control)
NULLIFY (dft_control%tddfpt_control)
NULLIFY (dft_control%tddfpt2_control)
NULLIFY (dft_control%efield_fields)
NULLIFY (dft_control%period_efield)
NULLIFY (dft_control%admm_control)
NULLIFY (dft_control%expot_control)
NULLIFY (dft_control%maxwell_control)
NULLIFY (dft_control%rtp_control)
NULLIFY (dft_control%sccs_control)
dft_control%do_sccs = .FALSE.
dft_control%apply_embed_pot = .FALSE.
dft_control%apply_dmfet_pot = .FALSE.
CALL qs_control_create(dft_control%qs_control)
CALL tddfpt2_control_create(dft_control%tddfpt2_control)
END SUBROUTINE dft_control_create
! **************************************************************************************************
!> \brief ...
!> \param dft_control ...
!> \par History
!> 02.2003 created [fawzi]
!> \author fawzi
! **************************************************************************************************
SUBROUTINE dft_control_release(dft_control)
TYPE(dft_control_type), INTENT(INOUT) :: dft_control
CALL qs_control_release(dft_control%qs_control)
CALL tddfpt_control_release(dft_control%tddfpt_control)
CALL tddfpt2_control_release(dft_control%tddfpt2_control)
IF (ASSOCIATED(dft_control%xas_control)) THEN
CALL xas_control_release(dft_control%xas_control)
DEALLOCATE (dft_control%xas_control)
END IF
CALL admm_control_release(dft_control%admm_control)
CALL expot_control_release(dft_control%expot_control)
CALL maxwell_control_release(dft_control%maxwell_control)
CALL efield_fields_release(dft_control%efield_fields)
IF (ASSOCIATED(dft_control%sccs_control)) DEALLOCATE (dft_control%sccs_control)
IF (ASSOCIATED(dft_control%period_efield)) THEN
DEALLOCATE (dft_control%period_efield)
END IF
IF (ASSOCIATED(dft_control%rtp_control)) THEN
CALL proj_mo_list_release(dft_control%rtp_control%proj_mo_list)
DEALLOCATE (dft_control%rtp_control)
END IF
END SUBROUTINE dft_control_release
! **************************************************************************************************
!> \brief ...
!> \param qs_control ...
! **************************************************************************************************
SUBROUTINE qs_control_create(qs_control)
TYPE(qs_control_type), POINTER :: qs_control
CPASSERT(.NOT. ASSOCIATED(qs_control))
ALLOCATE (qs_control)
NULLIFY (qs_control%e_cutoff)
NULLIFY (qs_control%gapw_control)
NULLIFY (qs_control%mulliken_restraint_control)
NULLIFY (qs_control%ddapc_restraint_control)
NULLIFY (qs_control%s2_restraint_control)
NULLIFY (qs_control%se_control)
NULLIFY (qs_control%dftb_control)
NULLIFY (qs_control%xtb_control)
NULLIFY (qs_control%cdft_control)
NULLIFY (qs_control%ddapc_restraint_control)
ALLOCATE (qs_control%mulliken_restraint_control)
CALL mulliken_control_create(qs_control%mulliken_restraint_control)
ALLOCATE (qs_control%s2_restraint_control)
CALL s2_control_create(qs_control%s2_restraint_control)
ALLOCATE (qs_control%gapw_control)
CALL se_control_create(qs_control%se_control)
CALL dftb_control_create(qs_control%dftb_control)
CALL xtb_control_create(qs_control%xtb_control)
ALLOCATE (qs_control%cdft_control)
CALL cdft_control_create(qs_control%cdft_control)
END SUBROUTINE qs_control_create
! **************************************************************************************************
!> \brief ...
!> \param qs_control ...
! **************************************************************************************************
SUBROUTINE qs_control_release(qs_control)
TYPE(qs_control_type), POINTER :: qs_control
INTEGER :: i
IF (ASSOCIATED(qs_control)) THEN
CALL mulliken_control_release(qs_control%mulliken_restraint_control)
DEALLOCATE (qs_control%mulliken_restraint_control)
CALL s2_control_release(qs_control%s2_restraint_control)
DEALLOCATE (qs_control%s2_restraint_control)
CALL se_control_release(qs_control%se_control)
CALL dftb_control_release(qs_control%dftb_control)
CALL xtb_control_release(qs_control%xtb_control)
IF (ASSOCIATED(qs_control%cdft_control)) THEN
CALL cdft_control_release(qs_control%cdft_control)
DEALLOCATE (qs_control%cdft_control)
END IF
IF (ASSOCIATED(qs_control%e_cutoff)) THEN
DEALLOCATE (qs_control%e_cutoff)
END IF
IF (ASSOCIATED(qs_control%gapw_control)) THEN
DEALLOCATE (qs_control%gapw_control)
END IF
IF (ASSOCIATED(qs_control%ddapc_restraint_control)) THEN
DO i = 1, SIZE(qs_control%ddapc_restraint_control)
CALL ddapc_control_release(qs_control%ddapc_restraint_control(i))
END DO
DEALLOCATE (qs_control%ddapc_restraint_control)
END IF
DEALLOCATE (qs_control)
END IF
END SUBROUTINE qs_control_release
! **************************************************************************************************
!> \brief ...
!> \param tddfpt_control ...
! **************************************************************************************************
SUBROUTINE tddfpt_control_create(tddfpt_control)
TYPE(tddfpt_control_type), POINTER :: tddfpt_control
CPASSERT(.NOT. ASSOCIATED(tddfpt_control))
ALLOCATE (tddfpt_control)
NULLIFY (tddfpt_control%lumos)
NULLIFY (tddfpt_control%lumos_eigenvalues)
END SUBROUTINE tddfpt_control_create
! **************************************************************************************************
!> \brief ...
!> \param tddfpt_control ...
! **************************************************************************************************
SUBROUTINE tddfpt_control_release(tddfpt_control)
TYPE(tddfpt_control_type), POINTER :: tddfpt_control
IF (ASSOCIATED(tddfpt_control)) THEN
CALL cp_fm_release(tddfpt_control%lumos)
IF (ASSOCIATED(tddfpt_control%lumos_eigenvalues)) THEN
DEALLOCATE (tddfpt_control%lumos_eigenvalues)
END IF
DEALLOCATE (tddfpt_control)
END IF
END SUBROUTINE tddfpt_control_release
! **************************************************************************************************
!> \brief allocate control options for Time-Dependent Density Functional Theory calculation
!> \param tddfpt_control an object to create
!> \par History
!> * 05.2016 created [Sergey Chulkov]
! **************************************************************************************************
SUBROUTINE tddfpt2_control_create(tddfpt_control)
TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_create'
INTEGER :: handle
CPASSERT(.NOT. ASSOCIATED(tddfpt_control))
CALL timeset(routineN, handle)
ALLOCATE (tddfpt_control)
CALL timestop(handle)
END SUBROUTINE tddfpt2_control_create
! **************************************************************************************************
!> \brief release memory allocated for TDDFT control options
!> \param tddfpt_control an object to release
!> \par History
!> * 05.2016 created [Sergey Chulkov]
! **************************************************************************************************
SUBROUTINE tddfpt2_control_release(tddfpt_control)
TYPE(tddfpt2_control_type), POINTER :: tddfpt_control
CHARACTER(len=*), PARAMETER :: routineN = 'tddfpt2_control_release'
INTEGER :: handle
CALL timeset(routineN, handle)
IF (ASSOCIATED(tddfpt_control)) THEN
DEALLOCATE (tddfpt_control)
END IF
CALL timestop(handle)
END SUBROUTINE tddfpt2_control_release
! **************************************************************************************************
!> \brief ...
!> \param proj_mo_list ...
! **************************************************************************************************
SUBROUTINE proj_mo_list_release(proj_mo_list)
TYPE(proj_mo_p_type), DIMENSION(:), POINTER :: proj_mo_list
INTEGER :: i, mo_ref_nbr
IF (ASSOCIATED(proj_mo_list)) THEN
DO i = 1, SIZE(proj_mo_list)
IF (ASSOCIATED(proj_mo_list(i)%proj_mo)) THEN
IF (ALLOCATED(proj_mo_list(i)%proj_mo%ref_mo_index)) &
DEALLOCATE (proj_mo_list(i)%proj_mo%ref_mo_index)
IF (ALLOCATED(proj_mo_list(i)%proj_mo%mo_ref)) THEN
DO mo_ref_nbr = 1, SIZE(proj_mo_list(i)%proj_mo%mo_ref)
CALL cp_fm_release(proj_mo_list(i)%proj_mo%mo_ref(mo_ref_nbr))
END DO
DEALLOCATE (proj_mo_list(i)%proj_mo%mo_ref)
END IF
IF (ALLOCATED(proj_mo_list(i)%proj_mo%td_mo_index)) &
DEALLOCATE (proj_mo_list(i)%proj_mo%td_mo_index)
DEALLOCATE (proj_mo_list(i)%proj_mo)
END IF
END DO
DEALLOCATE (proj_mo_list)
END IF
END SUBROUTINE proj_mo_list_release
! **************************************************************************************************
!> \brief ...
!> \param efield_fields ...
! **************************************************************************************************
SUBROUTINE efield_fields_release(efield_fields)
TYPE(efield_p_type), DIMENSION(:), POINTER :: efield_fields
INTEGER :: i
IF (ASSOCIATED(efield_fields)) THEN
DO i = 1, SIZE(efield_fields)
IF (ASSOCIATED(efield_fields(i)%efield)) THEN
IF (ASSOCIATED(efield_fields(i)%efield%envelop_r_vars)) THEN
DEALLOCATE (efield_fields(i)%efield%envelop_r_vars)
END IF
IF (ASSOCIATED(efield_fields(i)%efield%envelop_i_vars)) THEN
DEALLOCATE (efield_fields(i)%efield%envelop_i_vars)
END IF
IF (ASSOCIATED(efield_fields(i)%efield%polarisation)) &
DEALLOCATE (efield_fields(i)%efield%polarisation)
DEALLOCATE (efield_fields(i)%efield)
END IF
END DO