mirror of
https://github.com/TREX-CoE/fparser.git
synced 2024-07-22 10:47:46 +02:00
cleanup
This commit is contained in:
parent
930e7102a7
commit
7241cbe670
251
README.md
251
README.md
@ -1,51 +1,68 @@
|
||||
# A Modern Fortran-based Parser
|
||||
|
||||
<!-- Thanks for visiting [The Markdown Guide](https://www.markdownguide.org)!
|
||||
This repository contains a modern Fortran-based input file parser. It uses a modified libfdf library.
|
||||
|
||||
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t 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 entire project, do
|
||||
The library is included in this repository as a submodule. To clone the entire project, do
|
||||
|
||||
`git clone --recurse-submodules https://github.com/TREX-CoE/iof08.git`
|
||||
`git clone --recurse-submodules https://github.com/TREX-CoE/fparser.git`
|
||||
|
||||
|
||||
## Compilation
|
||||
The project contains two folders (a) modified-libfdf and (b) parser.
|
||||
|
||||
- Compile and install the modified-libfdf using the following set of commands
|
||||
```Console
|
||||
./configure --prefix=/usr/local FC=ifort CC=icc
|
||||
make
|
||||
sudo make install
|
||||
make check
|
||||
```
|
||||
- In the parser folder, link the modified libfdf library with the interface Fortran file.
|
||||
```
|
||||
Compile and install the modified-libfdf using the following set of commands
|
||||
|
||||
`./configure --prefix=/usr/local FC=ifort CC=icc`
|
||||
|
||||
`make`
|
||||
|
||||
`sudo make install`
|
||||
|
||||
In the parser folder, link the modified libfdf library with the interface Fortran file.
|
||||
|
||||
`ifort -c interface.F90 m_keywords.F90 m_periodic_table.F90 /usr/local/lib/libfdf.a`
|
||||
|
||||
|
||||
## Integrate parser in your code
|
||||
Just include the interface.F90 file and the keyword declaration module files in the existing Makefile of your code.
|
||||
|
||||
---
|
||||
|
||||
## Features of the parser (including inheritance from libfdf)
|
||||
|
||||
- Blank lines and lines starting with # are ignored.
|
||||
|
||||
- The order of keyword-value pairs does not matter
|
||||
|
||||
- Multiple keyword-value pairs can be put in a single line
|
||||
|
||||
- Keywords are case insensitive.
|
||||
|
||||
- A default value can be set for keywords not present in the input file.
|
||||
|
||||
|
||||
## Syntax
|
||||
|
||||
### Features of the parser (including inheritance from libfdf)
|
||||
1. Include another input file for parser to read using:
|
||||
|
||||
- Include another input file for parser to read using:
|
||||
` %include global.inp`
|
||||
|
||||
` %include global.inp`
|
||||
2. Include a data file for parser to read using:
|
||||
|
||||
- Include a data file for parser to read using:
|
||||
` load label filename`
|
||||
|
||||
` load label filename`
|
||||
3. Here, depending upon the label, parser will provide the filename. For example,
|
||||
|
||||
Here, depending upon the label, parser will provide the filename. For example,
|
||||
` load basis cc-pvtz.gbs`
|
||||
|
||||
` load basis cc-pvtz.gbs`
|
||||
4. Read molecular coordinates directly from the input file using
|
||||
|
||||
- Read molecular coordinates directly from the input file using
|
||||
|
||||
```perl
|
||||
%block molecule
|
||||
12
|
||||
```perl
|
||||
%block molecule
|
||||
12
|
||||
#benzene comment
|
||||
C 0.00000 1.40272 0
|
||||
H 0.00000 2.49029 0
|
||||
@ -59,109 +76,135 @@ Here, depending upon the label, parser will provide the filename. For example,
|
||||
H 2.15666 -1.24515 0
|
||||
C 1.21479 0.70136 0
|
||||
H 2.15666 1.24515 0
|
||||
%endblock
|
||||
```
|
||||
%endblock
|
||||
```
|
||||
|
||||
- Read molecular coordinates from an external .xyz file using
|
||||
5. Read molecular coordinates from an external .xyz file using
|
||||
|
||||
` %block molecule < caffeine.xyz `
|
||||
` %block molecule < benzene.xyz `
|
||||
|
||||
6. Group certain keywords using the %module construct
|
||||
|
||||
- Group certain keywords using the %module construct
|
||||
|
||||
```perl
|
||||
%module DMC
|
||||
```perl
|
||||
%module DMC
|
||||
tau = 0.04
|
||||
etrial = -15 Ha
|
||||
%endmodule
|
||||
```
|
||||
%endmodule
|
||||
```
|
||||
|
||||
- Logical variables accept true, TRUE, T, 1, .true. as valid keywords for true
|
||||
` optimize_wavefunction true`
|
||||
7. Logical variables accept `true`, `TRUE`, `T`, `.true.` as valid keywords for `True`. The `fdf_boolean` function can also take "1" as true and "0" as false from the input.
|
||||
|
||||
` optimize_wavefunction true`
|
||||
|
||||
8. Single and Double precision numbers along with numbers in scientific format can be read using the `fdf_get()` function.
|
||||
|
||||
`energy_tol = fdf_get('energy_tol', 0.00001d0)`
|
||||
|
||||
**bold text**
|
||||
9. Floats/integers/strings/booleans can be parsed generically using the interface `fdf_get()` function.
|
||||
|
||||
### Italic
|
||||
` sr_tau = fdf_get('sr_tau', 0.025d0)`
|
||||
|
||||
*italicized text*
|
||||
` nspin1 = fdf_get('nspin1', 1)`
|
||||
|
||||
### Blockquote
|
||||
` opt_method = fdf_get('opt_method', "sr_n")`
|
||||
|
||||
> blockquote
|
||||
` multiple_adiag = fdf_get('multiple_adiag', .false.)`
|
||||
|
||||
### Ordered List
|
||||
10. Units can be specified to variables. Unit conversion is possible at the parsing.
|
||||
|
||||
1. First item
|
||||
2. Second item
|
||||
3. Third item
|
||||
If the input file has `etrial = -15 Ha` entry, the `etrial` variable can be assigned values using the `fdf_physical` function with unit conversion.
|
||||
|
||||
### Unordered List
|
||||
` etrial = fdf_physical('etrial', -20.d0, 'eV')`
|
||||
|
||||
- First item
|
||||
- Second item
|
||||
- Third item
|
||||
11. List of public functions available for parsing the data:
|
||||
|
||||
### Code
|
||||
Initiate
|
||||
|
||||
`code`
|
||||
`fdf_init`
|
||||
|
||||
### Horizontal Rule
|
||||
`fdf_shutdown`
|
||||
|
||||
Single data
|
||||
|
||||
`fdf_get`
|
||||
|
||||
`fdf_integer`
|
||||
|
||||
`fdf_single`
|
||||
|
||||
`fdf_double`
|
||||
|
||||
`fdf_string`
|
||||
|
||||
`fdf_boolean`
|
||||
|
||||
`fdf_physical`
|
||||
|
||||
`fdf_convfac`
|
||||
|
||||
`fdf_load_filename`
|
||||
|
||||
Lists (data enclosed in [])
|
||||
|
||||
`fdf_islist`
|
||||
|
||||
`fdf_islinteger`
|
||||
|
||||
`fdf_islreal`
|
||||
|
||||
`fdf_list`
|
||||
|
||||
`fdf_linteger`
|
||||
|
||||
`fdf_ldouble`
|
||||
|
||||
Returns the string associated with a mark line
|
||||
|
||||
`fdf_getline`
|
||||
|
||||
Test if a label is defined
|
||||
|
||||
`fdf_defined`
|
||||
|
||||
`fdf_isphysical`
|
||||
|
||||
`fdf_isblock`
|
||||
|
||||
`fdf_load_defined`
|
||||
|
||||
Allow to overwrite things in the FDF
|
||||
|
||||
`fdf_overwrite`
|
||||
|
||||
`fdf_removelabel`
|
||||
|
||||
`fdf_addline`
|
||||
|
||||
Block reading (processing each line of data)
|
||||
|
||||
`fdf_block, fdf_block_linecount`
|
||||
|
||||
`fdf_bline, fdf_bbackspace, fdf_brewind, fdf_bclose`
|
||||
|
||||
`fdf_bnintegers, fdf_bnreals, fdf_bnvalues, fdf_bnnames, fdf_bntokens`
|
||||
|
||||
`fdf_bintegers, fdf_breals, fdf_bvalues, fdf_bnames, fdf_btokens`
|
||||
|
||||
`fdf_bboolean, fdf_bphysical`
|
||||
|
||||
`fdf_bnlists, fdf_bnilists, fdf_bnrlists, fdf_bnvlists`
|
||||
|
||||
`fdf_bilists, fdf_brlists, fdf_bvlists`
|
||||
|
||||
Match, search over blocks, and destroy block structure
|
||||
|
||||
`fdf_bmatch, fdf_bsearch, fdf_substring_search`
|
||||
|
||||
`fdf_setoutput, fdf_setdebug`
|
||||
|
||||
---
|
||||
|
||||
### Link
|
||||
## Demonstration
|
||||
|
||||
[title](https://www.example.com)
|
||||
In the `parser` folder, we have included a sample `interface.F90` and `m_keywords.F90` files. In the `interface.F90` file, we have demonstrated how keyword-values pairs, simple data blocks, and data from external files can be read easily.
|
||||
|
||||
### 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
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
FC=ifort
|
||||
|
||||
$FC -c m_periodic_table.F90 m_keywords.F90
|
||||
$FC interface.F90 m_keywords.o m_periodic_table.o /usr/local/lib/libfdf.a
|
||||
#$FC -c m_periodic_table.F90 m_keywords.F90
|
||||
$FC -c m_keywords.F90
|
||||
$FC interface.F90 m_keywords.o /usr/local/lib/libfdf.a
|
||||
|
@ -1,7 +1,6 @@
|
||||
!
|
||||
! Shows FDF capabilities..
|
||||
!
|
||||
PROGRAM iochamp
|
||||
PROGRAM interface
|
||||
USE fdf
|
||||
USE prec
|
||||
|
||||
@ -263,4 +262,4 @@ PROGRAM iochamp
|
||||
call fdf_shutdown()
|
||||
|
||||
!----------------------------------------------------------------------------END
|
||||
END PROGRAM iochamp
|
||||
END PROGRAM interface
|
||||
|
Loading…
Reference in New Issue
Block a user