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

Improve convenience constructors for included implementations #27

Open
rkurchin opened this issue Nov 17, 2021 · 1 comment
Open

Improve convenience constructors for included implementations #27

rkurchin opened this issue Nov 17, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@rkurchin
Copy link
Collaborator

They're a bit too rigid right now and should ideally be flexible to anything (different types of vectors, tuples, etc.) that might be thrown at them to specify systems.

@rkurchin rkurchin added the enhancement New feature or request label Nov 17, 2021
@rkurchin rkurchin mentioned this issue Nov 17, 2021
@cortner
Copy link
Member

cortner commented Nov 17, 2021

The way I did it in JuLIP was to have a conversion interface e.g.

_convert_positions(X::Vector) = X 
_convert_positions(X::AbstractVector) = collect(X) 
_convert_positions(X::AbstractMatrix) = # convert into vector of SVectors 

_convert_bc(bc::NTuple{3, Bool}) = bc 
_convert_bc(bc::AbstractVector) = tuple(Bool.(bc)...)

and so forth. So this means that ANY sensible input will be automatically converted into the format needed internally. And it is easy to add new conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants