-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discussion] Input parsing without Getkw #88
Comments
The input file is "touched" when the program is running. @robertodr said is because everything is made uppercase. Still that should happen in the cache and not directly to the file on disk. This is (mildly) annoying when one is performing many tests with small modifications to the same input, because the editor complains the file has been modified. |
Would you want to consider PCMSolver only taking JSON/py-dict input, with QC progs responsible for generating it from their native options parsing (perhaps this is "piggypacking"). Then perhaps PCMSolver additionally does a light str --> json or argparse --> json utility so it can be run independently. Related discussion at https://github.com/MolSSI/QC_JSON_Schema , though admittedly Mol-centered at present |
Thanks @loriab. Admittedly, I'd prefer YAML (less curly braces around 😺), but anything that is a standard format and would relieve me from doing most of the work in defining it, is very welcome. These are the flows of the input I am envisioning:
QC program pseudocode for route i.
QC program pseudocode for route ii.
Route ii. looks more elegant, but it will require more work in order to maintain the C and Fortran wrappers to the C++ JSON library. |
This thread is a Request For Comments on how to rewrite input parsing.
@ilfreddy @arnfinn @bast Please comment on any of the following sections. @loriab I would also appreciate your input on this matter, if you have the time.
Goals to achieve
Current situation
Input can go through two, mutually exclusive, routes:
Input
class that contains all information read in. In the class,struct
s with input for specific classes (i.e. for the cavity, the Green's functions, the solvers etc.) are generated and passed onto the factory functions for object creation (look at the flow of the code inMeddle.cpp
)struct
with input parameters set, usually from its own input parser. The input so passed is only a subset of the possible input to PCMSolver. This makes the second route not usable for most (if not all of) the recent functionality introduced.Drawbacks
With Psi4 this is relatively easy: it's just integrating one small Python module into other Python modules. Plus, the look-and-feel of Psi4 and PCMSolver input are similar enough not to disconcert the user. Piggybacking on e.g. DALTON's input format would be harder to do.
boost::any
. Soon to be banned (together with all of Boost)Suggested solution
The suggested solution is to remove Getkw altogether:
Input
object would go away for good.and move towards a data-passing-based solution, i.e. extending current route number 2 to cover all of the input needed by PCMSolver. This is a top-down perspective:
pcmsolver_new
API function would accept one single parameter, astruct
calledPCMSolverInput
that collects all host program input to the module, in atomic units:pcmsolver_new
function would in turn invoke the constructor of theMeddle
object.[^2] Instead of generating a wholeInput
object from the passedPCMSolverInput
struct
, it would unpack thestruct
(pattern matching of sorts) into smallerstruct
s to feed to the factory function generating the cavity, Green's function and so forth. This touches on Input reading #52Why/How would this automatize documentation of input?
Because we could attach Doxygen documentation strings to the various fields on the
PCMSolverInput
struct
.Challenges
struct
and the Fortran 90 user definedtype
right. Thestruct
will need to have strings and array fields.Notes
[^1] The input to PCMSolver is embedded in the host input and unpacked into a different input file in the scratch directory at run time. The PCMSolver Python script then does its own parsing.
[^2] The
Meddle
class is the one responsible for routing the computation to the correct internal objects. The C++ API, if you wish.The text was updated successfully, but these errors were encountered: