OCaml Design Frames/Process

From WikiOsp
Jump to: navigation, search


  • Define a Domain by a generic name followed by set
Ex.: generic name wavefunction -> wavefunctionset
  • Define the names of all the entities you think are a kind of ...
Ex.: Determinant, Jastrow, HF_wavefunction, Ci_wavefunction
  • Define the names of all the entities that are necessary to calculate the entities of the Domain.
Ex.: Slater_function, Gaussian_function, Numerical_function

  • Organize the names as a Tree having the generic name at its root, divided into three subtrees the Closure_subtree, the Body_subtree and the Context_subtree
  • Closure_subtree : collects all names that are used to calculate the Domain entities exclusively
  • normalize the names introducing a hierarchy which clusters the names

Determinant -> wavefunction_determinant


Preliminary Steps

  • Subdomain : define a databaseset subdirectory
Ex.: FRAMES_DIR/databaseset/database_gaussian_nwchem
     Database Subdomain name is database_gaussian_nwchem
  • Makefile : define its path in FRAMES_DIR/Mk
  • in FRAMES_DIR/Mk/Frames_databaseset_directories.mk
  • Tools : update ${INIT}/frames_env/
  • in ${INIT}/frames_env/databaseset_env :
export DGNDBA=${DBA}/database_gaussian_nwchem
alias  dgndba="cd ${DGNDBA}"

export DGGDBA=${DBA}/database_gaussian_g9x
alias  dggdba="cd ${DGGDBA}"

export DGMDBA=${DBA}/database_gaussian_molpro
alias  dgmdba="cd ${DGMDBA}"
  • Normalizes the files names copied from their own source
 Ex.: gaussian_nwchem_cc_pvtz.dgn taken from 'Basis Set: cc-pVTZ.txt'
  • Define file extensions
 database_gaussian_nwchem -> dgn
 database_gaussian_g9x    -> dgg
 database_gaussian_molpro -> dgm

Parsing the database file


The Lexer reads the database file as an input stream of bytes and returns a reverse list of Lexemes.

  • create directory FRAMES_DIRECTORY/databaseset/database_gaussian_nwchem/dgn_lexer
  • Define the lexemes used by the authors of the Database in file dgn_lexeme_labels.dat
    • it is an arbitrary process, which tries to organize the content of the file in abstract Lexeme types adequate for future Parsing.
    • see NWChem Basis Set Lexemes Table
  • Generate Dgn_lexeme_label_t.ml and Dgn_lexeme_label_v.ml
  • Generate Dgn_lexeme_tag_t.ml and Dgn_lexeme_tag_v.ml
  • Create the list of Lexemes from the database file
 Dgn_lexer_lexical_analysis_v.ml : character stream from database file -> lexeme reverse list

  • Define registers


The Parser builds the Labels Tree from the information stored in the Database file through the Lexeme list.

  • Define file ./generator/dgn_labels.dat
    • it is an arbitrary process, which :
      • translates the Lexemes into Dgn_labels
      • they are organized in a Tree following the BNF description of the database file.
      • each Dgn_label node must be provided with a unique name (the Label Tree Nodes are all unique, except Leaves).
    • see NWChem Basis Set Labels Table
  • Generate Dgn_label_t.ml and Dgn_label_v.ml
  • Generate Dgn_tag_t.ml and Dgn_tag_v.ml
  • Formulate the Database file as a BNF Grammar. The Parser will follow the BNF.
  • Write code :
  • Dgn_parser_v.ml : Lexeme reverse list -> Stack of Lexeme -> Dgn_labels Tree -> Dgn_tags Tree.

This process is cyclic : the Lexeme must be adapted to the Parser and the Parser to the BNF

 Ex.: Database_dgn_tag_tree_by_database_dgn_database_tag_provider_v.ml
  • Define the modules :

to get any tag from a symbol or from a string_off or from a sole_index

This Subdomain is self-consistent : it does not depend on any other Domain (except Basic ones : Basics Datastructures Files Commonset Databaseset_common)

Its aim is to build the relation of dependence between each of its entities as expressed by the BNF and its translation (the Tree produced by Dgn_parser).

  • Tree of Dgn_top_block entities
  • Tree of Dgn_basis_set_block entities


This new Domain will define the entities used by Frames to describe the Prototype for Elementary Function (FEP) entities. The information comes from the Databaseset (particularly from Dgn the Nwchem instance).


  • The first Subdomain of Prototypeset is Prototypesest_databases.
  • Its aim is to build the dependency tree (Prototype_tags_tree) between its own entities, already defined in Prototypeset_symbols and Prototypesest_tags.
  • Prototype_symbol_from_dgn_tag_translator_v.ml
  • Prototype_symbol_tree_by_dgn_context_basisset_tag_provider_v.ml
  • Prototype_symbol_tree_by_dgn_context_basisset_name_provider_v.mli \
  • Prototype_tag_tree_by_dgn_context_basisset_name_provider_v.mli \
  • Prototype_tag_all_list_by_dgn_context_basisset_name_provider_v.mli \
  • Tree of Prototype_body entities