MolSSI / QCEngine

Quantum chemistry program executor and IO standardizer (QCSchema).
https://molssi.github.io/QCEngine/
BSD 3-Clause "New" or "Revised" License
161 stars 78 forks source link

[SUGGESTION] berny procedure engine specification change #302

Open coltonbh opened 3 years ago

coltonbh commented 3 years ago

Is your feature request related to a problem? Please describe.

The BernyProcedure currently gets the compute engine to use from the keywords dictionary used to define keywords for the optimization procedure. I think it would be cleaner to get the engine value from the specification of the compute model instead. This would keep all keywords related to the compute engine in one dictionary, and all keywords related to the optimization in the other keywords dictionary.

The way it currently is

water = Molecule.from_data("pubchem:water")

input_spec = QCInputSpecification(
    driver="gradient",
    model={"method": "b3lyp", "basis": "6-31g"},
    # Keywords for compute engine
    keywords={"psi4keyword": "psi4value"},
)

opt_input = OptimizationInput(
    initial_molecule=water,
    input_specification=input_spec,
    protocols={"trajectory": "all"},
    # Define compute engine and keywords for pyberny
    # This seems an odd combination of keywords
    keywords={"program": "psi4", "bernykeyword": "bernyvalue"},
)

qcng.compute_procedure(opt_input, 'berny')

Then this line gets the "program" keyword to get a compute engine.

Describe the solution you'd like

water = Molecule.from_data("pubchem:water")

input_spec = QCInputSpecification(
    driver="gradient",
    model={"method": "b3lyp", "basis": "6-31g"},
    # QC program and its associated keywords kept together
    keywords={"program": "psi4", "psi4keyword": "psi4value"},
)

opt_input = OptimizationInput(
    initial_molecule=water,
    input_specification=input_spec,
    protocols={"trajectory": "all"},
    # Don't mix the program definition with keywords specific to the optimizer
    keywords={"bernykeyword1": "bernyvalue1"},
)

qcng.compute_procedure(opt_input, 'berny')

Change this line as follows:

Current:

program = input_data["keywords"].pop("program")

Desired:

program = comput["keywords"].pop("program")

Since geometric uses a different (internal) mechanism for accessing compute engines, this change would only affect the BernyProcedure

coltonbh commented 3 years ago

Actually, perhaps the confusion (for me) around where the "program" is defined would be better addressed by this proposal instead, which seeks to improve a few of the issues I came across while implementing various procedures. https://github.com/MolSSI/QCElemental/issues/264