ForceBalance API  1.3
Automated optimization of force fields and empirical potentials
Functions | Variables
src.parser Namespace Reference

Functions

def read_mvals (fobj)
 
def read_pvals (fobj)
 
def read_priors (fobj)
 
def read_internals (fobj)
 
def printsection (heading, optdict, typedict)
 Print out a section of the input file in a parser-compliant and readable format. More...
 
def parse_inputs (input_file=None)
 Parse through the input file and read all user-supplied options. More...
 

Variables

 logger = getLogger(__name__)
 
dictionary gen_opts_types
 Default general options. More...
 
dictionary tgt_opts_types
 Default fitting target options. More...
 
 all_opts_names = list(itertools.chain(*[i.keys() for i in gen_opts_types.values()])) + list(itertools.chain(*[i.keys() for i in tgt_opts_types.values()]))
 
list iocc = []
 Check for uniqueness of option names. More...
 
dictionary gen_opts_defaults = {}
 Default general options - basically a collapsed veresion of gen_opts_types. More...
 
dictionary subdict = {}
 
dictionary tgt_opts_defaults = {}
 Default target options - basically a collapsed version of tgt_opts_types. More...
 
dictionary bkwd
 Option maps for maintaining backward compatibility. More...
 
list mainsections = ["SIMULATION","TARGET","OPTIONS","END","NONE"]
 Listing of sections in the input file. More...
 
dictionary ParsTab
 ParsTab that refers to subsection parsers. More...
 

Function Documentation

◆ parse_inputs()

def src.parser.parse_inputs (   input_file = None)

Parse through the input file and read all user-supplied options.

This is usually the first thing that happens when an executable script is called. Our parser first loads the default options, and then updates these options as it encounters keywords.

Each keyword corresponds to a variable type; each variable type (e.g. string, integer, float, boolean) is treated differently. For more elaborate inputs, there is a 'section' variable type.

There is only one set of general options, but multiple sets of target options. Each target has its own section delimited by the $target keyword, and we build a list of target options.

Parameters
[in]input_fileThe name of the input file.
Returns
options General options.
tgt_opts List of fitting target options.
Todo:

Implement internal coordinates.

Implement sampling correction.

Implement charge groups.

Definition at line 471 of file parser.py.

Here is the call graph for this function:

◆ printsection()

def src.parser.printsection (   heading,
  optdict,
  typedict 
)

Print out a section of the input file in a parser-compliant and readable format.

At the time of writing of this function, it's mainly intended to be called by MakeInputFile.py. The heading is printed first (it is something like $options or $target). Then it loops through the variable types (strings, allcaps, etc...) and the keys in each variable type. The one-line description of each key is printed out as a comment, and then the key itself is printed out along with the value provided in optdict. If optdict is None, then the default value is printed out instead.

Parameters
[in]headingHeading, either $options or $target
[in]optdictOptions dictionary or None.
[in]typedictOption type dictionary, either gen_opts_types or tgt_opts_types specified in this file.
Returns
Answer List of strings for the section that we are printing out.

Definition at line 374 of file parser.py.

◆ read_internals()

def src.parser.read_internals (   fobj)

Definition at line 348 of file parser.py.

◆ read_mvals()

def src.parser.read_mvals (   fobj)

Definition at line 323 of file parser.py.

◆ read_priors()

def src.parser.read_priors (   fobj)

Definition at line 339 of file parser.py.

◆ read_pvals()

def src.parser.read_pvals (   fobj)

Definition at line 331 of file parser.py.

Variable Documentation

◆ all_opts_names

src.parser.all_opts_names = list(itertools.chain(*[i.keys() for i in gen_opts_types.values()])) + list(itertools.chain(*[i.keys() for i in tgt_opts_types.values()]))

Definition at line 275 of file parser.py.

◆ bkwd

dictionary src.parser.bkwd
Initial value:
1 = {"simtype" : "type",
2  "masterfile" : "inter_txt",
3  "openmm_cuda_precision" : "openmm_precision",
4  "mdrun_threads" : "md_threads",
5  "mts_vvvr" : "mts_integrator",
6  "amoeba_polarization" : "amoeba_pol",
7  "liquid_prod_steps" : "liquid_md_steps",
8  "gas_prod_steps" : "gas_md_steps",
9  "liquid_equ_steps" : "liquid_eq_steps",
10  "gas_equ_steps" : "gas_eq_steps",
11  "lipid_prod_steps" : "lipid_md_steps",
12  "lipid_equ_steps" : "lipid_eq_steps",
13  }

Option maps for maintaining backward compatibility.

Definition at line 306 of file parser.py.

◆ gen_opts_defaults

dictionary src.parser.gen_opts_defaults = {}

Default general options - basically a collapsed veresion of gen_opts_types.

Definition at line 290 of file parser.py.

◆ gen_opts_types

dictionary src.parser.gen_opts_types

Default general options.

Note that the documentation is included in part of the key; this will aid in automatic doc-extraction. :) In the 5-tuple we have: Default value, priority (larger number means printed first), short docstring, description of scope, list of filter strings for pulling out pertinent targets (MakeInputFile.py)

Definition at line 67 of file parser.py.

◆ iocc

list src.parser.iocc = []

Check for uniqueness of option names.

Definition at line 278 of file parser.py.

◆ logger

src.parser.logger = getLogger(__name__)

Definition at line 62 of file parser.py.

◆ mainsections

list src.parser.mainsections = ["SIMULATION","TARGET","OPTIONS","END","NONE"]

Listing of sections in the input file.

Definition at line 321 of file parser.py.

◆ ParsTab

dictionary src.parser.ParsTab
Initial value:
1 = {"read_mvals" : read_mvals,
2  "read_pvals" : read_pvals,
3  "priors" : read_priors,
4  "internal" : read_internals
5  }

ParsTab that refers to subsection parsers.

Definition at line 352 of file parser.py.

◆ subdict

dictionary src.parser.subdict = {}

Definition at line 292 of file parser.py.

◆ tgt_opts_defaults

dictionary src.parser.tgt_opts_defaults = {}

Default target options - basically a collapsed version of tgt_opts_types.

Definition at line 298 of file parser.py.

◆ tgt_opts_types

dictionary src.parser.tgt_opts_types

Default fitting target options.

Definition at line 142 of file parser.py.