|
CP2K 2.4 (Revision 12889)
|
00001 !-----------------------------------------------------------------------------! 00002 ! CP2K: A general program to perform molecular dynamics simulations ! 00003 ! Copyright (C) 2000 - 2013 CP2K developers group ! 00004 !-----------------------------------------------------------------------------! 00005 00006 ! ***************************************************************************** 00012 MODULE input_cp2k_check 00013 USE cp2k_info, ONLY: id_cp2k_version 00014 USE cp_para_types, ONLY: cp_para_env_type 00015 USE cp_parser_types, ONLY: cp_parser_type,& 00016 parser_create,& 00017 parser_release 00018 USE cp_units, ONLY: cp_unit_set_create,& 00019 cp_unit_set_release,& 00020 cp_unit_set_type 00021 USE f77_blas 00022 USE input_constants, ONLY: & 00023 do_region_global, do_thermo_al, do_thermo_csvr, do_thermo_gle, & 00024 do_thermo_nose, do_thermo_same_as_part, do_vwn5, id_release_version, & 00025 npt_f_ensemble, npt_i_ensemble, xc_funct_b3lyp, xc_funct_blyp, & 00026 xc_funct_bp, xc_funct_hcth120, xc_funct_no_shortcut, xc_funct_olyp, & 00027 xc_funct_pade, xc_funct_pbe, xc_funct_pbe0, xc_funct_tpss, & 00028 xc_funct_xwpbe, xc_none 00029 USE input_cp2k, ONLY: create_cp2k_root_section 00030 USE input_keyword_types, ONLY: keyword_type 00031 USE input_parsing, ONLY: section_vals_parse 00032 USE input_section_types, ONLY: & 00033 section_release, section_type, section_vals_check_release, & 00034 section_vals_create, section_vals_get, section_vals_get_subs_vals, & 00035 section_vals_get_subs_vals3, section_vals_release, & 00036 section_vals_remove_values, section_vals_set_subs_vals, & 00037 section_vals_type, section_vals_val_get, section_vals_val_set, & 00038 section_vals_val_unset 00039 USE input_val_types, ONLY: logical_t 00040 USE kinds, ONLY: default_path_length,& 00041 default_string_length,& 00042 dp 00043 USE memory_utilities, ONLY: reallocate 00044 USE timings, ONLY: timeset,& 00045 timestop 00046 #include "cp_common_uses.h" 00047 00048 IMPLICIT NONE 00049 PRIVATE 00050 00051 LOGICAL, PRIVATE, PARAMETER :: debug_this_module=.TRUE. 00052 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_check' 00053 00054 PUBLIC :: check_cp2k_input, xc_functionals_expand, remove_restart_info 00055 00056 CONTAINS 00057 00058 ! ***************************************************************************** 00067 SUBROUTINE check_cp2k_input(input_file,para_env,output_unit,error) 00068 TYPE(section_vals_type), POINTER :: input_file 00069 TYPE(cp_para_env_type), POINTER :: para_env 00070 INTEGER, INTENT(IN), OPTIONAL :: output_unit 00071 TYPE(cp_error_type), INTENT(inout) :: error 00072 00073 CHARACTER(len=*), PARAMETER :: routineN = 'check_cp2k_input', 00074 routineP = moduleN//':'//routineN 00075 00076 INTEGER :: handle, iforce_eval, 00077 nforce_eval 00078 LOGICAL :: enable_unsupported_features, 00079 explicit, explicit_mix, 00080 failure 00081 TYPE(section_vals_type), POINTER :: section, section1, section2, 00082 section3, sections 00083 00084 CALL timeset(routineN,handle) 00085 failure=.FALSE. 00086 CPPrecondition(ASSOCIATED(input_file),cp_failure_level,routineP,error,failure) 00087 IF (.NOT.failure) THEN 00088 CPPrecondition(input_file%ref_count>0,cp_failure_level,routineP,error,failure) 00089 END IF 00090 IF (.NOT. failure) THEN 00091 ! ext_restart 00092 IF(PRESENT(output_unit)) & 00093 CALL handle_ext_restart(input_file,para_env,output_unit,error) 00094 00095 ! checks on force_eval section 00096 sections => section_vals_get_subs_vals(input_file,"FORCE_EVAL",error=error) 00097 CALL section_vals_get(sections, n_repetition=nforce_eval, error=error) 00098 00099 ! multiple force_eval only if present RESPA or MIXED calculation is performed 00100 section2 => section_vals_get_subs_vals(input_file,"MOTION%MD%RESPA",error=error) 00101 CALL section_vals_get(section2,explicit=explicit,error=error) 00102 DO iforce_eval=1,nforce_eval 00103 section3 =>section_vals_get_subs_vals(sections,"MIXED",& 00104 i_rep_section=iforce_eval,error=error) 00105 CALL section_vals_get(section3,explicit=explicit_mix,error=error) 00106 IF(explicit_mix)EXIT 00107 END DO 00108 00109 IF ((explicit.AND.(nforce_eval==1)).OR.(.NOT.explicit.AND.(nforce_eval>1)))THEN 00110 IF((explicit_mix.AND.(nforce_eval==1)).OR.(.NOT.explicit_mix.AND.(nforce_eval>1)))THEN 00111 CALL cp_assert(.FALSE.,cp_failure_level,cp_assertion_failed,& 00112 routineP,"Error multiple force_env without RESPA or MIXED, or RESPA with one single "//& 00113 " or MIXED with only two force_env section.",error,failure) 00114 END IF 00115 END IF 00116 DO iforce_eval = 1,nforce_eval 00117 section => section_vals_get_subs_vals3(sections,"DFT",i_rep_section=iforce_eval,error=error) 00118 ! xc: expand and fix default for tddfpt 00119 section1 => section_vals_get_subs_vals(section,"XC",error=error) 00120 section2 => section_vals_get_subs_vals(section,"XC%XC_FUNCTIONAL",error=error) 00121 CALL xc_functionals_expand(section2,section1,error=error) 00122 section1 => section_vals_get_subs_vals(section,"TDDFPT%XC",error=error) 00123 section2 => section_vals_get_subs_vals(section,"TDDFPT%XC%XC_FUNCTIONAL",error=error) 00124 CALL section_vals_get(section2,explicit=explicit,error=error) 00125 IF (explicit) THEN 00126 CALL xc_functionals_expand(section2,section1,error=error) 00127 ELSE 00128 section2 => section_vals_get_subs_vals(section,"XC%XC_FUNCTIONAL",error=error) 00129 CALL section_vals_set_subs_vals(section,"TDDFPT%XC%XC_FUNCTIONAL",section2,error=error) 00130 END IF 00131 END DO 00132 00133 ! Check for unsupported features for release version 00134 IF (id_cp2k_version==id_release_version) THEN 00135 CALL section_vals_val_get(input_file,"GLOBAL%ENABLE_UNSUPPORTED_FEATURES",& 00136 l_val=enable_unsupported_features, error=error) 00137 CALL section_vals_check_release(input_file,enable_unsupported_features,error) 00138 END IF 00139 END IF 00140 CALL timestop(handle) 00141 END SUBROUTINE check_cp2k_input 00142 00143 ! ***************************************************************************** 00150 SUBROUTINE xc_functionals_expand(functionals,xc_section,error) 00151 TYPE(section_vals_type), POINTER :: functionals, xc_section 00152 TYPE(cp_error_type), INTENT(inout) :: error 00153 00154 CHARACTER(len=*), PARAMETER :: routineN = 'xc_functionals_expand', 00155 routineP = moduleN//':'//routineN 00156 00157 INTEGER :: shortcut 00158 LOGICAL :: failure 00159 00160 failure=.FALSE. 00161 00162 IF (.NOT. failure) THEN 00163 CALL section_vals_val_get(functionals,"_SECTION_PARAMETERS_",& 00164 i_val=shortcut,error=error) 00165 SELECT CASE(shortcut) 00166 CASE(xc_funct_no_shortcut, xc_none) 00167 ! nothing to expand 00168 CASE(xc_funct_pbe0) 00169 CALL section_vals_val_set(functionals,"PBE%_SECTION_PARAMETERS_",& 00170 l_val=.TRUE.,error=error) 00171 CALL section_vals_val_set(functionals,"PBE%SCALE_X",& 00172 r_val=0.75_dp,error=error) 00173 CALL section_vals_val_set(functionals,"PBE%SCALE_C",& 00174 r_val=1.0_dp,error=error) 00175 ! Hartree Fock Exact Exchange 00176 CALL section_vals_val_set(xc_section,"HF%FRACTION",& 00177 r_val=0.25_dp,error=error) 00178 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00179 i_val=xc_funct_no_shortcut,error=error) 00180 CASE(xc_funct_b3lyp) 00181 CALL section_vals_val_set(functionals,"BECKE88%_SECTION_PARAMETERS_",& 00182 l_val=.TRUE.,error=error) 00183 CALL section_vals_val_set(functionals,"BECKE88%SCALE_X",& 00184 r_val=0.72_dp,error=error) 00185 CALL section_vals_val_set(functionals,"LYP%_SECTION_PARAMETERS_",& 00186 l_val=.TRUE.,error=error) 00187 CALL section_vals_val_set(functionals,"LYP%SCALE_C",& 00188 r_val=0.81_dp,error=error) 00189 CALL section_vals_val_set(functionals,"VWN%_SECTION_PARAMETERS_",& 00190 l_val=.TRUE.,error=error) 00191 CALL section_vals_val_set(functionals,"VWN%FUNCTIONAL_TYPE",& 00192 i_val=do_vwn5,error=error) 00193 CALL section_vals_val_set(functionals,"VWN%SCALE_C",& 00194 r_val=0.19_dp,error=error) 00195 CALL section_vals_val_set(functionals,"XALPHA%_SECTION_PARAMETERS_",& 00196 l_val=.TRUE.,error=error) 00197 CALL section_vals_val_set(functionals,"XALPHA%SCALE_X",& 00198 r_val=0.08_dp,error=error) 00199 ! Hartree Fock Exact Exchange 00200 CALL section_vals_val_set(xc_section,"HF%FRACTION",& 00201 r_val=0.20_dp,error=error) 00202 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00203 i_val=xc_funct_no_shortcut,error=error) 00204 CASE(xc_funct_blyp) 00205 CALL section_vals_val_set(functionals,"BECKE88%_SECTION_PARAMETERS_",& 00206 l_val=.TRUE.,error=error) 00207 CALL section_vals_val_set(functionals,"LYP%_SECTION_PARAMETERS_",& 00208 l_val=.TRUE.,error=error) 00209 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00210 i_val=xc_funct_no_shortcut,error=error) 00211 CASE(xc_funct_bp) 00212 CALL section_vals_val_set(functionals,"BECKE88%_SECTION_PARAMETERS_",& 00213 l_val=.TRUE.,error=error) 00214 CALL section_vals_val_set(functionals,"P86C%_SECTION_PARAMETERS_",& 00215 l_val=.TRUE.,error=error) 00216 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00217 i_val=xc_funct_no_shortcut,error=error) 00218 CASE(xc_funct_pade) 00219 CALL section_vals_val_set(functionals,"PADE%_SECTION_PARAMETERS_",& 00220 l_val=.TRUE.,error=error) 00221 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00222 i_val=xc_funct_no_shortcut,error=error) 00223 CASE(xc_funct_pbe) 00224 CALL section_vals_val_set(functionals,"PBE%_SECTION_PARAMETERS_",& 00225 l_val=.TRUE.,error=error) 00226 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00227 i_val=xc_funct_no_shortcut,error=error) 00228 CASE(xc_funct_xwpbe) 00229 CALL section_vals_val_set(functionals,"XWPBE%_SECTION_PARAMETERS_",& 00230 l_val=.TRUE.,error=error) 00231 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00232 i_val=xc_funct_no_shortcut,error=error) 00233 CASE(xc_funct_tpss) 00234 CALL section_vals_val_set(functionals,"TPSS%_SECTION_PARAMETERS_",& 00235 l_val=.TRUE.,error=error) 00236 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00237 i_val=xc_funct_no_shortcut,error=error) 00238 CASE(xc_funct_olyp) 00239 CALL section_vals_val_set(functionals,"OPTX%_SECTION_PARAMETERS_",& 00240 l_val=.TRUE.,error=error) 00241 CALL section_vals_val_set(functionals,"LYP%_SECTION_PARAMETERS_",& 00242 l_val=.TRUE.,error=error) 00243 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00244 i_val=xc_funct_no_shortcut,error=error) 00245 CASE(xc_funct_hcth120) 00246 CALL section_vals_val_set(functionals,"HCTH%_SECTION_PARAMETERS_",& 00247 l_val=.TRUE.,error=error) 00248 CALL section_vals_val_set(functionals,"HCTH%PARAMETER_SET",& 00249 i_val=120,error=error) 00250 CALL section_vals_val_set(functionals,"_SECTION_PARAMETERS_",& 00251 i_val=xc_funct_no_shortcut,error=error) 00252 CASE default 00253 CALL cp_assert(.FALSE.,cp_failure_level,cp_assertion_failed,& 00254 routineP,"unknown shortcut "//TRIM(ADJUSTL(cp_to_string(shortcut))),& 00255 error,failure) 00256 END SELECT 00257 END IF 00258 END SUBROUTINE xc_functionals_expand 00259 00260 ! ***************************************************************************** 00268 SUBROUTINE handle_ext_restart(input_file,para_env,output_unit,error) 00269 TYPE(section_vals_type), POINTER :: input_file 00270 TYPE(cp_para_env_type), POINTER :: para_env 00271 INTEGER, INTENT(IN) :: output_unit 00272 TYPE(cp_error_type), INTENT(inout) :: error 00273 00274 CHARACTER(len=*), PARAMETER :: routineN = 'handle_ext_restart', 00275 routineP = moduleN//':'//routineN 00276 00277 CHARACTER(default_path_length) :: binary_restart_file, 00278 r_file_path 00279 CHARACTER(default_string_length) :: path 00280 CHARACTER(LEN=default_string_length), 00281 DIMENSION(:), POINTER :: restarted_infos 00282 INTEGER :: ensemble, handle, i_rep_val, 00283 iforce_eval, myi, n_rep_val, 00284 nforce_eval1, nforce_eval2, 00285 stat 00286 INTEGER, DIMENSION(:), POINTER :: ivec, iwalkers_status, iwork, 00287 rwalkers_status 00288 LOGICAL :: bsse_check, check, explicit1, 00289 explicit2, failure, flag, 00290 flag2, qmmm_check, 00291 subsys_check 00292 REAL(KIND=dp) :: myt 00293 REAL(KIND=dp), DIMENSION(:), POINTER :: vec, work 00294 TYPE(cp_error_type) :: sub_error 00295 TYPE(cp_parser_type), POINTER :: cpparser 00296 TYPE(cp_unit_set_type), POINTER :: default_units 00297 TYPE(section_type), POINTER :: input_structure 00298 TYPE(section_vals_type), POINTER :: r_section, rep_sections, 00299 restart_file, section, 00300 section1, section2, 00301 sections1, sections2 00302 00303 NULLIFY(restarted_infos,iwalkers_status,rwalkers_status,vec,ivec,work,iwork) 00304 CALL timeset(routineN,handle) 00305 failure=.FALSE. 00306 IF (.NOT. failure) THEN 00307 ! Handle restart file 00308 r_section => section_vals_get_subs_vals(input_file, "EXT_RESTART",error=error) 00309 CALL section_vals_val_get(r_section,"RESTART_FILE_NAME", c_val=r_file_path, error=error) 00310 CALL section_vals_val_get(r_section,"BINARY_RESTART_FILE_NAME",c_val=binary_restart_file,& 00311 error=error) 00312 00313 IF (r_file_path/=" ") THEN 00314 CALL cp_error_init(sub_error,template_error=error,stop_level=cp_fatal_level) 00315 ! parse the input 00316 NULLIFY(input_structure, default_units) 00317 CALL create_cp2k_root_section(input_structure,error=sub_error) 00318 NULLIFY(restart_file) 00319 CALL section_vals_create(restart_file,input_structure, error=sub_error) 00320 CALL section_release(input_structure,error=sub_error) 00321 NULLIFY(cpparser) 00322 CALL parser_create(cpparser,file_name=r_file_path,para_env=para_env,error=sub_error) 00323 CALL cp_unit_set_create(default_units, "OUTPUT",error=sub_error) 00324 CALL section_vals_parse(restart_file,cpparser,root_section=.FALSE.,& 00325 default_units=default_units,error=sub_error) 00326 CALL cp_unit_set_release(default_units,error=sub_error) 00327 CALL parser_release(cpparser,error=sub_error) 00328 CALL cp_error_dealloc_ref(sub_error) 00329 00330 ! Restart and input files same number of force_env sections 00331 sections1 => section_vals_get_subs_vals(restart_file,"FORCE_EVAL",error=error) 00332 CALL section_vals_get(sections1, n_repetition=nforce_eval1, error=error) 00333 sections2 => section_vals_get_subs_vals(input_file,"FORCE_EVAL",error=error) 00334 CALL section_vals_get(sections2, n_repetition=nforce_eval2, error=error) 00335 IF (nforce_eval1/=nforce_eval2) THEN 00336 CALL cp_assert(.FALSE.,cp_failure_level,cp_assertion_failed,& 00337 routineP,"Restart and input file MUST have the number of force_env sections",& 00338 error,failure) 00339 END IF 00340 ! Handle default restarts 00341 CALL handle_defaults_restart(r_section, error=error) 00342 00343 ! Real restart of force_evals 00344 DO iforce_eval = 1, nforce_eval1 00345 section1 => section_vals_get_subs_vals3(sections1,"SUBSYS",& 00346 i_rep_section=iforce_eval,error=error) 00347 section2 => section_vals_get_subs_vals3(sections2,"SUBSYS",& 00348 i_rep_section=iforce_eval,error=error) 00349 ! Some care needs to be handled when treating multiple force_eval 00350 ! Both subsys need to be consistently associated or not 00351 ! Mixed stuff will be rejected for safety reason.. 00352 subsys_check = (ASSOCIATED(section1).EQV.ASSOCIATED(section2)) 00353 IF (subsys_check) THEN 00354 IF (ASSOCIATED(section1)) THEN 00355 CALL section_vals_val_get(r_section,"RESTART_CELL",l_val=flag,error=error) 00356 IF (flag) THEN 00357 section => section_vals_get_subs_vals(section1,"CELL",error=error) 00358 CALL section_vals_set_subs_vals(section2,"CELL",section,error=error) 00359 CALL set_restart_info("CELL",restarted_infos,error) 00360 END IF 00361 00362 CALL section_vals_val_get(r_section,"RESTART_POS",l_val=flag,error=error) 00363 IF (flag) THEN 00364 section => section_vals_get_subs_vals(section1,"COORD",error=error) 00365 CALL section_vals_set_subs_vals(section2,"COORD",section,error=error) 00366 CALL set_restart_info("COORDINATES",restarted_infos,error) 00367 ! Copy over also the information on the multiple_unit_cell 00368 CALL section_vals_val_get(section1,"TOPOLOGY%MULTIPLE_UNIT_CELL",i_vals=ivec,& 00369 error=error) 00370 ALLOCATE(iwork(3),stat=stat) 00371 CPPrecondition(stat==0,cp_failure_level,routineP,error,failure) 00372 iwork=ivec 00373 CALL section_vals_val_set(section2,"TOPOLOGY%MULTIPLE_UNIT_CELL",i_vals_ptr=iwork,& 00374 error=error) 00375 END IF 00376 00377 CALL section_vals_val_get(r_section,"RESTART_RANDOMG",l_val=flag,error=error) 00378 IF (flag) THEN 00379 section => section_vals_get_subs_vals(section1,"RNG_INIT",error=error) 00380 CALL section_vals_set_subs_vals(section2,"RNG_INIT",section,error=error) 00381 CALL set_restart_info("RANDOM NUMBER GENERATOR",restarted_infos,error) 00382 END IF 00383 00384 CALL section_vals_val_get(r_section,"RESTART_VEL",l_val=flag,error=error) 00385 IF (flag) THEN 00386 section => section_vals_get_subs_vals(section1,"VELOCITY",error=error) 00387 CALL section_vals_set_subs_vals(section2,"VELOCITY",section,error=error) 00388 CALL set_restart_info("VELOCITIES",restarted_infos,error) 00389 END IF 00390 00391 ! Core-Shell information "restarted" only when strictly necessary 00392 CALL section_vals_val_get(r_section,"RESTART_SHELL_POS",l_val=flag,error=error) 00393 IF (flag) THEN 00394 section => section_vals_get_subs_vals(section1,"SHELL_COORD",error=error) 00395 CALL section_vals_set_subs_vals(section2,"SHELL_COORD",section,error=error) 00396 IF (check_restart(section1, section2, "SHELL_COORD",error)) & 00397 CALL set_restart_info("SHELL COORDINATES",restarted_infos,error) 00398 END IF 00399 CALL section_vals_val_get(r_section,"RESTART_CORE_POS",l_val=flag,error=error) 00400 IF (flag) THEN 00401 section => section_vals_get_subs_vals(section1,"CORE_COORD",error=error) 00402 CALL section_vals_set_subs_vals(section2,"CORE_COORD",section,error=error) 00403 IF (check_restart(section1, section2, "CORE_COORD",error)) & 00404 CALL set_restart_info("CORE COORDINATES",restarted_infos,error) 00405 END IF 00406 CALL section_vals_val_get(r_section,"RESTART_SHELL_VELOCITY",l_val=flag,error=error) 00407 IF (flag) THEN 00408 section => section_vals_get_subs_vals(section1,"SHELL_VELOCITY",error=error) 00409 CALL section_vals_set_subs_vals(section2,"SHELL_VELOCITY",section,error=error) 00410 IF (check_restart(section1, section2, "SHELL_VELOCITY",error)) & 00411 CALL set_restart_info("SHELL VELOCITIES",restarted_infos,error) 00412 END IF 00413 CALL section_vals_val_get(r_section,"RESTART_CORE_VELOCITY",l_val=flag,error=error) 00414 IF (flag) THEN 00415 section => section_vals_get_subs_vals(section1,"CORE_VELOCITY",error=error) 00416 CALL section_vals_set_subs_vals(section2,"CORE_VELOCITY",section,error=error) 00417 IF (check_restart(section1, section2, "CORE_VELOCITY",error)) & 00418 CALL set_restart_info("CORE VELOCITIES",restarted_infos,error) 00419 END IF 00420 END IF 00421 ELSE 00422 CALL cp_assert(.FALSE.,cp_failure_level,cp_assertion_failed,& 00423 routineP,"Error while reading the restart file. Two force_eval have incompatible"//& 00424 " subsys.One of them has an allocated subsys while the other has not! Check your"//& 00425 " input file or whether the restart file is compatible with the input!",& 00426 error,failure) 00427 END IF 00428 ! QMMM restarts 00429 CALL section_vals_val_get(r_section,"RESTART_QMMM",l_val=flag,error=error) 00430 section1 => section_vals_get_subs_vals3(sections1,"QMMM",i_rep_section=iforce_eval,error=error) 00431 section2 => section_vals_get_subs_vals3(sections2,"QMMM",i_rep_section=iforce_eval,error=error) 00432 CALL section_vals_get(section1,explicit=explicit1,error=error) 00433 CALL section_vals_get(section2,explicit=explicit2,error=error) 00434 qmmm_check = (explicit1.AND.explicit2) 00435 IF (flag.AND.qmmm_check) THEN 00436 CALL set_restart_info("QMMM TRANSLATION VECTOR",restarted_infos,error) 00437 CALL section_vals_val_get(section1,"INITIAL_TRANSLATION_VECTOR",r_vals=vec,error=error) 00438 ALLOCATE(work(3),stat=stat) 00439 CPPrecondition(stat==0,cp_failure_level,routineP,error,failure) 00440 work = vec 00441 CALL section_vals_val_set(section2,"INITIAL_TRANSLATION_VECTOR",r_vals_ptr=work,error=error) 00442 END IF 00443 ! BSSE restarts 00444 CALL section_vals_val_get(r_section,"RESTART_BSSE",l_val=flag,error=error) 00445 section1 => section_vals_get_subs_vals3(sections1,"BSSE",i_rep_section=iforce_eval,error=error) 00446 section2 => section_vals_get_subs_vals3(sections2,"BSSE",i_rep_section=iforce_eval,error=error) 00447 CALL section_vals_get(section1,explicit=explicit1,error=error) 00448 CALL section_vals_get(section2,explicit=explicit2,error=error) 00449 bsse_check = (explicit1.AND.explicit2) 00450 IF (flag.AND.bsse_check) THEN 00451 section => section_vals_get_subs_vals(section1,"FRAGMENT_ENERGIES",error=error) 00452 CALL section_vals_set_subs_vals(section2,"FRAGMENT_ENERGIES",section,error=error) 00453 CALL set_restart_info("BSSE FRAGMENT ENERGIES",restarted_infos,error) 00454 END IF 00455 END DO 00456 00457 CALL section_vals_val_get(r_section,"RESTART_COUNTERS",l_val=flag,error=error) 00458 IF (flag) THEN 00459 IF (check_restart(input_file, restart_file, "MOTION%MD",error)) THEN 00460 CALL section_vals_val_get(restart_file,"MOTION%MD%STEP_START_VAL",i_val=myi,error=error) 00461 CALL section_vals_val_set(input_file,"MOTION%MD%STEP_START_VAL",i_val=myi,error=error) 00462 CALL section_vals_val_get(restart_file,"MOTION%MD%TIME_START_VAL",r_val=myt,error=error) 00463 CALL section_vals_val_set(input_file,"MOTION%MD%TIME_START_VAL",r_val=myt,error=error) 00464 CALL section_vals_val_get(restart_file,"MOTION%MD%ECONS_START_VAL",r_val=myt,error=error) 00465 CALL section_vals_val_set(input_file,"MOTION%MD%ECONS_START_VAL",r_val=myt,error=error) 00466 CALL set_restart_info("MD COUNTERS",restarted_infos,error) 00467 END IF 00468 ! 00469 IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT",error)) THEN 00470 ! GEO_OPT 00471 CALL section_vals_val_get(restart_file,"MOTION%GEO_OPT%STEP_START_VAL",i_val=myi,error=error) 00472 CALL section_vals_val_set(input_file,"MOTION%GEO_OPT%STEP_START_VAL",i_val=myi,error=error) 00473 CALL set_restart_info("GEO_OPT COUNTERS",restarted_infos,error) 00474 ! ROT_OPT 00475 IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT",error)) THEN 00476 CALL section_vals_val_get(restart_file,"MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT%STEP_START_VAL",& 00477 i_val=myi,error=error) 00478 CALL section_vals_val_set(input_file,"MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT%STEP_START_VAL",& 00479 i_val=myi,error=error) 00480 CALL set_restart_info("ROT_OPT COUNTERS",restarted_infos,error) 00481 END IF 00482 END IF 00483 ! 00484 IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT",error)) THEN 00485 ! CELL_OPT 00486 CALL section_vals_val_get(restart_file,"MOTION%CELL_OPT%STEP_START_VAL",i_val=myi,error=error) 00487 CALL section_vals_val_set(input_file,"MOTION%CELL_OPT%STEP_START_VAL",i_val=myi,error=error) 00488 CALL set_restart_info("CELL_OPT COUNTERS",restarted_infos,error) 00489 END IF 00490 ! 00491 IF (check_restart(input_file, restart_file, "OPTIMIZE_INPUT",error)) THEN 00492 CALL section_vals_val_get(restart_file,"OPTIMIZE_INPUT%ITER_START_VAL",i_val=myi,error=error) 00493 CALL section_vals_val_set(input_file,"OPTIMIZE_INPUT%ITER_START_VAL",i_val=myi,error=error) 00494 CALL set_restart_info("OPTIMIZE_INPUT ITERATION NUMBER",restarted_infos,error) 00495 END IF 00496 ! 00497 IF (check_restart(input_file, restart_file, "MOTION%PINT",error)) THEN 00498 ! PINT 00499 CALL section_vals_val_get(restart_file,"MOTION%PINT%ITERATION",i_val=myi,error=error) 00500 CALL section_vals_val_set(input_file,"MOTION%PINT%ITERATION",i_val=myi,error=error) 00501 CALL set_restart_info("PINT ITERATION NUMBER",restarted_infos,error) 00502 END IF 00503 ! 00504 CALL section_vals_val_get(r_section,"RESTART_METADYNAMICS",l_val=flag2,error=error) 00505 IF (flag2.AND.check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN",error)) THEN 00506 CALL section_vals_val_get(restart_file,& 00507 "MOTION%FREE_ENERGY%METADYN%STEP_START_VAL",i_val=myi,error=error) 00508 CALL section_vals_val_set(input_file,& 00509 "MOTION%FREE_ENERGY%METADYN%STEP_START_VAL",i_val=myi,error=error) 00510 CALL section_vals_val_get(restart_file,& 00511 "MOTION%FREE_ENERGY%METADYN%NHILLS_START_VAL",i_val=myi,error=error) 00512 CALL section_vals_val_set(input_file,& 00513 "MOTION%FREE_ENERGY%METADYN%NHILLS_START_VAL",i_val=myi,error=error) 00514 !RG Adaptive hills 00515 CALL section_vals_val_get(restart_file,& 00516 "MOTION%FREE_ENERGY%METADYN%OLD_HILL_NUMBER",i_val=myi,error=error) 00517 CALL section_vals_val_set(input_file,& 00518 "MOTION%FREE_ENERGY%METADYN%OLD_HILL_NUMBER",i_val=myi,error=error) 00519 CALL section_vals_val_get(restart_file,& 00520 "MOTION%FREE_ENERGY%METADYN%OLD_HILL_STEP",i_val=myi,error=error) 00521 CALL section_vals_val_set(input_file,& 00522 "MOTION%FREE_ENERGY%METADYN%OLD_HILL_STEP",i_val=myi,error=error) 00523 !RG Adaptive hills 00524 CALL set_restart_info("METADYNAMIC COUNTERS",restarted_infos,error) 00525 END IF 00526 END IF 00527 00528 CALL section_vals_val_get(r_section,"RESTART_AVERAGES",l_val=flag,error=error) 00529 IF (flag) THEN 00530 IF (check_restart(input_file, restart_file, "MOTION%MD",error)) THEN 00531 rep_sections => section_vals_get_subs_vals(restart_file,"MOTION%MD%AVERAGES%RESTART_AVERAGES",error=error) 00532 CALL section_vals_set_subs_vals(input_file,"MOTION%MD%AVERAGES%RESTART_AVERAGES",rep_sections,error=error) 00533 CALL set_restart_info("MD AVERAGES",restarted_infos,error) 00534 END IF 00535 END IF 00536 00537 CALL section_vals_val_get(r_section,"RESTART_BAND",l_val=flag,error=error) 00538 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%BAND",error)) THEN 00539 rep_sections => section_vals_get_subs_vals(restart_file,"MOTION%BAND%REPLICA",error=error) 00540 CALL section_vals_set_subs_vals(input_file,"MOTION%BAND%REPLICA",rep_sections,error=error) 00541 CALL set_restart_info("BAND CALCULATION",restarted_infos,error) 00542 END IF 00543 00544 CALL section_vals_val_get(r_section,"RESTART_OPTIMIZE_INPUT_VARIABLES",l_val=flag,error=error) 00545 IF (flag.AND.check_restart(input_file, restart_file, "OPTIMIZE_INPUT%VARIABLE",error)) THEN 00546 rep_sections => section_vals_get_subs_vals(restart_file,"OPTIMIZE_INPUT%VARIABLE",error=error) 00547 CALL section_vals_set_subs_vals(input_file,"OPTIMIZE_INPUT%VARIABLE",rep_sections,error=error) 00548 CALL set_restart_info("OPTIMIZE_INPUT: VARIABLES",restarted_infos,error) 00549 END IF 00550 00551 CALL section_vals_val_get(r_section,"RESTART_BAROSTAT",l_val=flag,error=error) 00552 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%MD%BAROSTAT",error)) THEN 00553 section => section_vals_get_subs_vals(restart_file,& 00554 "MOTION%MD%BAROSTAT%MASS",error=error) 00555 CALL section_vals_set_subs_vals(input_file,"MOTION%MD%BAROSTAT%MASS",& 00556 section,error=error) 00557 section => section_vals_get_subs_vals(restart_file,& 00558 "MOTION%MD%BAROSTAT%VELOCITY",error=error) 00559 CALL section_vals_set_subs_vals(input_file,"MOTION%MD%BAROSTAT%VELOCITY",& 00560 section,error=error) 00561 CALL set_restart_info("BAROSTAT",restarted_infos,error) 00562 END IF 00563 00564 flag = check_restart(input_file, restart_file, "MOTION%MD", error) 00565 IF(flag) THEN 00566 CALL section_vals_val_get(input_file,"MOTION%MD%ENSEMBLE",i_val=ensemble,error=error) 00567 IF(ensemble == npt_i_ensemble .OR. ensemble==npt_f_ensemble) THEN 00568 CALL section_vals_val_get(r_section,"RESTART_BAROSTAT_THERMOSTAT",l_val=flag,error=error) 00569 check = check_restart(input_file, restart_file, "MOTION%MD%BAROSTAT", error) 00570 CALL restart_thermostat(flag, input_file, restart_file, "MOTION%MD%BAROSTAT%THERMOSTAT", & 00571 check=check, error=error) 00572 IF (flag.AND.check) CALL set_restart_info("THERMOSTAT OF BAROSTAT",restarted_infos,error) 00573 END IF 00574 END IF 00575 00576 check = check_restart(input_file, restart_file, "MOTION%MD%SHELL", error) 00577 IF(check) THEN 00578 CALL section_vals_val_get(r_section,"RESTART_SHELL_THERMOSTAT",l_val=flag,error=error) 00579 CALL restart_thermostat(flag, input_file, restart_file, "MOTION%MD%SHELL%THERMOSTAT", error=error) 00580 CALL set_restart_info("SHELL THERMOSTAT",restarted_infos,error) 00581 END IF 00582 00583 CALL section_vals_val_get(r_section,"RESTART_THERMOSTAT",l_val=flag,error=error) 00584 CALL restart_thermostat(flag,input_file, restart_file, "MOTION%MD%THERMOSTAT", error=error) 00585 IF (flag) CALL set_restart_info("PARTICLE THERMOSTAT",restarted_infos,error) 00586 00587 CALL section_vals_val_get(r_section,"RESTART_CONSTRAINT",l_val=flag,error=error) 00588 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%CONSTRAINT",error)) THEN 00589 section => section_vals_get_subs_vals(restart_file,"MOTION%CONSTRAINT",error=error) 00590 CALL section_vals_set_subs_vals(input_file,"MOTION%CONSTRAINT",section,error=error) 00591 CALL set_restart_info("CONSTRAINTS/RESTRAINTS",restarted_infos,error) 00592 END IF 00593 00594 CALL section_vals_val_get(r_section,"RESTART_METADYNAMICS",l_val=flag,error=error) 00595 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN",error)) THEN 00596 section => section_vals_get_subs_vals(restart_file,& 00597 "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_POS",error=error) 00598 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_POS",& 00599 section,error=error) 00600 section => section_vals_get_subs_vals(restart_file,& 00601 "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE",error=error) 00602 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE",& 00603 section,error=error) 00604 section => section_vals_get_subs_vals(restart_file,& 00605 "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT",error=error) 00606 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT",& 00607 section,error=error) 00608 section => section_vals_get_subs_vals(restart_file,& 00609 "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT",error=error) 00610 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT",& 00611 section,error=error) 00612 ! Extended Lagrangian 00613 section => section_vals_get_subs_vals(restart_file,& 00614 "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0",error=error) 00615 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0",& 00616 section,error=error) 00617 section => section_vals_get_subs_vals(restart_file,& 00618 "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP",error=error) 00619 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP",& 00620 section,error=error) 00621 section => section_vals_get_subs_vals(restart_file,& 00622 "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS",error=error) 00623 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS",& 00624 section,error=error) 00625 section => section_vals_get_subs_vals(restart_file,& 00626 "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_FS",error=error) 00627 CALL section_vals_set_subs_vals(input_file,"MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_FS",& 00628 section,error=error) 00629 CALL set_restart_info("METADYNAMICS",restarted_infos,error) 00630 END IF 00631 00632 CALL section_vals_val_get(r_section,"RESTART_WALKERS",l_val=flag,error=error) 00633 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS",error)) THEN 00634 CALL section_vals_val_get(restart_file,"MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS%WALKERS_STATUS",& 00635 i_vals=rwalkers_status, error=error) 00636 ALLOCATE(iwalkers_status(SIZE(rwalkers_status)),stat=stat) 00637 CPPrecondition(stat==0,cp_failure_level,routineP,error,failure) 00638 iwalkers_status = rwalkers_status 00639 CALL section_vals_val_set(input_file,"MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS%WALKERS_STATUS",& 00640 i_vals_ptr=iwalkers_status, error=error) 00641 CALL set_restart_info("WALKERS INFO",restarted_infos,error) 00642 END IF 00643 00644 CALL section_vals_val_get(r_section,"RESTART_DIMER",l_val=flag,error=error) 00645 IF (flag.AND.check_restart(input_file, restart_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER",error)) THEN 00646 section => section_vals_get_subs_vals(restart_file,& 00647 "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%DIMER_VECTOR",error=error) 00648 CALL section_vals_set_subs_vals(input_file,"MOTION%GEO_OPT%TRANSITION_STATE%DIMER%DIMER_VECTOR",& 00649 section,error=error) 00650 CALL set_restart_info("DIMER TRANSITION STATE SEARCH",restarted_infos,error) 00651 END IF 00652 00653 CALL section_vals_val_get(r_section,"CUSTOM_PATH",n_rep_val=n_rep_val,error=error) 00654 DO i_rep_val=1,n_rep_val 00655 CALL section_vals_val_get(r_section,"CUSTOM_PATH",i_rep_val=i_rep_val,c_val=path,error=error) 00656 IF (path/=" ") THEN 00657 section => section_vals_get_subs_vals(restart_file,path,error=error) 00658 CALL section_vals_set_subs_vals(input_file,path,section,error=error) 00659 CALL set_restart_info("USER RESTART: "//TRIM(path),restarted_infos,error) 00660 END IF 00661 END DO 00662 00663 CALL section_vals_val_get(r_section,"RESTART_RTP",l_val=flag,error=error) 00664 ! IF(flag.AND.check_restart(input_file, restart_file, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION",error)) THEN 00665 IF(flag)THEN 00666 section => section_vals_get_subs_vals(restart_file,& 00667 "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION",error=error) 00668 CALL section_vals_val_get(section,"INITIAL_WFN",i_val=myi,error=error) 00669 CALL section_vals_val_set(input_file,"FORCE_EVAL%DFT%REAL_TIME_PROPAGATION%INITIAL_WFN",& 00670 i_val=myi,error=error) 00671 CALL set_restart_info("REAL TIME PROPAGATION",restarted_infos,error) 00672 END IF 00673 00674 ! PIMD 00675 CALL section_vals_val_get(r_section,"RESTART_PINT_POS",l_val=flag,error=error) 00676 IF(flag) THEN 00677 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%BEADS%COORD",error=error) 00678 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%BEADS%COORD",section,error=error) 00679 CALL set_restart_info("PINT BEAD POSITIONS",restarted_infos,error) 00680 END IF 00681 CALL section_vals_val_get(r_section,"RESTART_PINT_VEL",l_val=flag,error=error) 00682 IF(flag) THEN 00683 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%BEADS%VELOCITY",error=error) 00684 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%BEADS%VELOCITY",section,error=error) 00685 CALL set_restart_info("PINT BEAD VELOCITIES",restarted_infos,error) 00686 END IF 00687 CALL section_vals_val_get(r_section,"RESTART_PINT_NOSE",l_val=flag,error=error) 00688 IF(flag) THEN 00689 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%NOSE%COORD",error=error) 00690 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%NOSE%COORD",section,error=error) 00691 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%NOSE%VELOCITY",error=error) 00692 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%NOSE%VELOCITY",section,error=error) 00693 CALL set_restart_info("PINT NOSE THERMOSTAT",restarted_infos,error) 00694 END IF 00695 CALL section_vals_val_get(r_section,"RESTART_PINT_GLE",l_val=flag,error=error) 00696 IF(flag) THEN 00697 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%GLE",error=error) 00698 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%GLE",section,error=error) 00699 CALL set_restart_info("PINT GLE THERMOSTAT",restarted_infos,error) 00700 END IF 00701 00702 00703 ! PIMC 00704 ! 00705 CALL section_vals_val_get(r_section,"RESTART_HELIUM_POS",l_val=flag,error=error) 00706 IF(flag) THEN 00707 CALL section_vals_val_get(input_file,"MOTION%PINT%HELIUM%NUM_ENV",& 00708 explicit=explicit1, error=error) 00709 IF ( .NOT. explicit1 ) THEN 00710 CALL section_vals_val_get(restart_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00711 CALL section_vals_val_set(input_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00712 END IF 00713 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%HELIUM%COORD",error=error) 00714 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%HELIUM%COORD",section,error=error) 00715 CALL set_restart_info("HELIUM BEAD POSITIONS",restarted_infos,error) 00716 END IF 00717 ! 00718 CALL section_vals_val_get(r_section,"RESTART_HELIUM_PERMUTATION",l_val=flag,error=error) 00719 IF(flag) THEN 00720 CALL section_vals_val_get(input_file,"MOTION%PINT%HELIUM%NUM_ENV",& 00721 explicit=explicit1, error=error) 00722 IF ( .NOT. explicit1 ) THEN 00723 CALL section_vals_val_get(restart_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00724 CALL section_vals_val_set(input_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00725 END IF 00726 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%HELIUM%PERM",error=error) 00727 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%HELIUM%PERM",section,error=error) 00728 CALL set_restart_info("HELIUM PERMUTATION STATE",restarted_infos,error) 00729 END IF 00730 ! 00731 CALL section_vals_val_get(r_section,"RESTART_HELIUM_FORCE",l_val=flag,error=error) 00732 IF(flag) THEN 00733 CALL section_vals_val_get(input_file,"MOTION%PINT%HELIUM%NUM_ENV",& 00734 explicit=explicit1, error=error) 00735 IF ( .NOT. explicit1 ) THEN 00736 CALL section_vals_val_get(restart_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00737 CALL section_vals_val_set(input_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00738 END IF 00739 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%HELIUM%FORCE",error=error) 00740 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%HELIUM%FORCE",section,error=error) 00741 CALL set_restart_info("HELIUM FORCES ON SOLUTE",restarted_infos,error) 00742 END IF 00743 ! 00744 CALL section_vals_val_get(r_section,"RESTART_HELIUM_RNG",l_val=flag,error=error) 00745 IF(flag) THEN 00746 CALL section_vals_val_get(input_file,"MOTION%PINT%HELIUM%NUM_ENV",& 00747 explicit=explicit1, error=error) 00748 IF ( .NOT. explicit1 ) THEN 00749 CALL section_vals_val_get(restart_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00750 CALL section_vals_val_set(input_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00751 END IF 00752 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%HELIUM%RNG_STATE",error=error) 00753 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%HELIUM%RNG_STATE",section,error=error) 00754 CALL set_restart_info("HELIUM RNG STATE",restarted_infos,error) 00755 END IF 00756 ! 00757 ! 00758 CALL section_vals_val_get(r_section,"RESTART_HELIUM_DENSITIES",l_val=flag,error=error) 00759 IF(flag) THEN 00760 CALL section_vals_val_get(input_file,"MOTION%PINT%HELIUM%NUM_ENV",& 00761 explicit=explicit1, error=error) 00762 IF ( .NOT. explicit1 ) THEN 00763 CALL section_vals_val_get(restart_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00764 CALL section_vals_val_set(input_file,"MOTION%PINT%HELIUM%NUM_ENV",i_val=myi,error=error) 00765 END IF 00766 section => section_vals_get_subs_vals(restart_file,"MOTION%PINT%HELIUM%RHO",error=error) 00767 CALL section_vals_set_subs_vals(input_file,"MOTION%PINT%HELIUM%RHO",section,error=error) 00768 CALL set_restart_info("HELIUM DENSITIES",restarted_infos,error) 00769 END IF 00770 ! 00771 CALL section_vals_val_set(r_section,"RESTART_FILE_NAME", c_val=" ",error=error) 00772 CALL section_vals_release(restart_file,error=error) 00773 CALL release_restart_info(restarted_infos, r_file_path, binary_restart_file,& 00774 output_unit, error) 00775 END IF 00776 END IF 00777 CALL timestop(handle) 00778 END SUBROUTINE handle_ext_restart 00779 00780 ! ***************************************************************************** 00784 SUBROUTINE set_restart_info(label, restarted_infos, error) 00785 00786 CHARACTER(LEN=*), INTENT(IN) :: label 00787 CHARACTER(LEN=default_string_length), 00788 DIMENSION(:), POINTER :: restarted_infos 00789 TYPE(cp_error_type), INTENT(inout) :: error 00790 00791 CHARACTER(len=*), PARAMETER :: routineN = 'set_restart_info', 00792 routineP = moduleN//':'//routineN 00793 00794 INTEGER :: isize 00795 LOGICAL :: failure 00796 00797 failure = .FALSE. 00798 isize = 0 00799 IF (ASSOCIATED(restarted_infos)) isize = SIZE(restarted_infos) 00800 isize = isize + 1 00801 CALL reallocate(restarted_infos,1,isize) 00802 restarted_infos(isize) = TRIM(label) 00803 00804 END SUBROUTINE set_restart_info 00805 00806 ! ***************************************************************************** 00810 SUBROUTINE release_restart_info(restarted_infos, r_file_path,& 00811 binary_restart_file, output_unit, error) 00812 CHARACTER(LEN=default_string_length), 00813 DIMENSION(:), POINTER :: restarted_infos 00814 CHARACTER(LEN=*), INTENT(IN) :: r_file_path, 00815 binary_restart_file 00816 INTEGER, INTENT(IN) :: output_unit 00817 TYPE(cp_error_type), INTENT(inout) :: error 00818 00819 CHARACTER(len=*), PARAMETER :: routineN = 'release_restart_info', 00820 routineP = moduleN//':'//routineN 00821 00822 INTEGER :: i, j, stat 00823 LOGICAL :: failure 00824 00825 failure = .FALSE. 00826 IF (output_unit>0.AND.ASSOCIATED(restarted_infos)) THEN 00827 WRITE(output_unit,'(1X,79("*"))') 00828 WRITE(output_unit,'(1X,"*",T30,A,T80,"*")')" RESTART INFORMATION " 00829 WRITE(output_unit,'(1X,79("*"))') 00830 WRITE(output_unit,'(1X,"*",T80,"*")') 00831 i = 1 00832 WRITE(output_unit,'(1X,"*",A,T26,A,T80,"*")')" RESTART FILE NAME: ",& 00833 r_file_path(53*(i-1)+1:53*i) 00834 DO i = 2, CEILING(REAL(LEN_TRIM(r_file_path),KIND=dp)/53.0_dp) 00835 WRITE(output_unit,'(T1,1X,"*",T26,A,T80,"*")')r_file_path(53*(i-1)+1:53*i) 00836 END DO 00837 IF (LEN_TRIM(binary_restart_file) > 0) THEN 00838 i = 1 00839 WRITE (output_unit,'(1X,"*",A,T26,A,T80,"*")')" BINARY RESTART FILE: ",& 00840 binary_restart_file(53*(i-1)+1:53*i) 00841 DO i = 2, CEILING(REAL(LEN_TRIM(binary_restart_file),KIND=dp)/53.0_dp) 00842 WRITE(output_unit,'(T1,1X,"*",T26,A,T80,"*")') binary_restart_file(53*(i-1)+1:53*i) 00843 END DO 00844 END IF 00845 WRITE(output_unit,'(1X,"*",T80,"*")') 00846 WRITE(output_unit,'(1X,"*", A,T80,"*")')" RESTARTED QUANTITIES: " 00847 DO j = 1, SIZE(restarted_infos) 00848 DO i = 1, CEILING(REAL(LEN_TRIM(restarted_infos(j)),KIND=dp)/53.0_dp) 00849 WRITE(output_unit,'(T1,1X,"*",T26,A,T80,"*")')restarted_infos(j)(53*(i-1)+1:53*i) 00850 END DO 00851 END DO 00852 WRITE(output_unit,'(1X,79("*"),/)') 00853 END IF 00854 IF (ASSOCIATED(restarted_infos)) THEN 00855 DEALLOCATE(restarted_infos,stat=stat) 00856 CPPrecondition(stat==0,cp_failure_level,routineP,error,failure) 00857 END IF 00858 END SUBROUTINE release_restart_info 00859 00860 00861 ! ***************************************************************************** 00868 SUBROUTINE restart_thermostat(flag, input_file, restart_file, path, check, error) 00869 LOGICAL, INTENT(IN) :: flag 00870 TYPE(section_vals_type), POINTER :: input_file, restart_file 00871 CHARACTER(LEN=*), INTENT(IN) :: path 00872 LOGICAL, INTENT(IN), OPTIONAL :: check 00873 TYPE(cp_error_type), INTENT(inout) :: error 00874 00875 CHARACTER(len=*), PARAMETER :: routineN = 'restart_thermostat', 00876 routineP = moduleN//':'//routineN 00877 00878 INTEGER :: input_region, input_type, 00879 restart_region, restart_type 00880 LOGICAL :: check_loc, failure, 00881 skip_other_checks 00882 TYPE(section_vals_type), POINTER :: section 00883 00884 failure = .FALSE. 00885 check_loc = check_restart(input_file, restart_file, TRIM(path), error) 00886 skip_other_checks = PRESENT(check) 00887 IF (skip_other_checks) check_loc = check 00888 IF (flag.AND.check_loc) THEN 00889 ! Let's check if the thermostat type is different otherwise it does not make any 00890 ! sense to do any kind of restart 00891 CALL section_vals_val_get(input_file,TRIM(path)//"%TYPE",i_val=input_type,error=error) 00892 CALL section_vals_val_get(restart_file,TRIM(path)//"%TYPE",i_val=restart_type,error=error) 00893 00894 IF (input_type==do_thermo_same_as_part) THEN 00895 CALL section_vals_val_get(input_file,"MOTION%MD%THERMOSTAT%TYPE",i_val=input_type,error=error) 00896 END IF 00897 00898 IF (skip_other_checks) THEN 00899 input_region = do_region_global 00900 restart_region = do_region_global 00901 ELSE 00902 ! Also the regions must be the same.. 00903 CALL section_vals_val_get(input_file,TRIM(path)//"%REGION",i_val=input_region,error=error) 00904 CALL section_vals_val_get(restart_file,TRIM(path)//"%REGION",i_val=restart_region,error=error) 00905 END IF 00906 00907 IF ((input_type==restart_type).AND.(input_region==restart_region)) THEN 00908 SELECT CASE(input_type) 00909 CASE(do_thermo_nose) 00910 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%NOSE%COORD",error=error) 00911 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%NOSE%COORD",section,error=error) 00912 00913 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%NOSE%VELOCITY",error=error) 00914 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%NOSE%VELOCITY",section,error=error) 00915 00916 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%NOSE%MASS",error=error) 00917 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%NOSE%MASS",section,error=error) 00918 00919 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%NOSE%FORCE",error=error) 00920 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%NOSE%FORCE",section,error=error) 00921 CASE(do_thermo_csvr) 00922 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%CSVR%THERMOSTAT_ENERGY",error=error) 00923 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%CSVR%THERMOSTAT_ENERGY",section,error=error) 00924 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%CSVR%RNG_INIT",error=error) 00925 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%CSVR%RNG_INIT",section,error=error) 00926 CASE(do_thermo_gle) 00927 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%GLE%THERMOSTAT_ENERGY",error=error) 00928 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%GLE%THERMOSTAT_ENERGY",section,error=error) 00929 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%GLE%RNG_INIT",error=error) 00930 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%GLE%RNG_INIT",section,error=error) 00931 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%GLE%S",error=error) 00932 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%GLE%S",section,error=error) 00933 CASE(do_thermo_al) 00934 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%AD_LANGEVIN%CHI",error=error) 00935 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%AD_LANGEVIN%CHI",section,error=error) 00936 section => section_vals_get_subs_vals(restart_file,TRIM(path)//"%AD_LANGEVIN%MASS",error=error) 00937 CALL section_vals_set_subs_vals(input_file,TRIM(path)//"%AD_LANGEVIN%MASS",section,error=error) 00938 END SELECT 00939 ELSE 00940 CALL cp_assert((input_type==restart_type),cp_warning_level,cp_assertion_failed,routineP,& 00941 "Requested to restart thermostat: "//TRIM(path)//". The thermostat "//& 00942 "specified in the input file and the information present in the restart "//& 00943 "file do not match the same type of thermostat! Restarting is not possible! "//& 00944 "Thermostat will not be restarted! "//& 00945 CPSourceFileRef,& 00946 only_ionode=.TRUE.) 00947 CALL cp_assert((input_region==restart_region),cp_warning_level,cp_assertion_failed,routineP,& 00948 "Requested to restart thermostat: "//TRIM(path)//". The thermostat "//& 00949 "specified in the input file and the information present in the restart "//& 00950 "file do not match the same type of REGION! Restarting is not possible! "//& 00951 "Thermostat will not be restarted! "//& 00952 CPSourceFileRef,& 00953 only_ionode=.TRUE.) 00954 END IF 00955 END IF 00956 END SUBROUTINE restart_thermostat 00957 00958 ! ***************************************************************************** 00965 FUNCTION check_restart(input_file, restart_file, tag_section, error) RESULT(do_restart) 00966 TYPE(section_vals_type), POINTER :: input_file, restart_file 00967 CHARACTER(LEN=*), INTENT(IN) :: tag_section 00968 TYPE(cp_error_type), INTENT(inout) :: error 00969 LOGICAL :: do_restart 00970 00971 CHARACTER(len=*), PARAMETER :: routineN = 'check_restart', 00972 routineP = moduleN//':'//routineN 00973 00974 INTEGER :: handle 00975 LOGICAL :: explicit1, explicit2, failure 00976 TYPE(section_vals_type), POINTER :: work_section 00977 00978 CALL timeset(routineN,handle) 00979 failure=.FALSE. 00980 NULLIFY(work_section) 00981 IF (.NOT. failure) THEN 00982 work_section => section_vals_get_subs_vals(input_file,TRIM(tag_section),error=error) 00983 CALL section_vals_get(work_section,explicit=explicit1,error=error) 00984 work_section => section_vals_get_subs_vals(restart_file,TRIM(tag_section),error=error) 00985 CALL section_vals_get(work_section,explicit=explicit2,error=error) 00986 00987 do_restart = explicit1.AND.explicit2 00988 END IF 00989 CALL timestop(handle) 00990 END FUNCTION check_restart 00991 00992 ! ***************************************************************************** 01000 SUBROUTINE remove_restart_info(input_file,error) 01001 TYPE(section_vals_type), POINTER :: input_file 01002 TYPE(cp_error_type), INTENT(inout) :: error 01003 01004 CHARACTER(len=*), PARAMETER :: routineN = 'remove_restart_info', 01005 routineP = moduleN//':'//routineN 01006 01007 INTEGER :: handle, iforce_eval, 01008 nforce_eval1 01009 LOGICAL :: explicit1, failure 01010 TYPE(section_vals_type), POINTER :: md_section, motion_section, 01011 section1, section_to_delete, 01012 sections1, work_section 01013 01014 CALL timeset(routineN,handle) 01015 01016 failure=.FALSE. 01017 NULLIFY(work_section) 01018 IF (.NOT. failure) THEN 01019 section_to_delete => section_vals_get_subs_vals(input_file,"EXT_RESTART",error=error) 01020 CALL section_vals_remove_values(section_to_delete,error) 01021 sections1 => section_vals_get_subs_vals(input_file,"FORCE_EVAL",error=error) 01022 CALL section_vals_get(sections1, n_repetition=nforce_eval1, error=error) 01023 01024 DO iforce_eval = 1, nforce_eval1 01025 section1 => section_vals_get_subs_vals3(sections1,"SUBSYS",i_rep_section=iforce_eval,error=error) 01026 section_to_delete => section_vals_get_subs_vals(section1,"COORD",error=error) 01027 CALL section_vals_remove_values(section_to_delete,error) 01028 section_to_delete => section_vals_get_subs_vals(section1,"VELOCITY",error=error) 01029 CALL section_vals_remove_values(section_to_delete,error) 01030 END DO 01031 01032 motion_section => section_vals_get_subs_vals(input_file,"MOTION",error=error) 01033 md_section => section_vals_get_subs_vals(motion_section,"MD",error=error) 01034 CALL section_vals_get(md_section,explicit=explicit1,error=error) 01035 IF (explicit1) THEN 01036 CALL section_vals_val_unset(md_section,"STEP_START_VAL",error=error) 01037 CALL section_vals_val_unset(md_section,"TIME_START_VAL",error=error) 01038 CALL section_vals_val_unset(md_section,"ECONS_START_VAL",error=error) 01039 END IF 01040 work_section => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN",error=error) 01041 CALL section_vals_get(work_section,explicit=explicit1,error=error) 01042 IF (explicit1) THEN 01043 CALL section_vals_val_unset(motion_section,"FREE_ENERGY%METADYN%STEP_START_VAL",error=error) 01044 CALL section_vals_val_unset(motion_section,"FREE_ENERGY%METADYN%NHILLS_START_VAL",error=error) 01045 END IF 01046 section_to_delete => section_vals_get_subs_vals(motion_section,"BAND%REPLICA",error=error) 01047 CALL section_vals_remove_values(section_to_delete,error) 01048 section_to_delete => section_vals_get_subs_vals(md_section,"AVERAGES%RESTART_AVERAGES",error=error) 01049 CALL section_vals_remove_values(section_to_delete,error) 01050 section_to_delete => section_vals_get_subs_vals(md_section,"THERMOSTAT%NOSE%COORD",error=error) 01051 CALL section_vals_remove_values(section_to_delete,error) 01052 section_to_delete => section_vals_get_subs_vals(md_section,"THERMOSTAT%NOSE%VELOCITY",error=error) 01053 CALL section_vals_remove_values(section_to_delete,error) 01054 section_to_delete => section_vals_get_subs_vals(md_section,"THERMOSTAT%NOSE%MASS",error=error) 01055 CALL section_vals_remove_values(section_to_delete,error) 01056 section_to_delete => section_vals_get_subs_vals(md_section,"THERMOSTAT%NOSE%FORCE",error=error) 01057 CALL section_vals_remove_values(section_to_delete,error) 01058 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%MASS",error=error) 01059 CALL section_vals_remove_values(section_to_delete,error) 01060 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%VELOCITY",error=error) 01061 CALL section_vals_remove_values(section_to_delete,error) 01062 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%THERMOSTAT%NOSE%COORD",error=error) 01063 CALL section_vals_remove_values(section_to_delete,error) 01064 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%THERMOSTAT%NOSE%VELOCITY",error=error) 01065 CALL section_vals_remove_values(section_to_delete,error) 01066 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%THERMOSTAT%NOSE%MASS",error=error) 01067 CALL section_vals_remove_values(section_to_delete,error) 01068 section_to_delete => section_vals_get_subs_vals(md_section,"BAROSTAT%THERMOSTAT%NOSE%FORCE",error=error) 01069 CALL section_vals_remove_values(section_to_delete,error) 01070 section_to_delete => section_vals_get_subs_vals(md_section,"SHELL%THERMOSTAT%NOSE%COORD",error=error) 01071 CALL section_vals_remove_values(section_to_delete,error) 01072 section_to_delete => section_vals_get_subs_vals(md_section,"SHELL%THERMOSTAT%NOSE%VELOCITY",error=error) 01073 CALL section_vals_remove_values(section_to_delete,error) 01074 section_to_delete => section_vals_get_subs_vals(md_section,"SHELL%THERMOSTAT%NOSE%MASS",error=error) 01075 CALL section_vals_remove_values(section_to_delete,error) 01076 section_to_delete => section_vals_get_subs_vals(md_section,"SHELL%THERMOSTAT%NOSE%FORCE",error=error) 01077 CALL section_vals_remove_values(section_to_delete,error) 01078 ! Constrained/Restrained section 01079 section_to_delete => section_vals_get_subs_vals(motion_section,"CONSTRAINT%FIX_ATOM_RESTART",error=error) 01080 CALL section_vals_remove_values(section_to_delete,error) 01081 section_to_delete => section_vals_get_subs_vals(motion_section,"CONSTRAINT%COLVAR_RESTART",error=error) 01082 CALL section_vals_remove_values(section_to_delete,error) 01083 ! Free energies restarts 01084 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%SPAWNED_HILLS_POS",error=error) 01085 CALL section_vals_remove_values(section_to_delete,error) 01086 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE",error=error) 01087 CALL section_vals_remove_values(section_to_delete,error) 01088 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT",error=error) 01089 CALL section_vals_remove_values(section_to_delete,error) 01090 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT",error=error) 01091 CALL section_vals_remove_values(section_to_delete,error) 01092 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0",error=error) 01093 CALL section_vals_remove_values(section_to_delete,error) 01094 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP",error=error) 01095 CALL section_vals_remove_values(section_to_delete,error) 01096 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%EXT_LAGRANGE_SS",error=error) 01097 CALL section_vals_remove_values(section_to_delete,error) 01098 section_to_delete => section_vals_get_subs_vals(motion_section,"FREE_ENERGY%METADYN%EXT_LAGRANGE_FS",error=error) 01099 CALL section_vals_remove_values(section_to_delete,error) 01100 END IF 01101 CALL timestop(handle) 01102 END SUBROUTINE remove_restart_info 01103 01104 ! ***************************************************************************** 01111 SUBROUTINE handle_defaults_restart(r_section,error) 01112 TYPE(section_vals_type), POINTER :: r_section 01113 TYPE(cp_error_type), INTENT(inout) :: error 01114 01115 CHARACTER(len=*), PARAMETER :: routineN = 'handle_defaults_restart', 01116 routineP = moduleN//':'//routineN 01117 01118 INTEGER :: handle, ik, nval 01119 LOGICAL :: failure, restart_default 01120 TYPE(keyword_type), POINTER :: keyword 01121 TYPE(section_type), POINTER :: section 01122 01123 CALL timeset(routineN,handle) 01124 failure=.FALSE. 01125 IF (.NOT. failure) THEN 01126 NULLIFY(keyword, section) 01127 CALL section_vals_get(r_section, section=section, error=error) 01128 CALL section_vals_val_get(r_section,"RESTART_DEFAULT",l_val=restart_default,error=error) 01129 DO ik=-1,section%n_keywords 01130 keyword => section%keywords(ik)%keyword 01131 IF (ASSOCIATED(keyword)) THEN 01132 IF (keyword%type_of_var==logical_t.AND.keyword%names(1)(1:8)=="RESTART_") THEN 01133 IF (TRIM(keyword%names(1))=="RESTART_DEFAULT") CYCLE 01134 CALL section_vals_val_get(r_section,keyword%names(1),n_rep_val=nval,error=error) 01135 IF (nval==0) THEN 01136 ! User didn't specify any value, use the value of the RESTART_DEFAULT keyword.. 01137 CALL section_vals_val_set(r_section,keyword%names(1),l_val=restart_default,error=error) 01138 END IF 01139 END IF 01140 END IF 01141 END DO 01142 END IF 01143 CALL timestop(handle) 01144 01145 END SUBROUTINE handle_defaults_restart 01146 01147 END MODULE input_cp2k_check
1.7.3