From 155526d1f0ae90b1ad70c319e330a033a7e142e8 Mon Sep 17 00:00:00 2001 From: Ravindra Shinde Date: Thu, 25 Mar 2021 12:31:06 +0100 Subject: [PATCH] creating minimal example for the demonstration --- src/README.md | 157 ++++++++++++++++++ src/build.sh | 6 +- src/iochamp.f90 | 31 ++-- src/{keywords_m.F90 => m_keywords.F90} | 0 ...iodic_table_m.F90 => m_periodic_table.F90} | 0 src/test-champ.inp | 11 +- src/test-champ.out | 45 +++-- 7 files changed, 206 insertions(+), 44 deletions(-) create mode 100644 src/README.md rename src/{keywords_m.F90 => m_keywords.F90} (100%) rename src/{periodic_table_m.F90 => m_periodic_table.F90} (100%) diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..e9a743d --- /dev/null +++ b/src/README.md @@ -0,0 +1,157 @@ +# Documentation for using the modern fortran parser + + + +## 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 diff --git a/src/build.sh b/src/build.sh index 37771b0..7bfbbd2 100755 --- a/src/build.sh +++ b/src/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -ifort -c periodic_table_m.F90 -ifort -c keywords_m.F90 +ifort -c m_periodic_table.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 diff --git a/src/iochamp.f90 b/src/iochamp.f90 index 139a1be..ac2e024 100644 --- a/src/iochamp.f90 +++ b/src/iochamp.f90 @@ -4,9 +4,6 @@ PROGRAM iochamp USE fdf USE prec - USE parse - USE io_fdf - USE utils ! Note the following two modules are being used to store and process the parsed data @@ -16,29 +13,26 @@ PROGRAM iochamp implicit none !--------------------------------------------------------------- Local Variables integer, parameter :: maxa = 100 - logical :: doit, debug, check, val, logic(10) - logical :: beginning, ending - character(len=72) :: fname, axis, status, filename, fmt + logical :: doit, debug + + character(len=72) :: fname, filename, fmt character(len=72) :: molecule_name, key, comment character(2) :: symbol(maxa) character(len=20) :: chunks(10), subblock(10) 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) real(dp) :: coeff(maxa) real(sp) :: wmix - real(dp) :: cutoff, phonon_energy, factor + real(dp) :: phonon_energy real(dp) :: xa(3, maxa) real(dp) :: listr(maxa) type(block_fdf) :: bfdf, bfdf2 type(parsed_line), pointer :: pline, pline2 - !type(fdf_file) :: fdffile - integer :: max_iteration, max_iter, linecount, argument(5) real(dp) :: float_value - character(len=1) :: char1 - character(len=20) :: real_format = '(A, T20, F14.8)' - character(len=20) :: int_format = '(A, T20, I8)' - character(len=80) :: string_format = '(A, T40, A)' + character(len=20) :: real_format = '(A, T20, F14.8)' + character(len=20) :: int_format = '(A, T20, I8)' + character(len=80) :: string_format = '(A, T40, A)' ! for determinants sections integer :: nelectrons, nexcitation, iostat @@ -143,16 +137,11 @@ PROGRAM iochamp write(6,*) 'multiple_adiag:', multiple_adiag - - - ! logical :: true, .true., yes, T, and TRUE are equivalent debug = fdf_boolean('Debug', .TRUE.) write(6,'(A, L2)') 'Debug:', debug - - ! ianalyt_lap 1 isc 2 nspin1 1 nspin2 1 ifock 0 analytic_laplacian = fdf_get('ianalyt_lap', 1) write(6,*) 'analytic laplacian from global.fdf pointer explained ', ianalyt_lap @@ -216,7 +205,7 @@ PROGRAM iochamp ia = 1 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 print*, "natoms ", 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 ' 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, ndeterminants, nexcitation diff --git a/src/keywords_m.F90 b/src/m_keywords.F90 similarity index 100% rename from src/keywords_m.F90 rename to src/m_keywords.F90 diff --git a/src/periodic_table_m.F90 b/src/m_periodic_table.F90 similarity index 100% rename from src/periodic_table_m.F90 rename to src/m_periodic_table.F90 diff --git a/src/test-champ.inp b/src/test-champ.inp index 99c10bd..af4e3a1 100644 --- a/src/test-champ.inp +++ b/src/test-champ.inp @@ -8,13 +8,18 @@ %endmodule +# Include another input file %include global.inp + +# load the data files using "load" load basis BFD-T-normf0.bas -#load determinants TZ_1M_500.det -#load molecule benzene.xyz +load determinants TZ_1M_500.det -#%block molecule < caffeine.xyz +# Option 1 (higher priority compared to option 2) +%block molecule < caffeine.xyz + +# Option 2 %block molecule 12 some optional comment or a blank line diff --git a/src/test-champ.out b/src/test-champ.out index d814f75..8fbb4bd 100644 --- a/src/test-champ.out +++ b/src/test-champ.out @@ -3,7 +3,7 @@ pool ./pool molecule default.xyz # default value pseudopot default.psp # default value basis BFD-T-normf0.bas -determinants default.det # default value +determinants TZ_1M_500.det orbitals default.orb # default value jastrow default.jas # default value jastrow_deriv default.jasder # default value @@ -34,20 +34,31 @@ excess_charge 0 # default value multiplicity 1 # default value %block molecule %block molecule - 12 - some optional comment or a blank line - 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 + 24 + molecule 1,3,7-Trimethylpurine-2,6-dione + N 1.5808 0.7027 -0.2279 + C 1.7062 -0.7374 -0.2126 + N 0.5340 -1.5671 -0.3503 + C 0.3231 1.3600 0.0274 + C -0.8123 0.4553 0.0817 + C -0.6967 -0.9322 -0.0662 + N -2.1886 0.6990 0.2783 + C -2.8512 -0.5205 0.2532 + N -1.9537 -1.5188 0.0426 + C 0.6568 -3.0274 -0.1675 + O 2.8136 -1.2558 -0.1693 + 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 -#:block? determinants F -#:defined? determinants F +#:defined? determinants T