Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
26 changes: 12 additions & 14 deletions wfl/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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 +34,28 @@ 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("calc")
@click.pass_context
def subcli_eval(ctx):
def subcli_calc(ctx):
"Calculate properties and descriptors."
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, quippy

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


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

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


29 changes: 25 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):
"""Calculte atomization energy"""
configs.atomization_energy(
inputs=inputs,
outputs=outputs,
Expand All @@ -104,3 +106,22 @@ def atomization_energy(inputs, outputs, prop_prefix, prop, isolated_atom_info_ke
)


@click.command("quippy")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this already under "descriptors" somehow? If not, we should possibly move it under such a category, first because quippy also provides potentials, and 2nd, because people might want to calculate ACE descriptors some day.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, this is the reason for this renaming. Currently I've merged what was in "eval" and "descriptors" into "calc", because things in both categories could be "calculated" (@gabor1 pointed out). Didn't think about quippy/ace doing both, properties and descriptors. Maybe instead should rename "eval" -> "calc-prop" & "descriptors" -> "calc-desc" or "calc-properties" & "calc-descriptors"? Just wfl descriptors would be fine, but wfl properties is maybe not as clear? Or should we just keep eval and descriptors? (It's not a big issue, but I thought I'd touch on this in the same PR"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is now "calc quippy"? Can you briefly list the relevant part of the nested command tree structure that's available now (as of this PR)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes; edited the PR description

@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("--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 quippy descriptors"""
wfl.descriptors.quippy.calc(
inputs=inputs,
outputs=outputs,
descs=descriptor,
key=key,
per_atom=local,
force=force
)

24 changes: 0 additions & 24 deletions wfl/cli/commands/descriptor.py

This file was deleted.

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