diff --git a/README.md b/README.md index 986fe92..51a9837 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ intended to help developers get started with their AiiDA plugins. * [`aiida_aimall/`](aiida_aimall/): The main source code of the plugin package * [`data/`](aiida_aimall/data/): A new `AimqbParameters` data class, used as input to the `AimqbCalculation` `CalcJob` class * [`calculations.py`](aiida_aimall/calculations.py): A new `AimqbCalculation` `CalcJob` class, and `GaussianWFXCalculation`, a modified version of `GaussianCalculation` from [AiiDA Gaussian](https://github.com/nanotech-empa/aiida-gaussian) - * [`cli.py`](aiida_aimall/cli.py): Extensions of the `verdi data` command line interface for the `AimqbParameters` class * [`parsers.py`](aiida_aimall/parsers.py): A new `Parser` for the `AimqbCalculation`, and `GaussianWFXParser`, a modified version of `GaussianBaseParser` from [AiiDA Gaussian](https://github.com/nanotech-empa/aiida-gaussian) * [`workchains.py`](aiida_aimall/workchains.py): New `WorkChains`. * * `MultiFragmentWorkChain` to fragment molecules using cml files from the Retrievium database and submit Gaussian calculations for the fragments using functions in `frag_functions` from [subproptools Github](https:github.com/kmlefran/group_decomposition) diff --git a/aiida_aimall/calculations.py b/aiida_aimall/calculations.py index 23da08d..51ea631 100644 --- a/aiida_aimall/calculations.py +++ b/aiida_aimall/calculations.py @@ -20,7 +20,7 @@ from aiida.plugins import DataFactory from pymatgen.io.gaussian import GaussianInput # pylint: disable=import-error -AimqbParameters = DataFactory("aimall") +AimqbParameters = DataFactory("aimall.aimqb") class AimqbCalculation(CalcJob): @@ -34,10 +34,10 @@ class AimqbCalculation(CalcJob): :: code = orm.load_code('aimall@localhost') - AimqbParameters = DataFactory("aimall") + AimqbParameters = DataFactory("aimall.aimqb") aim_params = AimqbParameters(parameter_dict={"naat": 2, "nproc": 2, "atlaprhocps": True}) file=SinglefileData(io.BytesIO(file_string.encode())) - AimqbCalculation = CalculationFactory("aimall") + AimqbCalculation = CalculationFactory("aimall.aimqb") builder = AimqbCalculation.get_builder() builder.parameters = aim_params builder.file = file diff --git a/aiida_aimall/cli.py b/aiida_aimall/cli.py deleted file mode 100644 index ac31343..0000000 --- a/aiida_aimall/cli.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Command line interface (cli) for aiida_aimall. - -Register new commands either via the "console_scripts" entry point or plug them -directly into the 'verdi' command by using AiiDA-specific entry points like -"aiida.cmdline.data" (both in the setup.json file). -""" -import sys - -import click -from aiida.cmdline.commands.cmd_data import verdi_data -from aiida.cmdline.params.types import DataParamType -from aiida.cmdline.utils import decorators -from aiida.orm import QueryBuilder -from aiida.plugins import DataFactory - - -# See aiida.cmdline.data entry point in setup.json -@verdi_data.group("aimall") -def data_cli(): - """Command line interface for aiida-aimall""" - - -@data_cli.command("list") -@decorators.with_dbenv() -def list_(): # pylint: disable=redefined-builtin - """ - Display all AimqbParameters nodes - """ - AimqbParameters = DataFactory("aimall") - - qb = QueryBuilder() - qb.append(AimqbParameters) - results = qb.all() - - s = "" - for result in results: - obj = result[0] - s += f"{str(obj)}, pk: {obj.pk}\n" - sys.stdout.write(s) - - -@data_cli.command("export") -@click.argument("node", metavar="IDENTIFIER", type=DataParamType()) -@click.option( - "--outfile", - "-o", - type=click.Path(dir_okay=False), - help="Write output to file (default: print to stdout).", -) -@decorators.with_dbenv() -def export(node, outfile): - """Export a AimqbParameters node (identified by PK, UUID or label) to plain text.""" - string = str(node) - - if outfile: - with open(outfile, "w", encoding="utf8") as f: - f.write(string) - else: - click.echo(string) diff --git a/aiida_aimall/controllers.py b/aiida_aimall/controllers.py index c386a01..b6a4fd3 100644 --- a/aiida_aimall/controllers.py +++ b/aiida_aimall/controllers.py @@ -10,9 +10,9 @@ from aiida.plugins import CalculationFactory, DataFactory, WorkflowFactory from aiida_submission_controller import FromGroupSubmissionController -AimqbParameters = DataFactory("aimall") -GaussianCalculation = CalculationFactory("gaussianwfx") -AimqbCalculation = CalculationFactory("aimall") +AimqbParameters = DataFactory("aimall.aimqb") +GaussianCalculation = CalculationFactory("aimall.gaussianwfx") +AimqbCalculation = CalculationFactory("aimall.aimqb") class G16FragController(FromGroupSubmissionController): @@ -24,7 +24,7 @@ class G16FragController(FromGroupSubmissionController): max_concurrent: int g16_opt_params: dict - WORKFLOW_ENTRY_POINT = "g16opt" + WORKFLOW_ENTRY_POINT = "aimall.g16opt" def __init__( self, @@ -76,7 +76,7 @@ class AimReorSubmissionController(FromGroupSubmissionController): max_concurrent: int code_label: str - WORKFLOW_ENTRY_POINT = "aimreor" + WORKFLOW_ENTRY_POINT = "aimall.aimreor" def __init__( self, @@ -141,7 +141,7 @@ class AimAllSubmissionController(FromGroupSubmissionController): code_label: str aim_parser: str - CALCULATION_ENTRY_POINT = "aimall" + CALCULATION_ENTRY_POINT = "aimall.aimqb" def __init__( self, @@ -216,7 +216,7 @@ class GaussianSubmissionController(FromGroupSubmissionController): code_label: str g16_sp_params: dict # GaussianWFXCalculation entry point as defined in aiida-aimall pyproject.toml - CALCULATION_ENTRY_POINT = "gaussianwfx" + CALCULATION_ENTRY_POINT = "aimall.gaussianwfx" def __init__( self, diff --git a/aiida_aimall/parsers.py b/aiida_aimall/parsers.py index 39af005..008abad 100644 --- a/aiida_aimall/parsers.py +++ b/aiida_aimall/parsers.py @@ -21,7 +21,7 @@ # from aiida.engine import ExitCode -AimqbCalculation = CalculationFactory("aimall") +AimqbCalculation = CalculationFactory("aimall.aimqb") class AimqbBaseParser(Parser): diff --git a/docs/source/user_guide/get_started.rst b/docs/source/user_guide/get_started.rst index 5f800b6..10c4cd4 100644 --- a/docs/source/user_guide/get_started.rst +++ b/docs/source/user_guide/get_started.rst @@ -2,6 +2,8 @@ Getting started =============== +This guide was written for my group, but still including in docs for now - maybe you will find it useful. Near complete AiiDA setup and instructions. + Installation ++++++++++++ @@ -78,9 +80,7 @@ Step 8: Install aiida-aimall ---------------------------- :: - git clone https://github.com/kmlefran/aiida-aimall . - cd aiida-aimall - pip install -e . # also installs aiida, if missing (but not postgres) + pip install aiida-aimall #verify that entry points are registered verdi plugin list aiida.calculations # should show aimall and gaussianwfx verdi plugin list aiida.parsers # should show aimqb.base and gaussianwfx diff --git a/example/aiida-aimall_example.ipynb b/example/aiida-aimall_example.ipynb index 04a0432..9738ce6 100644 --- a/example/aiida-aimall_example.ipynb +++ b/example/aiida-aimall_example.ipynb @@ -77,7 +77,7 @@ "# load controllers\n", "from aiida_aimall.controllers import AimAllSubmissionController, AimReorSubmissionController, GaussianSubmissionController, G16FragController\n", "# load the first workchain\n", - "MultiFragmentWorkChain = WorkflowFactory('multifrag')\n", + "MultiFragmentWorkChain = WorkflowFactory('aimall.multifrag')\n", "\n", "#Restart the daemons just to make sure they are on\n", "%verdi daemon stop\n", diff --git a/pyproject.toml b/pyproject.toml index 3350bda..fa92788 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,25 +80,25 @@ docs = [ ] [project.entry-points."aiida.data"] -"aimall" = "aiida_aimall.data:AimqbParameters" +"aimall.aimqb" = "aiida_aimall.data:AimqbParameters" [project.entry-points."aiida.calculations"] -"aimall" = "aiida_aimall.calculations:AimqbCalculation" -"gaussianwfx" = "aiida_aimall.calculations:GaussianWFXCalculation" +"aimall.aimqb" = "aiida_aimall.calculations:AimqbCalculation" +"aimall.gaussianwfx" = "aiida_aimall.calculations:GaussianWFXCalculation" [project.entry-points."aiida.parsers"] -"aimqb.base" = "aiida_aimall.parsers:AimqbBaseParser" -"aimqb.group" = "aiida_aimall.parsers:AimqbGroupParser" -"gaussianwfx" = "aiida_aimall.parsers:GaussianWFXParser" +"aimall.base" = "aiida_aimall.parsers:AimqbBaseParser" +"aimall.group" = "aiida_aimall.parsers:AimqbGroupParser" +"aimall.gaussianwfx" = "aiida_aimall.parsers:GaussianWFXParser" [project.entry-points."aiida.workflows"] -"multifrag" = "aiida_aimall.workchains:MultiFragmentWorkChain" -"g16opt" = "aiida_aimall.workchains:G16OptWorkchain" -"aimreor" = "aiida_aimall.workchains:AIMAllReor" -"optaimreor" = "aiida_aimall.workchains:OptAimReorSPAimWorkChain" +"aimall.multifrag" = "aiida_aimall.workchains:MultiFragmentWorkChain" +"aimall.g16opt" = "aiida_aimall.workchains:G16OptWorkchain" +"aimall.aimreor" = "aiida_aimall.workchains:AIMAllReor" +"aimall.optaimreor" = "aiida_aimall.workchains:OptAimReorSPAimWorkChain" -[project.entry-points."aiida.cmdline.data"] -"aimall" = "aiida_aimall.cli:data_cli" +#[project.entry-points."aiida.cmdline.data"] +#"aimall" = "aiida_aimall.cli:data_cli" [tool.flit.module] name = "aiida_aimall"