Display is too rich as default
cortner opened this issue · comments
I appreciate this is largely personal preference:
The extremely detailed and rich text-based summary of the Atoms
object is nice, but as a default I think it gives far too much information for my taste. I normally, want to see a very brief summary (cf Lux layers) and then the option to for a more detail. E.g. there could be a rich_display
function added to AtomsBase
.
How do others feel about this?
I am open to whatever. I have to dmit I'm also a little confused how much detail each of the printing functions are supposed to provide in julia.
My rationale for this was to have a brief default show function and a show for text/plain that gives the full overview. Especially for interactive work in the repl it's nice to get a visual interpretation and directly see changes to parameters.
Or are you concerned with the detail when using print?
I don't have strong feelings myself. I see Christoph's point that there are certainly scenarios where a long printout could be cumbersome and that argues for an alternative function to show more detail. However, the argument against that in my mind would be that a user might not be aware that that function exists and then feel frustrated that (they perceive that) there's no convenient way to display more detail...I suppose one (admittedly clunky) solution would be to add a little parenthetical thing into the output of the briefer one to tell the user about this other function, perhaps with an additional dispatch so it only displays once if you're calling it on an array of objects. I'm not sure if that's worth the inelegance, though...
If I have a unit cell as here
julia> AtomsBase.FlexibleSystem( bulk(:Si, pbc=true) )
FlexibleSystem(Si₂, periodic = TTT):
bounding_box : [ 0 2.715 2.715;
2.715 0 2.715;
2.715 2.715 0]u"Å"
Atom(Si, [ 0, 0, 0]u"Å")
Atom(Si, [ 1.3575, 1.3575, 1.3575]u"Å")
Si
Si
then Si₂, periodic = TTT
already tells me everything else. I don't see the rest as giving me additional information. If I want to double-check that the cell has a certain shape, positions etc then that's easy to do.
If I have a structure from a large simulation, then I think this is simply silly:
julia> AtomsBase.FlexibleSystem( rattle!( bulk(:Si, pbc=true)*10, 0.1 ) )
FlexibleSystem(Si₂₀₀₀, periodic = TTT):
bounding_box : [ 0 27.15 27.15;
27.15 0 27.15;
27.15 27.15 0]u"Å"
Si
SiSi
SiSi Si
SiSi SiSi Si
Si SiSi SiSSi SSiiSi
Si SiSi SSi SSSSi Si
Si SSi SiSi SSiSi SSi
Si SiSi SSSi SSSSiSiSiSiSi SiSi
SiSi SSii SiSiSiSSiSiiiSSiiSiiSiSi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Si SSSSiSiSSSSSSiSiSSSSiSiSSSSiSiSiSiSSSSSiSSSSSi SSi
Si SiSii SSSSiSiSSSSiSSiSSSSSiSiSSSSiSiSSSSiSiSSiiSSiSii
Si SiSiSiSiiSiSSiiSiiSSSSiiiSiSiSiSSiSiSiSSiiiSiSi Si
SiSiSi SiSiSiSiiSiSiSiSiiSiSiSiiSiSiiSiSiSiSiSiiSiSi
Si SiSiSiiSSiiSSiSiSSiiSSiSSiiSiiSiSiiSiSiSSiiSi Si
SSi SiSiiSSiSSiSiSiSiiSiSiSiSSiSiSiSiSiSSiSi SiSi
SSSi SSSSSSiSiSSiSiSiSSiSiSiSSiSSSiSiSSSSi
Si SSiSi SSSiSiSiSSSSiSiSSSSiSiSSiSSSiSi SSi
SSi SiSSi SSiSSSSiSiSiSiSSSSiSSSSiiiSiSi
Si SSSiiSiiSSSSiiSiSSSiiiSSiiSSiSiiiSiSi Si
Si SSiiSSiSiSSiiSiiSiSiiSiSiSSiiSi SiSi
SiSiSi SiSiSiSiSSiSiSSiiSiiSiSi SiSi Si
Si SiSiSiiSiSiSiiSiSiSiSiSi SiSi SiSi
SiSi SiSSi SSiSi SiSi SiSi Si
SSi SiSSi SSSi SSi Si
Si SSSSi SSi SiSi Si
SSii SSSii SSii Si
Si SSii Si Si
Si SiSi
SiSi
Si
Just add the rich display into the docs:
help?> AtomsBase.AbstractSystem
AbstractSystem{D}
A D-dimensional system.
Use `rich_display(system)` for a plain-text visualisation.
Suitable for small structures such as unitcells.
──────────────────────────────────────────────────────────────────────────────────────
AbstractSystem(system::AbstractSystem; kwargs...)
Update constructor. Construct a new system where one or more properties are changed,
which are given as kwargs. A subtype of AbstractSystem is returned, by default a
FlexibleSystem, but depending on the type of the passed system this might differ.
Supported kwargs include particles, atoms, bounding_box and boundary_conditions as
well as user-specific custom properties.
Examples
≡≡≡≡≡≡≡≡≡≡
Change the bounding box and the atoms of the passed system
julia> AbstractSystem(system; bounding_box= ..., atoms = ... )
an alternative option could be to have the rich display as default but add a global variable in AtomsBase that I can change to make it slim.
And btw, I can't use semi-colons, because I do want a little bit of visual feedback.
I agree. This is useless.
We should only do the extensive printing for small cells. You can always manually call the visualise function if you want (which we should document better).
I think adding it to the docstring makes the most sense. I'm also fine with only including the full bounding box in the detailed printout too, so that we can keep the default to be one or two lines.