LCOV - code coverage report
Current view: top level - src/tmc - input_cp2k_tmc.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:42dac4a) Lines: 100.0 % 216 216
Test Date: 2025-07-25 12:55:17 Functions: 100.0 % 6 6

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \par History
      10              : !>      06.2013 split input_cp2k into smaller modules
      11              : !> \author Mandes
      12              : ! **************************************************************************************************
      13              : MODULE input_cp2k_tmc
      14              :    USE bibliography,                    ONLY: Schonherr2014
      15              :    USE input_cp2k_mm,                   ONLY: create_CHARGE_section
      16              :    USE input_keyword_types,             ONLY: keyword_create,&
      17              :                                               keyword_release,&
      18              :                                               keyword_type
      19              :    USE input_section_types,             ONLY: section_add_keyword,&
      20              :                                               section_add_subsection,&
      21              :                                               section_create,&
      22              :                                               section_release,&
      23              :                                               section_type
      24              :    USE input_val_types,                 ONLY: char_t,&
      25              :                                               integer_t,&
      26              :                                               real_t
      27              :    USE kinds,                           ONLY: dp
      28              :    USE tmc_stati,                       ONLY: tmc_default_dot_file_name,&
      29              :                                               tmc_default_unspecified_name
      30              : #include "../base/base_uses.f90"
      31              : 
      32              :    IMPLICIT NONE
      33              :    PRIVATE
      34              : 
      35              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      36              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_tmc'
      37              : 
      38              :    PUBLIC :: create_TMC_section
      39              : 
      40              : CONTAINS
      41              : 
      42              : ! **************************************************************************************************
      43              : !> \brief creates the TreeMonteCarlo subsection
      44              : !> \param section the section to be created
      45              : !> \author Mandes
      46              : ! **************************************************************************************************
      47         9238 :    SUBROUTINE create_TMC_section(section)
      48              :       TYPE(section_type), POINTER                        :: section
      49              : 
      50              :       TYPE(keyword_type), POINTER                        :: keyword
      51              :       TYPE(section_type), POINTER                        :: subsection
      52              : 
      53         9238 :       CPASSERT(.NOT. ASSOCIATED(section))
      54              :       CALL section_create( &
      55              :          section, __LOCATION__, name="TMC", &
      56              :          description="A parallelized MC algorithm, presampling the configurations, espacially the Markov chain elements", &
      57              :          citations=(/Schonherr2014/), &
      58        18476 :          n_keywords=1, n_subsections=1, repeats=.FALSE.)
      59              : 
      60         9238 :       NULLIFY (keyword, subsection)
      61              : 
      62              :       ! size of a group calculating the exact energy
      63              :       CALL keyword_create(keyword, __LOCATION__, &
      64              :                           name="GROUP_ENERGY_SIZE", &
      65              :                           description="amount of CPUs per group for energy calculation", &
      66              :                           usage="GROUP_ENERGY_SIZE {INTEGER}", &
      67         9238 :                           default_i_val=1)
      68         9238 :       CALL section_add_keyword(section, keyword)
      69         9238 :       CALL keyword_release(keyword)
      70              : 
      71              :       ! size of a group calculating the exact energy
      72              :       CALL keyword_create(keyword, __LOCATION__, &
      73              :                           name="GROUP_ENERGY_NR", &
      74              :                           description="amount of groups for exact energy calculation", &
      75              :                           usage="GROUP_ENERGY_NR {INTEGER}", &
      76         9238 :                           default_i_val=1)
      77         9238 :       CALL section_add_keyword(section, keyword)
      78         9238 :       CALL keyword_release(keyword)
      79              : 
      80              :       ! size of a group calculating the exact energy
      81              :       CALL keyword_create(keyword, __LOCATION__, &
      82              :                           name="GROUP_CC_SIZE", &
      83              :                           description="amount of of CPUs per group for configurational change", &
      84              :                           usage="GROUP_CC_SIZE {INTEGER}", &
      85         9238 :                           default_i_val=0)
      86         9238 :       CALL section_add_keyword(section, keyword)
      87         9238 :       CALL keyword_release(keyword)
      88              : 
      89              :       ! size of a group calculating the exact energy
      90              :       CALL keyword_create(keyword, __LOCATION__, &
      91              :                           name="GROUP_ANALYSIS_NR", &
      92              :                           description="amount of groups (cores) for analysing the configurations", &
      93              :                           usage="GROUP_ANALYSIS_NR {INTEGER}", &
      94         9238 :                           default_i_val=1, lone_keyword_i_val=1)
      95         9238 :       CALL section_add_keyword(section, keyword)
      96         9238 :       CALL keyword_release(keyword)
      97              : 
      98              :       CALL keyword_create(keyword, __LOCATION__, &
      99              :                           name="NUM_MC_ELEM", &
     100              :                           description="the minimum Markov Chain elements, to be sampled", &
     101              :                           usage="NUM_MC_ELEM {INTEGER}", &
     102         9238 :                           default_i_val=-1)
     103         9238 :       CALL section_add_keyword(section, keyword)
     104         9238 :       CALL keyword_release(keyword)
     105              : 
     106              :       ! the start value for the random number generator
     107              :       CALL keyword_create(keyword, __LOCATION__, &
     108              :                           name="RND_DETERMINISTIC", &
     109              :                           description="the initialisation number for the random number generator", &
     110              :                           usage="RND_DETERMINISTIC {INTEGER}", &
     111         9238 :                           default_i_val=-1)
     112         9238 :       CALL section_add_keyword(section, keyword)
     113         9238 :       CALL keyword_release(keyword)
     114              : 
     115              :       CALL keyword_create(keyword, __LOCATION__, &
     116              :                           name="TASK_TYPE", &
     117              :                           description="Select specialized types. Selectable: "// &
     118              :                           "IDEAL_GAS (constant configuration energy E=0.0)", &
     119              :                           usage="TASK_TYPE {OPTION}", &
     120         9238 :                           default_c_val="", lone_keyword_c_val=tmc_default_unspecified_name)
     121         9238 :       CALL section_add_keyword(section, keyword)
     122         9238 :       CALL keyword_release(keyword)
     123              : 
     124              :       CALL keyword_create(keyword, __LOCATION__, &
     125              :                           name="NR_TEMPERATURE", &
     126              :                           description="the number of different temperature for parallel tempering", &
     127              :                           usage="NR_TEMPERATURE {INTEGER}", &
     128         9238 :                           default_i_val=1)
     129         9238 :       CALL section_add_keyword(section, keyword)
     130         9238 :       CALL keyword_release(keyword)
     131              : 
     132              :       CALL keyword_create(keyword, __LOCATION__, &
     133              :                           name="TEMPERATURE", &
     134              :                           description="one temperature OR for parallel tempering: "// &
     135              :                           "Tmin Tmax or each temperature T1 T2 T3 ..."// &
     136              :                           " If every single temperature is specified, "// &
     137              :                           "do NOT use keyword NR_TEMPERATURE", &
     138              :                           usage="TEMPERATURE {REAL} |OR| TEMPERATURE {REAL} {REAL} ...", &
     139              :                           default_r_vals=(/330.0_dp/), &
     140         9238 :                           n_var=-1, type_of_var=real_t)
     141         9238 :       CALL section_add_keyword(section, keyword)
     142         9238 :       CALL keyword_release(keyword)
     143              : 
     144              :       CALL keyword_create(keyword, __LOCATION__, &
     145              :                           name="NUM_MV_ELEM_IN_CELL", &
     146              :                           description="the number of elements (atoms or molecules) "// &
     147              :                           "moves in cell or sub box. "// &
     148              :                           "if 0 all elements are moved once in a MC move", &
     149              :                           usage="NUM_MV_ELEM_IN_CELL {INTEGER}", &
     150         9238 :                           default_i_val=0)
     151         9238 :       CALL section_add_keyword(section, keyword)
     152         9238 :       CALL keyword_release(keyword)
     153              : 
     154              : !       CALL keyword_create(keyword, __LOCATION__,&
     155              : !            name="NR_NMC_STEPS",&
     156              : !            description="the number of Nested Mont Carlo moves with in one MC move "//&
     157              : !                        "should be huge enough to reach euilibrium state", &
     158              : !            usage="NR_NMC_STEPS {INTEGER}",&
     159              : !            default_i_val=-1)
     160              : !       CALL section_add_keyword(section,keyword)
     161              : !       CALL keyword_release(keyword)
     162              : 
     163              :       ! the moves MOVE_TYPE on exact potential
     164         9238 :       CALL create_TMC_move_type_section(subsection)
     165         9238 :       CALL section_add_subsection(section, subsection)
     166         9238 :       CALL section_release(subsection)
     167              : 
     168              :       ! the moves MOVE_TYPE on approx potential
     169         9238 :       CALL create_TMC_NMC_move_type_section(subsection)
     170         9238 :       CALL section_add_subsection(section, subsection)
     171         9238 :       CALL section_release(subsection)
     172              : 
     173              :       CALL keyword_create(keyword, __LOCATION__, &
     174              :                           name="SUB_BOX", &
     175              :                           description="specifies the size ot the sub box. "// &
     176              :                           "Standard moves only within subbox of random position, "// &
     177              :                           "to compensate the potential difference of the approximate potential.", &
     178              :                           usage="SUB_BOX {REAL} {REAL} {REAL} OR SUB_BOX {REAL} for cubic", &
     179              :                           default_r_vals=(/-1.0_dp/), &
     180         9238 :                           n_var=-1, type_of_var=real_t)
     181         9238 :       CALL section_add_keyword(section, keyword)
     182         9238 :       CALL keyword_release(keyword)
     183              : 
     184              :       CALL keyword_create(keyword, __LOCATION__, &
     185              :                           name="PRESSURE", &
     186              :                           description="enables NPT calculation with specified constant pressure [bar]", &
     187              :                           usage="PRESSURE {REAL}", &
     188         9238 :                           default_r_val=-1.0_dp)
     189         9238 :       CALL section_add_keyword(section, keyword)
     190         9238 :       CALL keyword_release(keyword)
     191              : 
     192              :       CALL keyword_create(keyword, __LOCATION__, &
     193              :                           name="VOLUME_ISOTROPIC", &
     194              :                           description="volume move is equal in each direction", &
     195              :                           usage="VOLUME_ISOTROPIC {LOGICAL}", &
     196         9238 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     197         9238 :       CALL section_add_keyword(section, keyword)
     198         9238 :       CALL keyword_release(keyword)
     199              : 
     200              :       CALL keyword_create(keyword, __LOCATION__, &
     201              :                           name="MOVE_CENTER_OF_MASS", &
     202              :                           description="Moves the center of mass of defined molecules (in volume moves)", &
     203              :                           usage="MOVE_CENTER_OF_MASS {LOGICAL}", &
     204         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     205         9238 :       CALL section_add_keyword(section, keyword)
     206         9238 :       CALL keyword_release(keyword)
     207              : 
     208              :       CALL keyword_create(keyword, __LOCATION__, &
     209              :                           name="ESIMATE_ACC_PROB", &
     210              :                           description="set the estimation of the acceptance probability using run time information of the energy", &
     211              :                           usage="ESIMATE_ACC_PROB {LOGICAL}", &
     212         9238 :                           default_l_val=.TRUE.)
     213         9238 :       CALL section_add_keyword(section, keyword)
     214         9238 :       CALL keyword_release(keyword)
     215              : 
     216              :       CALL keyword_create(keyword, __LOCATION__, &
     217              :                           name="SPECULATIVE_CANCELING", &
     218              :                           description="enables or disables the speculative canceling. If we have further knowledge of "// &
     219              :                           "acceptance probabilities using parent acceptance or the estimated energy.", &
     220              :                           usage="SPECULATIVE_CANCELING {LOGICAL}", &
     221         9238 :                           default_l_val=.TRUE.)
     222         9238 :       CALL section_add_keyword(section, keyword)
     223         9238 :       CALL keyword_release(keyword)
     224              : 
     225              :       CALL keyword_create(keyword, __LOCATION__, &
     226              :                           name="USE_SCF_ENERGY_INFO", &
     227              :                           description="enables or disables the usage of SCF energy information for "// &
     228              :                           "estimating the acceptance probability.", &
     229              :                           usage="USE_SCF_ENERGY_INFO {LOGICAL}", &
     230         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     231         9238 :       CALL section_add_keyword(section, keyword)
     232         9238 :       CALL keyword_release(keyword)
     233              : 
     234              :       CALL keyword_create(keyword, __LOCATION__, &
     235              :                           name="RESULT_LIST_IN_MEMORY", &
     236              :                           description="enables the storing of the whole Markov Chain", &
     237              :                           usage="RESULT_LIST_IN_MEMORY {LOGICAL}", &
     238         9238 :                           default_l_val=.FALSE.)
     239         9238 :       CALL section_add_keyword(section, keyword)
     240         9238 :       CALL keyword_release(keyword)
     241              : 
     242              :       CALL keyword_create(keyword, __LOCATION__, &
     243              :                           name="INFO_OUT_STEP_SIZE", &
     244              :                           description="the number the amount of calculated configurations between to output printings.", &
     245              :                           usage="INFO_OUT_STEP_SIZE {INTEGER}", &
     246         9238 :                           default_i_val=1)
     247         9238 :       CALL section_add_keyword(section, keyword)
     248         9238 :       CALL keyword_release(keyword)
     249              : 
     250              :       CALL keyword_create(keyword, __LOCATION__, &
     251              :                           name="RESTART_IN", &
     252              :                           description="if existing use the last restart file", &
     253              :                           usage="RESTART_IN {FILENAME}", &
     254         9238 :                           default_c_val="", lone_keyword_c_val=tmc_default_unspecified_name)
     255         9238 :       CALL section_add_keyword(section, keyword)
     256         9238 :       CALL keyword_release(keyword)
     257              : 
     258              :       CALL keyword_create(keyword, __LOCATION__, &
     259              :                           name="RESTART_OUT", &
     260              :                           description="Defines the frequency to write restart files. "// &
     261              :                           "If no frequency is specified (lone keyword) "// &
     262              :                           "the restart file is written at the end (only). "// &
     263              :                           "If the value is 0, no restart file is written at all. "// &
     264              :                           "The frequency specifies is related "// &
     265              :                           "to the calculated Markov chain elements", &
     266              :                           usage="RESTART_OUT {INTEGER}", &
     267         9238 :                           default_i_val=-1, lone_keyword_i_val=-9)
     268         9238 :       CALL section_add_keyword(section, keyword)
     269         9238 :       CALL keyword_release(keyword)
     270              : 
     271              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_FILE_NAME", &
     272              :                           description="input file name for the exact potential energy calculation.", &
     273              :                           usage="ENERGY_FILE_NAME {filename}", &
     274         9238 :                           default_c_val="")
     275         9238 :       CALL section_add_keyword(section, keyword)
     276         9238 :       CALL keyword_release(keyword)
     277              : 
     278              : !       CALL keyword_create(keyword, __LOCATION__, name="NMC_FILE_NAME",&
     279              : !            description="input file name for the approximate potential for Nested Monte Carlo.",&
     280              : !            usage="NMC_FILE_NAME {filename}",&
     281              : !            default_c_val="",lone_keyword_c_val=tmc_default_unspecified_name)
     282              : !       CALL section_add_keyword(section,keyword)
     283              : !       CALL keyword_release(keyword)
     284              : 
     285              :       CALL keyword_create(keyword, __LOCATION__, &
     286              :                           name="PRINT_ONLY_ACC", &
     287              :                           description="printing only accepted elements of the Markov Chain.", &
     288              :                           usage="PRINT_ONLY_ACC {LOGICAL}", &
     289         9238 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     290         9238 :       CALL section_add_keyword(section, keyword)
     291         9238 :       CALL keyword_release(keyword)
     292              : 
     293              :       CALL keyword_create(keyword, __LOCATION__, &
     294              :                           name="PRINT_COORDS", &
     295              :                           description="printing coordinates of the Markov Chain elements", &
     296              :                           usage="PRINT_COORDS {LOGICAL}", &
     297         9238 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     298         9238 :       CALL section_add_keyword(section, keyword)
     299         9238 :       CALL keyword_release(keyword)
     300              : 
     301              :       CALL keyword_create(keyword, __LOCATION__, &
     302              :                           name="PRINT_FORCES", &
     303              :                           description="printing forces of the Markov Chain elements", &
     304              :                           usage="PRINT_FORCES {LOGICAL}", &
     305         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     306         9238 :       CALL section_add_keyword(section, keyword)
     307         9238 :       CALL keyword_release(keyword)
     308              : 
     309              :       CALL keyword_create(keyword, __LOCATION__, &
     310              :                           name="PRINT_DIPOLE", &
     311              :                           description="enables the calculation and printing the exact cell dipoles"// &
     312              :                           " (only for QS methods)", &
     313              :                           usage="PRINT_DIPOLE {LOGICAL}", &
     314         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     315         9238 :       CALL section_add_keyword(section, keyword)
     316         9238 :       CALL keyword_release(keyword)
     317              : 
     318              :       CALL keyword_create(keyword, __LOCATION__, &
     319              :                           name="PRINT_CELL", &
     320              :                           description="printing the cell vectors of the Markov Chain elements", &
     321              :                           usage="PRINT_CELL {LOGICAL}", &
     322         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     323         9238 :       CALL section_add_keyword(section, keyword)
     324         9238 :       CALL keyword_release(keyword)
     325              : 
     326              :       CALL keyword_create(keyword, __LOCATION__, &
     327              :                           name="PRINT_ENERGIES", &
     328              :                           description="printing the different calculated energies (approximated, scf and exact)", &
     329              :                           usage="PRINT_ENERGIES {LOGICAL}", &
     330         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     331         9238 :       CALL section_add_keyword(section, keyword)
     332         9238 :       CALL keyword_release(keyword)
     333              : 
     334              :       CALL keyword_create(keyword, __LOCATION__, name="DOT_TREE", &
     335              :                           description="file name for GrapgViz dot file", &
     336              :                           usage="DOT_TREE {filename}", &
     337         9238 :                           default_c_val="", lone_keyword_c_val=tmc_default_dot_file_name)
     338         9238 :       CALL section_add_keyword(section, keyword)
     339         9238 :       CALL keyword_release(keyword)
     340              : 
     341              :       CALL keyword_create(keyword, __LOCATION__, name="ALL_CONF_FILE_NAME", &
     342              :                           description="file name for printing every single calculated configuration (e.g. for fitting).", &
     343              :                           usage="ALL_CONF_FILE_NAME {filename}", &
     344         9238 :                           default_lc_val="")
     345         9238 :       CALL section_add_keyword(section, keyword)
     346         9238 :       CALL keyword_release(keyword)
     347              : 
     348              :       CALL keyword_create(keyword, __LOCATION__, &
     349              :                           name="PRINT_TEST_OUTPUT", &
     350              :                           description="printing different values for regtest comparison", &
     351              :                           usage="PRINT_TEST_OUTPUT {LOGICAL}", &
     352         9238 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     353         9238 :       CALL section_add_keyword(section, keyword)
     354         9238 :       CALL keyword_release(keyword)
     355              : 
     356         9238 :       CALL create_TMC_ana_section(subsection)
     357         9238 :       CALL section_add_subsection(section, subsection)
     358         9238 :       CALL section_release(subsection)
     359              : 
     360         9238 :       CALL create_TMC_ana_files(subsection)
     361         9238 :       CALL section_add_subsection(section, subsection)
     362         9238 :       CALL section_release(subsection)
     363              : 
     364         9238 :    END SUBROUTINE create_TMC_section
     365              : 
     366              : ! **************************************************************************************************
     367              : !> \brief creates the TMC section to select the move types performed within the
     368              : !>        NMC (on approximate potential)
     369              : !> \param section the section to be created
     370              : !> \author Mandes
     371              : ! **************************************************************************************************
     372         9238 :    SUBROUTINE create_TMC_NMC_move_type_section(section)
     373              :       TYPE(section_type), POINTER                        :: section
     374              : 
     375              :       TYPE(keyword_type), POINTER                        :: keyword
     376              :       TYPE(section_type), POINTER                        :: subsection
     377              : 
     378         9238 :       NULLIFY (subsection)
     379              : 
     380         9238 :       CPASSERT(.NOT. ASSOCIATED(section))
     381              :       CALL section_create(section, __LOCATION__, name="NMC_MOVES", &
     382              :                           description="This section specifies the TMC move types, "// &
     383              :                           "which are performed within the nested Monte Carlo (NMC). "// &
     384              :                           "thus using the approximate potential.", &
     385         9238 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
     386              : 
     387         9238 :       NULLIFY (keyword)
     388              : 
     389              :       CALL keyword_create(keyword, __LOCATION__, &
     390              :                           name="NR_NMC_STEPS", &
     391              :                           description="the number of Nested Mont Carlo moves with in one MC move "// &
     392              :                           "should be huge enough to reach euilibrium state", &
     393              :                           usage="NR_NMC_STEPS {INTEGER}", &
     394         9238 :                           default_i_val=-1)
     395         9238 :       CALL section_add_keyword(section, keyword)
     396         9238 :       CALL keyword_release(keyword)
     397              : 
     398              :       CALL keyword_create(keyword, __LOCATION__, name="NMC_FILE_NAME", &
     399              :                           description="input file name for the approximate potential for Nested Monte Carlo.", &
     400              :                           usage="NMC_FILE_NAME {filename}", &
     401         9238 :                           default_c_val="", lone_keyword_c_val=tmc_default_unspecified_name)
     402         9238 :       CALL section_add_keyword(section, keyword)
     403         9238 :       CALL keyword_release(keyword)
     404              : 
     405              :       CALL keyword_create(keyword, __LOCATION__, name="PROB", &
     406              :                           description="Defines the probability of the NMC move "// &
     407              :                           "(considering the ration between the selected other moves) "// &
     408              :                           "the probabilities of the move types in the NMC section "// &
     409              :                           "defines only the weight within the NMC steps", &
     410              :                           usage="PROB {real}", type_of_var=real_t, &
     411         9238 :                           default_r_val=1.0_dp)
     412         9238 :       CALL section_add_keyword(section, keyword)
     413         9238 :       CALL keyword_release(keyword)
     414              : 
     415              :       CALL keyword_create(keyword, __LOCATION__, name="INIT_ACC_PROB", &
     416              :                           description="Defines the initial probability of accepting the move. ", &
     417              :                           usage="INIT_ACC_PROB {real}", type_of_var=real_t, &
     418         9238 :                           default_r_val=0.5_dp, n_var=1)
     419         9238 :       CALL section_add_keyword(section, keyword)
     420         9238 :       CALL keyword_release(keyword)
     421              : 
     422              :       ! the moves types
     423         9238 :       CALL create_TMC_move_type_section(subsection)
     424         9238 :       CALL section_add_subsection(section, subsection)
     425         9238 :       CALL section_release(subsection)
     426         9238 :    END SUBROUTINE create_TMC_NMC_move_type_section
     427              : 
     428              : ! **************************************************************************************************
     429              : !> \brief creates the TMC section to select the move types
     430              : !> \param section the section to be created
     431              : !> \author Mandes
     432              : ! **************************************************************************************************
     433        18476 :    SUBROUTINE create_TMC_move_type_section(section)
     434              :       TYPE(section_type), POINTER                        :: section
     435              : 
     436              :       TYPE(keyword_type), POINTER                        :: keyword
     437              : 
     438        18476 :       CPASSERT(.NOT. ASSOCIATED(section))
     439              :       CALL section_create(section, __LOCATION__, name="MOVE_TYPE", &
     440              :                           description="This section specifies the TMC move type, "// &
     441              :                           "and its properties. "// &
     442              :                           "Selectable types are: "// &
     443              :                           "ATOM_TRANS atom translation, "// &
     444              :                           "MOL_TRANS molecule translation, "// &
     445              :                           "MOL_ROT molecule rotation, "// &
     446              :                           "PROT_REORDER proton reordering, "// &
     447              :                           "PT_SWAP Parallel Tempering swap, "// &
     448              :                           "VOL_MOVE volume change, "// &
     449              :                           "ATOM_SWAP swaps two atoms of different type.", &
     450        18476 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
     451              : 
     452        18476 :       NULLIFY (keyword)
     453              : 
     454              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     455              :                           description="The name of the move type described in this section.", &
     456        18476 :                           usage="ATOM_TRANS", default_c_val="DEFAULT")
     457        18476 :       CALL section_add_keyword(section, keyword)
     458        18476 :       CALL keyword_release(keyword)
     459              : 
     460              :       CALL keyword_create(keyword, __LOCATION__, name="SIZE", &
     461              :                           description="Defines the size of the move: "// &
     462              :                           "ATOM_TRANS [A], "// &
     463              :                           "MOL_TRANS [A], "// &
     464              :                           "MOL_ROT [degree], "// &
     465              :                           "PROT_REORDER [], "// &
     466              :                           "VOL_MOVE [A], "// &
     467              :                           "ATOM_SWAP", &
     468              :                           usage="SIZE {real}", type_of_var=real_t, &
     469        18476 :                           default_r_val=-1.0_dp, n_var=1)
     470        18476 :       CALL section_add_keyword(section, keyword)
     471        18476 :       CALL keyword_release(keyword)
     472              : 
     473              :       CALL keyword_create(keyword, __LOCATION__, name="PROB", &
     474              :                           description="Defines the probability of the move "// &
     475              :                           "(considering the ration between the selected moves)", &
     476              :                           usage="PROB {real}", type_of_var=real_t, &
     477        18476 :                           default_r_val=1.0_dp, n_var=1)
     478        18476 :       CALL section_add_keyword(section, keyword)
     479        18476 :       CALL keyword_release(keyword)
     480              : 
     481              :       CALL keyword_create(keyword, __LOCATION__, name="INIT_ACC_PROB", &
     482              :                           description="Defines the initial probability of accepting the move. ", &
     483              :                           usage="INIT_ACC_PROB {real}", type_of_var=real_t, &
     484        18476 :                           default_r_val=0.23_dp, n_var=1)
     485        18476 :       CALL section_add_keyword(section, keyword)
     486        18476 :       CALL keyword_release(keyword)
     487              : 
     488              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     489              :                           description="Defines the atomic kinds involved in the move. "// &
     490              :                           "Up to now only used for the atom swap.", &
     491              :                           usage="ATOMS {KIND1} {KIND2} ... ", type_of_var=char_t, &
     492        18476 :                           n_var=-1, repeats=.TRUE.)
     493        18476 :       CALL section_add_keyword(section, keyword)
     494        18476 :       CALL keyword_release(keyword)
     495              : 
     496        18476 :    END SUBROUTINE create_TMC_move_type_section
     497              : 
     498              : ! **************************************************************************************************
     499              : !> \brief creates the TreeMonteCarlo subsection
     500              : !> \param section the section to be created
     501              : !> \author Mandes
     502              : ! **************************************************************************************************
     503         9238 :    SUBROUTINE create_TMC_ana_section(section)
     504              :       TYPE(section_type), POINTER                        :: section
     505              : 
     506         9238 :       CPASSERT(.NOT. ASSOCIATED(section))
     507              :       CALL section_create(section, __LOCATION__, name="TMC_ANALYSIS", &
     508              :                           description="Analysing the Markov Chain elements with the specified methods", &
     509         9238 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     510              : 
     511         9238 :       CALL create_TMC_ana_kinds(section=section)
     512              : 
     513         9238 :    END SUBROUTINE create_TMC_ana_section
     514              : 
     515              : ! **************************************************************************************************
     516              : !> \brief creates the TreeMonteCarlo subsection
     517              : !> \param section the section to be created
     518              : !> \author Mandes
     519              : ! **************************************************************************************************
     520         9238 :    SUBROUTINE create_TMC_ana_files(section)
     521              :       TYPE(section_type), POINTER                        :: section
     522              : 
     523              :       TYPE(keyword_type), POINTER                        :: keyword
     524              : 
     525         9238 :       NULLIFY (keyword)
     526              : 
     527         9238 :       CPASSERT(.NOT. ASSOCIATED(section))
     528              :       CALL section_create(section, __LOCATION__, name="TMC_ANALYSIS_FILES", &
     529              :                           description="Analysing the Markov Chain elements with the specified methods, "// &
     530              :                           "reading form default or specified files", &
     531         9238 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     532              : 
     533         9238 :       CALL create_TMC_ana_kinds(section=section)
     534              : 
     535              :       CALL keyword_create(keyword, __LOCATION__, &
     536              :                           name="NR_TEMPERATURE", &
     537              :                           description="the number of different temperature for parallel tempering", &
     538              :                           usage="NR_TEMPERATURE {INTEGER}", &
     539         9238 :                           default_i_val=1)
     540         9238 :       CALL section_add_keyword(section, keyword)
     541         9238 :       CALL keyword_release(keyword)
     542              : 
     543              :       CALL keyword_create(keyword, __LOCATION__, &
     544              :                           name="TEMPERATURE", &
     545              :                           description="one temperature OR for parallel tempering: "// &
     546              :                           "Tmin Tmax or each temperature T1 T2 T3 ..."// &
     547              :                           " If every single temperature is specified, "// &
     548              :                           "do NOT use keyword NR_TEMPERATURE", &
     549              :                           usage="TEMPERATURE {REAL} |OR| TEMPERATURE {REAL} {REAL} ...", &
     550              :                           default_r_vals=(/330.0_dp/), &
     551         9238 :                           n_var=-1, type_of_var=real_t)
     552         9238 :       CALL section_add_keyword(section, keyword)
     553         9238 :       CALL keyword_release(keyword)
     554              : 
     555              :       CALL keyword_create(keyword, __LOCATION__, &
     556              :                           name="DIRECTORIES", &
     557              :                           description="Analysing multiple directories, "// &
     558              :                           "created by standard parallel MC (e.g. using TMC farming ", &
     559              :                           usage="DIRECTORIES {DIR1/} {DIR2/} ...", &
     560              :                           default_c_vals=(/"./"/), &
     561        18476 :                           n_var=-1, type_of_var=char_t)
     562         9238 :       CALL section_add_keyword(section, keyword)
     563         9238 :       CALL keyword_release(keyword)
     564              : 
     565              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_ENV_FILE", &
     566              :                           description="input file name for force env, "// &
     567              :                           "to get initial configuration with dimensions and cell", &
     568              :                           usage="FORCE_ENV_FILE {filename}", &
     569         9238 :                           default_c_val="", lone_keyword_c_val="")
     570         9238 :       CALL section_add_keyword(section, keyword)
     571         9238 :       CALL keyword_release(keyword)
     572              : 
     573              :       CALL keyword_create(keyword, __LOCATION__, name="POSITION_FILE", &
     574              :                           description="file name for analysing the position file", &
     575              :                           usage="POSITION_FILE {filename}", &
     576         9238 :                           default_c_val="", lone_keyword_c_val="")
     577         9238 :       CALL section_add_keyword(section, keyword)
     578         9238 :       CALL keyword_release(keyword)
     579              : 
     580              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE", &
     581              :                           description="file name for analysing the cell file", &
     582              :                           usage="CELL_FILE {filename}", &
     583         9238 :                           default_c_val="", lone_keyword_c_val="")
     584         9238 :       CALL section_add_keyword(section, keyword)
     585         9238 :       CALL keyword_release(keyword)
     586              : 
     587              :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FILE", &
     588              :                           description="file name for analysing the dipole file", &
     589              :                           usage="DIPOLE_FILE {filename}", &
     590         9238 :                           default_c_val="", lone_keyword_c_val="")
     591         9238 :       CALL section_add_keyword(section, keyword)
     592         9238 :       CALL keyword_release(keyword)
     593              : 
     594              :       CALL keyword_create(keyword, __LOCATION__, &
     595              :                           name="START_ELEM", &
     596              :                           description="start analysis at element with number #", &
     597              :                           usage="START_ELEM {INTEGER}", &
     598         9238 :                           default_i_val=-1)
     599         9238 :       CALL section_add_keyword(section, keyword)
     600         9238 :       CALL keyword_release(keyword)
     601              : 
     602              :       CALL keyword_create(keyword, __LOCATION__, &
     603              :                           name="END_ELEM", &
     604              :                           description="end analysis at element with number #", &
     605              :                           usage="END_ELEM {INTEGER}", &
     606         9238 :                           default_i_val=-1)
     607         9238 :       CALL section_add_keyword(section, keyword)
     608         9238 :       CALL keyword_release(keyword)
     609              : 
     610         9238 :    END SUBROUTINE create_TMC_ana_files
     611              : 
     612              : ! **************************************************************************************************
     613              : !> \brief creates the TreeMonteCarlo subsection
     614              : !> \param section the section to be created
     615              : !> \author Mandes
     616              : ! **************************************************************************************************
     617        18476 :    SUBROUTINE create_TMC_ana_kinds(section)
     618              :       TYPE(section_type), POINTER                        :: section
     619              : 
     620              :       TYPE(keyword_type), POINTER                        :: keyword
     621              :       TYPE(section_type), POINTER                        :: subsection
     622              : 
     623        18476 :       NULLIFY (subsection, keyword)
     624              : 
     625              :       CALL keyword_create(keyword, __LOCATION__, &
     626              :                           name="RESTART", &
     627              :                           description="Enables/disables the reading and writing of analysis restart files", &
     628              :                           usage="RESTART {LOGICAL}", &
     629        18476 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     630        18476 :       CALL section_add_keyword(section, keyword)
     631        18476 :       CALL keyword_release(keyword)
     632              : 
     633              :       CALL keyword_create(keyword, __LOCATION__, name="PREFIX_ANA_FILES", &
     634              :                           description="specifies a prefix for all analysis files.", &
     635              :                           usage="PREFIX_ANA_FILES {prefix}", &
     636        18476 :                           default_c_val="")
     637        18476 :       CALL section_add_keyword(section, keyword)
     638        18476 :       CALL keyword_release(keyword)
     639              : 
     640              :       CALL keyword_create(keyword, __LOCATION__, &
     641              :                           name="DENSITY", &
     642              :                           description="Mass density in the simulation cell, or if specified in sub cubes", &
     643              :                           usage="DENSITY or DENSITY {INTEGER} {INTEGER} {INTEGER}", &
     644              :                           default_i_vals=(/1/), &
     645        18476 :                           n_var=-1, type_of_var=integer_t)
     646        18476 :       CALL section_add_keyword(section, keyword)
     647        18476 :       CALL keyword_release(keyword)
     648              : 
     649              :       CALL keyword_create(keyword, __LOCATION__, &
     650              :                           name="G_R", &
     651              :                           description="Radial Distribution Function for each pair of atoms "// &
     652              :                           "using the amount of specified bins within MAX(cell_length)/2", &
     653              :                           usage="G_R or G_R {INTEGER}", &
     654        18476 :                           default_i_val=-1, lone_keyword_i_val=-1)
     655        18476 :       CALL section_add_keyword(section, keyword)
     656        18476 :       CALL keyword_release(keyword)
     657              : 
     658              :       CALL keyword_create(keyword, __LOCATION__, &
     659              :                           name="CLASSICAL_DIPOLE_MOMENTS", &
     660              :                           description="calculates the classical dipole Moment. "// &
     661              :                           "Following flag specifies if they should be written. "// &
     662              :                           "Class. Dip. Mom. are also used to unfold the exact dipole moment. ", &
     663              :                           usage="CLASSICAL_DIPOLE_MOMENTS or CLASSICAL_DIPOLE_MOMENTS {LOGICAL}", &
     664        18476 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     665        18476 :       CALL section_add_keyword(section, keyword)
     666        18476 :       CALL keyword_release(keyword)
     667              : 
     668              :       ! for calculating the classical dipole moment we need charges
     669        18476 :       CALL create_CHARGE_section(subsection)
     670        18476 :       CALL section_add_subsection(section, subsection)
     671        18476 :       CALL section_release(subsection)
     672              : 
     673              :       CALL keyword_create(keyword, __LOCATION__, &
     674              :                           name="DIPOLE_ANALYSIS", &
     675              :                           description="Enables analysis of dipole moments, espacially dielectric constant. "// &
     676              :                           "An additional type can be specified, e.g. analyzing ice structures. "// &
     677              :                           "using SYM_XYZ also dipoles (-x,y,z) .. .. (-x,-y,z).... (-x,-y-z) "// &
     678              :                           "are regarded, only use it if this configurations have "// &
     679              :                           "all the same energy.", &
     680              :                           usage="DIPOLE_ANALYSIS or DIPOLE_ANALYSIS {type}", &
     681        18476 :                           default_c_val="", lone_keyword_c_val=tmc_default_unspecified_name)
     682        18476 :       CALL section_add_keyword(section, keyword)
     683        18476 :       CALL keyword_release(keyword)
     684              : 
     685              :       CALL keyword_create(keyword, __LOCATION__, &
     686              :                           name="DEVIATION", &
     687              :                           description="Calculates the deviation of the position from the last configuration", &
     688              :                           usage="DEVIATION {LOGICAL}", &
     689        18476 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     690        18476 :       CALL section_add_keyword(section, keyword)
     691        18476 :       CALL keyword_release(keyword)
     692        18476 :    END SUBROUTINE create_TMC_ana_kinds
     693              : 
     694              : END MODULE input_cp2k_tmc
        

Generated by: LCOV version 2.0-1