Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :diagonal option to test_approx_equal #73

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

ejmeitz
Copy link
Contributor

@ejmeitz ejmeitz commented Jun 3, 2023

Added option :diagonal to AtomsBaseTesting test_approx_equal. The current options are not compatible with Molly.jl (triclinic & DirichletZero) and I would like to test against a valid system.

Also is DirhichletZero supposed to be a hard wall or infinite domain or something else? Doesn't really make a difference for Molly but its not really clear from docs and not something I've ever seen in a molecular simulation context.

Added option `:diagonal` to AtomsBaseTesting `test_approx_equal`. The current options are not compatible with Molly.jl (triclinic & DirichletZero) and I would like to test against a valid system.

Also is `DirhichletZero` supposed to be a hard wall or infinite domain or something else?  Doesn't really make a difference for Molly but its not really clear from docs and not something I've ever seen in a molecular simulation context.
Copy link
Member

@mfherbst mfherbst left a comment

Choose a reason for hiding this comment

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

Lgtm.

Could you also use it one of the tests to ensure it's covered?

The dirichletzero is meant to be a zero bc at the end of the simulation cell. Makes sense for isolated systems. Potentially the cell is infinite, but might not be (e.g. finite element cases).

Add :diagonal to tests
@ejmeitz
Copy link
Contributor Author

ejmeitz commented Jun 4, 2023

In that case, DirichletZero is not supported by Molly at all. For now I could add an option to make the test system purely periodic, but I'm also a little confused as to why Infinite is not just another boundary option? I see there is some support but its in a different part of the interface.

@mfherbst
Copy link
Member

mfherbst commented Jun 5, 2023

In that case, DirichletZero is not supported by Molly at all.

What you can always do is warn the user about this and simply ignore the boundary condition (BC). Thus it will effectively always be periodic. The other option is to error out. I don't think it is a good idea to add an option to Molly to change the BC. Rather we should have a generic way in AtomsBase to change BCs.

I'm also a little confused as to why Infinite is not just another boundary option

Because the size of the simulation box and the BC are two different concepts. You can have periodic, dirichlet, neumann, ... BCs also for infinite cells.

@mfherbst mfherbst enabled auto-merge (squash) June 5, 2023 05:18
@mfherbst mfherbst disabled auto-merge June 5, 2023 05:18
@mfherbst mfherbst changed the title Update AtomsBaseTesting.jl Add :diagonal option to test_approx_equal Jun 5, 2023
@mfherbst mfherbst enabled auto-merge (squash) June 5, 2023 05:18
@mfherbst mfherbst disabled auto-merge June 5, 2023 05:19
@ejmeitz
Copy link
Contributor Author

ejmeitz commented Jun 5, 2023

Tests should pass now.

Sounds good, that shouldn't be too crazy to add right? I can make a different PR, but just to outline what I'm thinking:

  • A function update_boundary_condition(sys::AbstractSystem, new_bc::Vector{Union{Periodic,DirichletZero}) and it just copies over the data from sys into a new AbstractSystem with the bc passed.
  • Might also be nice to support only semi-infinite domains (e.g. Inf in only a few dimensions)

@mfherbst
Copy link
Member

mfherbst commented Jun 5, 2023

I can make a different PR, but just to outline what I'm thinking:

Yes please do. I would not use a different function for this. We have "update constructors". Take a look at the atom implementation for example. We should do the same with systems.

@mfherbst mfherbst enabled auto-merge (squash) June 5, 2023 16:53
@mfherbst mfherbst merged commit 8455523 into JuliaMolSim:master Jun 5, 2023
@ejmeitz
Copy link
Contributor Author

ejmeitz commented Jun 7, 2023

@mfherbst Turns out that constructor exists already, is there something else you were referring to than the code below?

https://github.com/JuliaMolSim/AtomsBase.jl/blob/master/src/flexible_system.jl#L87

@mfherbst
Copy link
Member

mfherbst commented Jun 7, 2023

Indeed. Perfect. It seems all that's missing is a nice example in the documentation.

@ejmeitz Would you mind adding one plus a bit of explanation?

@ejmeitz
Copy link
Contributor Author

ejmeitz commented Jun 15, 2023

Already there in the tutorial guess I'm just blind.

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.

2 participants