JuliaMolSim / AtomsBase.jl

A Julian abstract interface for atomic structures.
https://juliamolsim.github.io/AtomsBase.jl/
MIT License
81 stars 16 forks source link

Add :diagonal option to test_approx_equal #73

Closed ejmeitz closed 1 year ago

ejmeitz commented 1 year ago

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.

ejmeitz commented 1 year ago

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 commented 1 year ago

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.

ejmeitz commented 1 year ago

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:

mfherbst commented 1 year ago

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.

ejmeitz commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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