Skip to content

Conversation

@nakul680
Copy link
Collaborator

@nakul680 nakul680 commented Nov 12, 2025

Closes #62

  • Created Input.format_before_coords() and Input.format_after_coords() . These methods are then called by Calculator.write_input()

@nakul680 nakul680 self-assigned this Nov 12, 2025
@nakul680 nakul680 requested a review from timmyte November 12, 2025 14:07
@timmyte
Copy link
Contributor

timmyte commented Nov 13, 2025

Closes #62

* Created Input.format_before_coords() and Input.format_after_coords() . These methods are then called by Calculator.write_input()

Please put code snippets into backticks.

Raises
------
ValueError
If the working directory is empty
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add comment to the line where the Exception might be raised.

Raises
------
ValueError
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add more details. When is this raised?
Can this be raised at every point in the function?

# ---------------------------------
# > Block options: After coords
# ---------------------------------
if blocks:
Copy link
Contributor

Choose a reason for hiding this comment

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

The if can be omitted, as blocks is an empty list, so the for-loop does nothing.

# ---------------------------------
# > Block Options: Before coords
# ---------------------------------
if blocks:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add more details. When is this raised?
Can this be raised at every point in the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you clarify this point a bit more?

Copy link
Contributor

@timmyte timmyte Nov 13, 2025

Choose a reason for hiding this comment

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

Sorry.
Looks like I placed the comment on the wrong line.
It's meant to apply to this part here:

        Raises
        ------
        ValueError
            If the working directory is empty


assert self.inpfile is not None
with self.inpfile.open("w") as inp:
with open(self._inpfile, "w") as inp:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would you change the open() method?

for item in arbitrary_strings:
if item.pos is ArbitraryStringPos.TOP:
inp.write(f"{item.format_orca()}\n")
input_string_before_coords = input_param.format_before_coords(self.working_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
input_string_before_coords = input_param.format_before_coords(self.working_dir)
inp.write(
input_param.format_before_coords(
self.working_dir
))

for block in blocks:
if block.aftercoord:
inp.write(f"\n{block.format_orca()}\n")
input_string_after_coords = input_param.format_after_coords()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
input_string_after_coords = input_param.format_after_coords()
inp.write(
input_param.format_after_coords()
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Input.format()"

2 participants