From 05072bff6c6e040a7afc9f958e6376a260c82231 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Sat, 29 Jan 2022 10:04:53 -0500 Subject: [PATCH 1/2] Standardizing black to exclude _version.py --- .github/workflows/BranchCI.yaml | 2 +- .github/workflows/CI.yaml | 2 +- .github/workflows/Release.yaml | 2 +- Makefile | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/BranchCI.yaml b/.github/workflows/BranchCI.yaml index eeb3f08..3a56769 100644 --- a/.github/workflows/BranchCI.yaml +++ b/.github/workflows/BranchCI.yaml @@ -35,7 +35,7 @@ jobs: - name: Run linters shell: bash -l {0} run: | - black --check --diff read_structure_step tests + black --extend-exclude '_version.py' --check --diff read_structure_step tests flake8 read_structure_step tests - name: Run tests shell: bash -l {0} diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 04783ef..cbdef34 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -43,7 +43,7 @@ jobs: - name: Run linters shell: bash -l {0} run: | - black --check --diff read_structure_step tests + black --extend-exclude '_version.py' --check --diff read_structure_step tests flake8 read_structure_step tests test: diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml index 70415a2..4f74325 100644 --- a/.github/workflows/Release.yaml +++ b/.github/workflows/Release.yaml @@ -36,7 +36,7 @@ jobs: - name: Run linters shell: bash -l {0} run: | - black --check --diff read_structure_step tests + black --extend-exclude '_version.py' --check --diff read_structure_step tests flake8 read_structure_step tests test: diff --git a/Makefile b/Makefile index 65fdf5b..a3c6fb6 100644 --- a/Makefile +++ b/Makefile @@ -50,11 +50,11 @@ clean-test: ## remove test and coverage artifacts find . -name '.pytype' -exec rm -fr {} + lint: ## check style with black and flake8 - black --check --diff $(MODULE) tests + black --extend-exclude '_version.py' --check --diff $(MODULE) tests flake8 $(MODULE) tests -format: ## reformat with with yapf and isort - black $(MODULE) tests +format: ## reformat with with black + black --extend-exclude '_version.py' $(MODULE) tests typing: ## check typing pytype $(MODULE) From 414b5b1931bb8dd473b4f9999f1bf281f0cf1bed Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Sun, 6 Feb 2022 16:53:06 -0500 Subject: [PATCH 2/2] Cleaned up the output and added space group symmetry. --- read_structure_step/read_structure.py | 38 ++++++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/read_structure_step/read_structure.py b/read_structure_step/read_structure.py index 3daff9b..84ce4e0 100644 --- a/read_structure_step/read_structure.py +++ b/read_structure_step/read_structure.py @@ -13,6 +13,7 @@ import logging from pathlib import PurePath, Path +import textwrap from .formats.registries import get_format_metadata import read_structure_step @@ -110,7 +111,8 @@ def description_text(self, P=None): else: text += seamm.standard_parameters.structure_handling_description(P) - return text + text = textwrap.fill(text, initial_indent=4 * " ", subsequent_indent=4 * " ") + return self.header + "\n" + text def run(self): """Run a Read Structure step.""" @@ -141,7 +143,7 @@ def run(self): P["file type"] = extension # Print what we are doing - printer.important(__(self.description_text(P), indent=4 * " ")) + printer.important(self.description_text(P)) # Read the file into the system system_db = self.get_variable("_system_db") @@ -168,15 +170,31 @@ def run(self): ) # Finish the output - printer.important( - __( - f"\n Created a molecular structure with {configuration.n_atoms} " - "atoms." - f"\n System name = {system.name}" - f"\n Configuration name = {configuration.name}", - indent=4 * " ", + if configuration.periodicity == 3: + space_group = configuration.symmetry.group + if space_group == "": + symmetry_info = "" + else: + symmetry_info = f" The space group is {space_group}." + printer.important( + __( + f"\n Created a periodic structure with {configuration.n_atoms} " + f"atoms.{symmetry_info}" + f"\n System name = {system.name}" + f"\n Configuration name = {configuration.name}", + indent=4 * " ", + ) + ) + else: + printer.important( + __( + f"\n Created a molecular structure with {configuration.n_atoms} " + "atoms." + f"\n System name = {system.name}" + f"\n Configuration name = {configuration.name}", + indent=4 * " ", + ) ) - ) printer.important("") return next_node