1
0
mirror of https://github.com/TREX-CoE/fparser.git synced 2024-11-03 12:43:58 +01:00

creating minimal example for the demonstration

This commit is contained in:
Ravindra Shinde 2021-03-25 12:31:06 +01:00
parent 195b4b89a5
commit 155526d1f0
7 changed files with 206 additions and 44 deletions

157
src/README.md Normal file
View File

@ -0,0 +1,157 @@
# Documentation for using the modern fortran parser
<!-- Thanks for visiting [The Markdown Guide](https://www.markdownguide.org)!
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It cant cover every edge case, so if you need more information about any of these elements, refer to the reference guides for [basic syntax](https://www.markdownguide.org/basic-syntax) and [extended syntax](https://www.markdownguide.org/extended-syntax). -->
## Get the code
The parser uses a modified libfdf library. This is included in this repository as a submodule. To clone the project, do
`git clone --recurse-submodules https://github.com/TREX-CoE/iof08.git`
## Compilation
## Integrate parser in your code
### Features of the parser (including inheritance from libfdf)
- Include another input file for parser to read using:
` %include global.inp`
- Include a data file for parser to read using:
` load label filename`
Here, depending upon the label, parser will provide the filename. For example,
` load basis cc-pvtz.gbs`
- Read molecular coordinates directly from the input file using
```perl
%block molecule
12
#benzene comment
C 0.00000 1.40272 0
H 0.00000 2.49029 0
C -1.21479 0.70136 0
H -2.15666 1.24515 0
C -1.21479 -0.70136 0
H -2.15666 -1.24515 0
C 0.00000 -1.40272 0
H 0.00000 -2.49029 0
C 1.21479 -0.70136 0
H 2.15666 -1.24515 0
C 1.21479 0.70136 0
H 2.15666 1.24515 0
%endblock
```
- Read molecular coordinates from an external .xyz file using
` %block molecule < caffeine.xyz `
- Group certain keywords using the %module construct
```perl
%module DMC
tau = 0.04
etrial = -15 Ha
%endmodule
```
**bold text**
### Italic
*italicized text*
### Blockquote
> blockquote
### Ordered List
1. First item
2. Second item
3. Third item
### Unordered List
- First item
- Second item
- Third item
### Code
`code`
### Horizontal Rule
---
### Link
[title](https://www.example.com)
### Image
![alt text](image.jpg)
## Extended Syntax
These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.
### Table
| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
### Fenced Code Block
```
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
```
### Footnote
Here's a sentence with a footnote. [^1]
[^1]: This is the footnote.
### Heading ID
### My Great Heading {#custom-id}
### Definition List
term
: definition
### Strikethrough
~~The world is flat.~~
### Task List
- [x] Write the press release
- [ ] Update the website
- [ ] Contact the media

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
ifort -c periodic_table_m.F90 ifort -c m_periodic_table.F90
ifort -c keywords_m.F90 ifort -c m_keywords.F90
ifort iochamp.f90 keywords_m.o periodic_table_m.o /usr/local/lib/libfdf.a ifort iochamp.f90 m_keywords.o m_periodic_table.o /usr/local/lib/libfdf.a

View File

@ -4,9 +4,6 @@
PROGRAM iochamp PROGRAM iochamp
USE fdf USE fdf
USE prec USE prec
USE parse
USE io_fdf
USE utils
! Note the following two modules are being used to store and process the parsed data ! Note the following two modules are being used to store and process the parsed data
@ -16,29 +13,26 @@ PROGRAM iochamp
implicit none implicit none
!--------------------------------------------------------------- Local Variables !--------------------------------------------------------------- Local Variables
integer, parameter :: maxa = 100 integer, parameter :: maxa = 100
logical :: doit, debug, check, val, logic(10) logical :: doit, debug
logical :: beginning, ending
character(len=72) :: fname, axis, status, filename, fmt character(len=72) :: fname, filename, fmt
character(len=72) :: molecule_name, key, comment character(len=72) :: molecule_name, key, comment
character(2) :: symbol(maxa) character(2) :: symbol(maxa)
character(len=20) :: chunks(10), subblock(10) character(len=20) :: chunks(10), subblock(10)
character(len=30) :: keyword(5) character(len=30) :: keyword(5)
integer(sp) :: i, j, ia, na, external_entry, number_of_atoms, ind integer(sp) :: i, j, ia, na, number_of_atoms
integer(sp) :: isa(maxa) integer(sp) :: isa(maxa)
real(dp) :: coeff(maxa) real(dp) :: coeff(maxa)
real(sp) :: wmix real(sp) :: wmix
real(dp) :: cutoff, phonon_energy, factor real(dp) :: phonon_energy
real(dp) :: xa(3, maxa) real(dp) :: xa(3, maxa)
real(dp) :: listr(maxa) real(dp) :: listr(maxa)
type(block_fdf) :: bfdf, bfdf2 type(block_fdf) :: bfdf, bfdf2
type(parsed_line), pointer :: pline, pline2 type(parsed_line), pointer :: pline, pline2
!type(fdf_file) :: fdffile
integer :: max_iteration, max_iter, linecount, argument(5)
real(dp) :: float_value real(dp) :: float_value
character(len=1) :: char1 character(len=20) :: real_format = '(A, T20, F14.8)'
character(len=20) :: real_format = '(A, T20, F14.8)' character(len=20) :: int_format = '(A, T20, I8)'
character(len=20) :: int_format = '(A, T20, I8)' character(len=80) :: string_format = '(A, T40, A)'
character(len=80) :: string_format = '(A, T40, A)'
! for determinants sections ! for determinants sections
integer :: nelectrons, nexcitation, iostat integer :: nelectrons, nexcitation, iostat
@ -143,16 +137,11 @@ PROGRAM iochamp
write(6,*) 'multiple_adiag:', multiple_adiag write(6,*) 'multiple_adiag:', multiple_adiag
! logical :: true, .true., yes, T, and TRUE are equivalent ! logical :: true, .true., yes, T, and TRUE are equivalent
debug = fdf_boolean('Debug', .TRUE.) debug = fdf_boolean('Debug', .TRUE.)
write(6,'(A, L2)') 'Debug:', debug write(6,'(A, L2)') 'Debug:', debug
! ianalyt_lap 1 isc 2 nspin1 1 nspin2 1 ifock 0 ! ianalyt_lap 1 isc 2 nspin1 1 nspin2 1 ifock 0
analytic_laplacian = fdf_get('ianalyt_lap', 1) analytic_laplacian = fdf_get('ianalyt_lap', 1)
write(6,*) 'analytic laplacian from global.fdf pointer explained ', ianalyt_lap write(6,*) 'analytic laplacian from global.fdf pointer explained ', ianalyt_lap
@ -216,7 +205,7 @@ PROGRAM iochamp
ia = 1 ia = 1
open (unit=12,file=file_molecule, iostat=iostat, action='read' ) open (unit=12,file=file_molecule, iostat=iostat, action='read' )
if (iostat .ne. 0) call die(file_molecule, "Problem in opening the molecule file") if (iostat .ne. 0) stop "Problem in opening the molecule file"
read(12,*) natoms read(12,*) natoms
print*, "natoms ", natoms print*, "natoms ", natoms
if (.not. allocated(cent)) allocate(cent(3,natoms)) if (.not. allocated(cent)) allocate(cent(3,natoms))
@ -365,7 +354,7 @@ PROGRAM iochamp
write(6,*) 'Reading the determinants block from an external file ' write(6,*) 'Reading the determinants block from an external file '
open (unit=11,file=file_determinants, iostat=iostat, action='read' ) open (unit=11,file=file_determinants, iostat=iostat, action='read' )
if (iostat .ne. 0) call die(file_determinants, "Problem in opening the determinant file") if (iostat .ne. 0) stop "Problem in opening the determinant file"
read(11,*) temp1, temp2, nelectrons, temp3, nalpha read(11,*) temp1, temp2, nelectrons, temp3, nalpha
read(11,*) temp1, ndeterminants, nexcitation read(11,*) temp1, ndeterminants, nexcitation

View File

@ -8,13 +8,18 @@
%endmodule %endmodule
# Include another input file
%include global.inp %include global.inp
# load the data files using "load"
load basis BFD-T-normf0.bas load basis BFD-T-normf0.bas
#load determinants TZ_1M_500.det load determinants TZ_1M_500.det
#load molecule benzene.xyz
#%block molecule < caffeine.xyz # Option 1 (higher priority compared to option 2)
%block molecule < caffeine.xyz
# Option 2
%block molecule %block molecule
12 12
some optional comment or a blank line some optional comment or a blank line

View File

@ -3,7 +3,7 @@ pool ./pool
molecule default.xyz # default value molecule default.xyz # default value
pseudopot default.psp # default value pseudopot default.psp # default value
basis BFD-T-normf0.bas basis BFD-T-normf0.bas
determinants default.det # default value determinants TZ_1M_500.det
orbitals default.orb # default value orbitals default.orb # default value
jastrow default.jas # default value jastrow default.jas # default value
jastrow_deriv default.jasder # default value jastrow_deriv default.jasder # default value
@ -34,20 +34,31 @@ excess_charge 0 # default value
multiplicity 1 # default value multiplicity 1 # default value
%block molecule %block molecule
%block molecule %block molecule
12 24
some optional comment or a blank line molecule 1,3,7-Trimethylpurine-2,6-dione
C 0.00000 1.40272 0 N 1.5808 0.7027 -0.2279
H 0.00000 2.49029 0 C 1.7062 -0.7374 -0.2126
C -1.21479 0.70136 0 N 0.5340 -1.5671 -0.3503
H -2.15666 1.24515 0 C 0.3231 1.3600 0.0274
C -1.21479 -0.70136 0 C -0.8123 0.4553 0.0817
H -2.15666 -1.24515 0 C -0.6967 -0.9322 -0.0662
C 0.00000 -1.40272 0 N -2.1886 0.6990 0.2783
H 0.00000 -2.49029 0 C -2.8512 -0.5205 0.2532
C 1.21479 -0.70136 0 N -1.9537 -1.5188 0.0426
H 2.15666 -1.24515 0 C 0.6568 -3.0274 -0.1675
C 1.21479 0.70136 0 O 2.8136 -1.2558 -0.1693
H 2.15666 1.24515 0 O 0.2849 2.5744 0.1591
C -2.8096 2.0031 0.5032
C 2.8301 1.5004 -0.1968
H -3.9271 -0.6787 0.3762
H 1.4823 -3.4046 -0.7865
H -0.2708 -3.5204 -0.4868
H 0.8567 -3.2990 0.8788
H -2.4123 2.7478 -0.2017
H -2.6042 2.3621 1.5221
H -3.8973 1.9344 0.3695
H 3.5959 1.0333 -0.8314
H 3.2249 1.5791 0.8255
H 2.6431 2.5130 -0.5793
%endblock molecule %endblock molecule
#:block? determinants F #:defined? determinants T
#:defined? determinants F