GithubHelp home page GithubHelp logo

`only` or `what`? about sisl HOT 11 CLOSED

tfrederiksen avatar tfrederiksen commented on August 21, 2024
`only` or `what`?

from sisl.

Comments (11)

tfrederiksen avatar tfrederiksen commented on August 21, 2024 1

Good. By the way, I think what='xyz' could be the better default in rotate. At least I have never used rotation of axes and thus need to set this keyword every time.

from sisl.

zerothi avatar zerothi commented on August 21, 2024

I agree. Unification!
Grep for what, only, which, how, others we could have used, to ensure we get all.

from sisl.

zerothi avatar zerothi commented on August 21, 2024
sisl % grep -E "[^A-Za-z0-9_](only|which|what|how)[^A-Za-z0-9_]" **/*.py | grep " def "                                                                                                          main
geometry.py:    def rotate(self, angle, v, origin=None, atoms: Optional[AtomsArg]=None, only='abc+xyz', rad=False) -> Geometry:
geometry.py:    def center(self, atoms: Optional[AtomsArg]=None, what="xyz") -> ndarray:
geometry.py:    def scale(self, scale, what="abc", scale_atoms=True) -> Geometry:
io/tbtrans/tbt.py:    def orbital_transmission(self, E, elec=0, kavg=True, isc=None, only="all", orbitals=None) -> csr_matrix:
io/tbtrans/tbt.py:    def orbital_current(self, elec=0, elec_other=1, kavg=True, isc=None, only="all", orbitals=None) -> csr_matrix:
io/tbtrans/tbt.py:    def bond_transmission(self, E, elec=0, kavg=True, isc=None, only="all", orbitals=None, uc=False) -> csr_matrix:
io/tbtrans/tbt.py:    def bond_current(self, elec=0, elec_other=1, kavg=True, isc=None, only="all", orbitals=None, uc=False) -> csr_matrix:
io/tbtrans/tbt.py:    def vector_transmission(self, E, elec=0, kavg=True, isc=None, only="all", orbitals=None) -> ndarray:
io/tbtrans/tbt.py:    def vector_current(self, elec=0, elec_other=1, kavg=True, isc=None, only="all", orbitals=None) -> ndarray:
sparse_geometry.py:    def rij(self, what='orbital', dtype=np.float64):
sparse_geometry.py:    def Rij(self, what='orbital', dtype=np.float64):
supercell.py:    def rotate(self, angle, v, only='abc', rad=False):
supercell.py:    def scale(self, scale, what="abc"):
viz/input_fields/orbital.py:    def _split_query(self, query, on, only=None, exclude=None, query_gen=None, ignore_constraints=False, **kwargs):
viz/input_fields/orbital.py:    def _generate_queries(self, on, only=None, exclude=None, query_gen=None, **kwargs):
viz/plots/fatbands.py:    def split_groups(self, on="species", only=None, exclude=None, clean=True, colors=(), **kwargs):
viz/plots/pdos.py:    def split_requests(self, *i_or_names, on="species", only=None, exclude=None, remove=True, clean=False, ignore_constraints=False, **kwargs):
viz/plots/pdos.py:    def split_DOS(self, on="species", only=None, exclude=None, clean=True, **kwargs):

from sisl.

zerothi avatar zerothi commented on August 21, 2024

@tfrederiksen do you have a suggestion for tbtrans, should we change those?

from sisl.

tfrederiksen avatar tfrederiksen commented on August 21, 2024

I think what would work in all cases above.

from sisl.

tfrederiksen avatar tfrederiksen commented on August 21, 2024

Well, maybe the meaning is somewhat different in viz with only and exclude?

from sisl.

zerothi avatar zerothi commented on August 21, 2024

Well, maybe the meaning is somewhat different in viz with only and exclude?

true, lets keep them.

from sisl.

zerothi avatar zerothi commented on August 21, 2024

Good. By the way, I think what='xyz' could be the better default in rotate. At least I have never used rotation of axes and thus need to set this keyword every time.

actually, changing the default to "xyz" breaks the nanoribbon and bilayer creation routines since they rely on also rotating the lattice vectors.
I can see that there may be multiple use-cases.

  1. When rotating geometries for attaching them, "xyz+abc" is preferred,
  2. When rotating sub-segments "xyz" is preferred.

So which has precedence? I think you are correct that 2. is mostly used, so lets stick with that, this is just to at least be aware of the implications.

from sisl.

tfrederiksen avatar tfrederiksen commented on August 21, 2024

OK I see. Would it make sense that what="xyx" is the default if atoms is specified, otherwise "xyz+abc"?

from sisl.

zerothi avatar zerothi commented on August 21, 2024

I think that complicates things... I have this somewhere, but when you don't use the routines often, then it makes more sense to have a stable default... well, I don't know.

Is my above understanding even correct, are there other cases I haven't thought of?

from sisl.

zerothi avatar zerothi commented on August 21, 2024

OK I see. Would it make sense that what="xyx" is the default if atoms is specified, otherwise "xyz+abc"?

Implementing this and fixing stuff all-around made me convinced that it is ok to have two different defaults, I have done as you suggested ;)

from sisl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.