Skip to content
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

Some cli renames #241

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions wfl/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
@click.option("--verbose", "-v", is_flag=True)
@click.pass_context
def cli(ctx, verbose):
"""Workflow command line interface.
"""
"""Workflow command line interface."""
ctx.ensure_object(dict)
ctx.obj["verbose"] = verbose

Expand All @@ -23,6 +22,7 @@ def cli(ctx, verbose):
@cli.group("generate")
@click.pass_context
def subcli_generate(ctx):
"""Generate structures"""
pass

from wfl.cli.commands.generate import smiles, buildcell
Expand All @@ -33,31 +33,37 @@ def subcli_generate(ctx):
@cli.group("select")
@click.pass_context
def subcli_select(ctx):
"""Select structures from database"""
pass

from wfl.cli.commands.select import cur, by_lambda
subcli_select.add_command(cur)
subcli_select.add_command(by_lambda)


@cli.group("eval")
@cli.group("calculator")
@click.pass_context
def subcli_eval(ctx):
def subcli_calc(ctx):
"""Calculate properties"""
pass

from wfl.cli.commands.eval import gap, ace, mace, atomization_energy
subcli_eval.add_command(gap)
subcli_eval.add_command(ace)
subcli_eval.add_command(mace)
subcli_eval.add_command(atomization_energy)
from wfl.cli.commands.calc import gap, ace, mace, atomization_energy

subcli_calc.add_command(gap)
subcli_calc.add_command(ace)
subcli_calc.add_command(mace)
subcli_calc.add_command(atomization_energy)


@cli.group("descriptor")
@click.pass_context
def subcli_descriptor(ctx):
"""Calculate descriptors"""
pass

from wfl.cli.commands.descriptor import quippy
from wfl.cli.commands.descriptor import quippy
subcli_descriptor.add_command(quippy)





10 changes: 6 additions & 4 deletions wfl/cli/commands/eval.py → wfl/cli/commands/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from wfl.cli import cli_options as opt
from wfl.calculators import generic
from wfl.utils import configs
import wfl.descriptors.quippy


@click.command("gap")
Expand All @@ -16,7 +17,7 @@
@opt.prop_prefix
@opt.num_inputs_per_python_subprocess
def gap(ctx, inputs, outputs, param_fname, prop_prefix, num_inputs_per_python_subprocess):
"""evaluates GAP"""
"""evaluate GAP"""

if prop_prefix is None:
prop_prefix="gap_"
Expand Down Expand Up @@ -44,7 +45,7 @@ def pyjulip_ace(param_fname):
@opt.prop_prefix
@opt.num_inputs_per_python_subprocess
def ace(ctx, inputs, outputs, param_fname, prop_prefix, num_inputs_per_python_subprocess):
"""evaluates ACE"""
"""evaluate ACE"""

if prop_prefix is None:
prop_prefix = 'ace_'
Expand All @@ -68,7 +69,7 @@ def ace(ctx, inputs, outputs, param_fname, prop_prefix, num_inputs_per_python_su
@opt.prop_prefix
@opt.num_inputs_per_python_subprocess
def mace(ctx, inputs, outputs, param_fname, prop_prefix, num_inputs_per_python_subprocess, dtype):
"""evaluates MACE"""
"""evaluate MACE"""

from mace.calculators.mace import MACECalculator

Expand All @@ -93,7 +94,8 @@ def mace(ctx, inputs, outputs, param_fname, prop_prefix, num_inputs_per_python_s
help="``atoms.info`` key on which to select isolated atoms")
@click.option("--isolated-atom-info-value", "-v", default="default",
help="``atoms.info['isolated_atom_info_key']`` value for isolated atoms. Defaults to \"IsolatedAtom\" or \"isolated_atom\"")
def atomization_energy(inputs, outputs, prop_prefix, prop, isolated_atom_info_key, isolated_atom_info_value):
def atomization_energy(ctx, inputs, outputs, prop_prefix, prop, isolated_atom_info_key, isolated_atom_info_value):
"""Calculate atomization energy"""
configs.atomization_energy(
inputs=inputs,
outputs=outputs,
Expand Down
6 changes: 2 additions & 4 deletions wfl/cli/commands/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
@click.pass_context
@click.option("--local", is_flag=True, help="calculate a local (per-atom) descriptor")
@click.option("--force", is_flag=True, help="overwrite existing info or arrays item if present")
@click.option("--descriptor", type=click.STRING, required=True, help="quippy.descriptors.Descriptor arg string")
@click.option("--descriptor", type=click.STRING, required=True, help="quippy.Descriptor arg string")
@click.option("--key", required=True, type=click.STRING, help="Atoms.info (global) or Atoms.arrays (local) for descriptor vector")
@opt.inputs
@opt.outputs
def quippy(ctx, inputs, outputs, descriptor, key, local, force):
calculate_descriptor(inputs, outputs, descriptor, key, local, force)

def calculate_descriptor(inputs, outputs, descriptor, key, local, force):
"""Calculate quippy descriptors"""
wfl.descriptors.quippy.calc(
inputs=inputs,
outputs=outputs,
Expand Down
2 changes: 1 addition & 1 deletion wfl/cli/commands/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def show_error(ctx, inputs, calc_property_prefix, ref_property_prefix,
config_properties, atom_properties, category_keys,
weight_property, precision, fig_name, error_type,
cmap):
"""Prints error summary table"""
"""Print error summary table and plot parity plot"""
# TODO
# - clean up cmap

Expand Down
2 changes: 1 addition & 1 deletion wfl/cli/commands/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def cur(ctx, inputs, outputs, n_configs, key, keep_descriptor,
@opt.inputs
@opt.outputs
def by_lambda(ctx, inputs, outputs, exec_code):
"""selects atoms based on a lambda function"""
"""Select atoms based on a lambda function"""

at_filter_fun = eval("lambda atoms: " + exec_code)

Expand Down