Skip to content

Commit

Permalink
Merge pull request #28 from paulsaxe/main
Browse files Browse the repository at this point in the history
Cleaned up the output and added space group symmetry to output.
  • Loading branch information
seamm authored Feb 8, 2022
2 parents 5a7880c + ba2b07d commit 96060ed
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/BranchCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
38 changes: 28 additions & 10 deletions read_structure_step/read_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import logging
from pathlib import PurePath, Path
import textwrap

from .formats.registries import get_format_metadata
import read_structure_step
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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")
Expand All @@ -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

0 comments on commit 96060ed

Please sign in to comment.