mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 06:05:29 -04:00
Include of XC-section from data/xc_section possible
svn-origin-rev: 18148
This commit is contained in:
parent
171e79d7c0
commit
179c601326
4 changed files with 140 additions and 1 deletions
7
data/xc_section/PBE.sec
Normal file
7
data/xc_section/PBE.sec
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# PBE &XC SECTION: Test for @XCTYPE include
|
||||
#
|
||||
&XC
|
||||
&XC_FUNCTIONAL PBE
|
||||
&END XC_FUNCTIONAL
|
||||
&END XC
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
! **************************************************************************************************
|
||||
MODULE cp_parser_inpp_methods
|
||||
USE cp_files, ONLY: close_file,&
|
||||
open_file
|
||||
open_file, file_exists
|
||||
USE cp_log_handling, ONLY: cp_logger_get_default_io_unit
|
||||
USE cp_parser_inpp_types, ONLY: inpp_type
|
||||
USE kinds, ONLY: default_path_length,&
|
||||
|
|
@ -163,6 +163,96 @@ CONTAINS
|
|||
input_line_number = 0
|
||||
input_unit = unit
|
||||
|
||||
CASE ("@XCTYPE")
|
||||
! Include a &XC section from the data/xc_section directory or the local directory
|
||||
! Get the filename.. allow for " or ' or nothing..
|
||||
filename = TRIM(input_line(indf:))
|
||||
IF (LEN_TRIM(filename) == 0) THEN
|
||||
WRITE (UNIT=message, FMT="(3A,I6)") &
|
||||
"INPP_@XCTYPE: Incorrect @XCTYPE directive in file: ", &
|
||||
TRIM(input_file_name), " Line:", input_line_number
|
||||
CPABORT(TRIM(message))
|
||||
ENDIF
|
||||
indi = 1
|
||||
DO WHILE (is_whitespace(filename(indi:indi)))
|
||||
indi = indi+1
|
||||
END DO
|
||||
filename = TRIM(filename(indi:))
|
||||
|
||||
! handle quoting of the filename
|
||||
pos1 = INDEX(filename, '"')
|
||||
pos2 = INDEX(filename(pos1+1:), '"')
|
||||
IF ((pos1 /= 0) .AND. (pos2 /= 0)) THEN
|
||||
filename = filename(pos1+1:pos1+pos2-1)
|
||||
ELSE
|
||||
pos1 = INDEX(filename, "'")
|
||||
pos2 = INDEX(filename(pos1+1:), "'")
|
||||
IF ((pos1 /= 0) .AND. (pos2 /= 0)) THEN
|
||||
filename = filename(pos1+1:pos1+pos2-1)
|
||||
ELSE
|
||||
! incorrect quotes (only one of ' or ").
|
||||
pos2 = INDEX(filename, '"')
|
||||
IF ((pos1 /= 0) .OR. (pos2 /= 0)) THEN
|
||||
WRITE (UNIT=message, FMT="(3A,I6)") &
|
||||
"INPP_@XCTYPE: Incorrect quoting of include file in file: ", &
|
||||
TRIM(input_file_name), " Line:", input_line_number
|
||||
CPABORT(TRIM(message))
|
||||
ENDIF
|
||||
! nothing to do. unquoted filename.
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
! add file extension ".sec"
|
||||
filename = TRIM(filename)//".sec"
|
||||
! check for file
|
||||
IF (.NOT.file_exists(TRIM(filename))) THEN
|
||||
IF (filename(1:1) == '/') THEN
|
||||
! this is an absolute path filename, don't change
|
||||
ELSE
|
||||
filename = "xc_section"//'/'//filename
|
||||
ENDIF
|
||||
END IF
|
||||
IF (.NOT.file_exists(TRIM(filename))) THEN
|
||||
WRITE (UNIT=message, FMT="(3A,I6)") &
|
||||
"INPP_@XCTYPE: Could not find input XC section: ", &
|
||||
TRIM(input_file_name), " Line:", input_line_number
|
||||
CPABORT(TRIM(message))
|
||||
END IF
|
||||
|
||||
! Let's check that files already opened won't be again opened
|
||||
DO i = 1, inpp%io_stack_level
|
||||
check = TRIM(filename) /= TRIM(inpp%io_stack_filename(i))
|
||||
CPASSERT(check)
|
||||
END DO
|
||||
|
||||
! this stops on so we can always assume success
|
||||
CALL open_file(file_name=TRIM(filename), &
|
||||
file_status="OLD", &
|
||||
file_form="FORMATTED", &
|
||||
file_action="READ", &
|
||||
unit_number=unit)
|
||||
|
||||
IF (debug_this_module .AND. output_unit > 0) THEN
|
||||
WRITE (UNIT=message, FMT="(3A,I6,2A)") "INPP_@XCTYPE: in file: ", &
|
||||
TRIM(input_file_name), " Line:", input_line_number, &
|
||||
" Opened include file: ", TRIM(filename)
|
||||
WRITE (output_unit, *) TRIM(message)
|
||||
END IF
|
||||
|
||||
! make room, save status and position the parser at the beginning of new file.
|
||||
inpp%io_stack_level = inpp%io_stack_level+1
|
||||
CALL reallocate(inpp%io_stack_channel, 1, inpp%io_stack_level)
|
||||
CALL reallocate(inpp%io_stack_lineno, 1, inpp%io_stack_level)
|
||||
CALL reallocate(p_long=inpp%io_stack_filename, lb_new=1, ub_new=inpp%io_stack_level)
|
||||
|
||||
inpp%io_stack_channel(inpp%io_stack_level) = input_unit
|
||||
inpp%io_stack_lineno(inpp%io_stack_level) = input_line_number
|
||||
inpp%io_stack_filename(inpp%io_stack_level) = input_file_name
|
||||
|
||||
input_file_name = TRIM(filename)
|
||||
input_line_number = 0
|
||||
input_unit = unit
|
||||
|
||||
CASE ("@SET")
|
||||
! split directive into variable name and value data.
|
||||
varname = TRIM(input_line(indf:))
|
||||
|
|
|
|||
40
tests/QS/regtest-gpw-1/He_PBE.inp
Normal file
40
tests/QS/regtest-gpw-1/He_PBE.inp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
&FORCE_EVAL
|
||||
METHOD Quickstep
|
||||
&DFT
|
||||
BASIS_SET_FILE_NAME BASIS_SET
|
||||
POTENTIAL_FILE_NAME POTENTIAL
|
||||
LSD
|
||||
&MGRID
|
||||
CUTOFF 140
|
||||
&END MGRID
|
||||
&QS
|
||||
EPS_DEFAULT 1.0E-8
|
||||
&END QS
|
||||
&SCF
|
||||
EPS_DIIS 0.1
|
||||
EPS_SCF 1.0E-4
|
||||
MAX_DIIS 4
|
||||
MAX_SCF 30
|
||||
SCF_GUESS atomic
|
||||
&END SCF
|
||||
# TEST for inculde of XC section
|
||||
@XCTYPE PBE
|
||||
&END DFT
|
||||
&SUBSYS
|
||||
&CELL
|
||||
ABC 8.0 4.0 4.0
|
||||
&END CELL
|
||||
&COORD
|
||||
H 0.000000 0.000000 0.000000
|
||||
H 1.000000 0.000000 0.000000
|
||||
&END COORD
|
||||
&KIND H
|
||||
BASIS_SET DZV-GTH-PADE
|
||||
POTENTIAL GTH-PADE-q1
|
||||
&END KIND
|
||||
&END SUBSYS
|
||||
&END FORCE_EVAL
|
||||
&GLOBAL
|
||||
PROJECT H2
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
|
@ -68,4 +68,6 @@ Ne_debug.inp 1 1e-13
|
|||
ghost_md.inp 1 1.0E-14 0
|
||||
#
|
||||
hf.inp 1 5.0E-11 -19.51410589756660
|
||||
#
|
||||
He_PBE.inp 1 1.0E-13 -1.143985244833561
|
||||
#EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue