question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Translate to unit cell - precision

See original GitHub issue

Don’t you think we could insert an optional offset to this method?

def translate2uc(..., offset=None):
    if isinstance(offset, float):
        d = np.ones(3) * offset
    elif isinstance(offset, list):
        d = np.array(offset)
    else:
        d = np.zeros(3)
    g = g.move(d)
    # do the existing stuff in this function
    g = g.move(-d)
    return g

I used this kind of shifts in two places in the geometries.

_Originally posted by @tfrederiksen in https://github.com/zerothi/sisl/issues/444#issuecomment-1059142958_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
zerothicommented, Mar 4, 2022

I would really try to refrain from using these tolerances, because you’ll end up truncating positional data (depending on the tolerance levels). And this is not the way to go since you are effectively shifting relative positions which the routines says nothing about. Therefore documenting such a feature in translate2uc would be cumbersome and it wouldn’t be consistent. In fact, the move can be achieved with:

geom.move(1e-5).translate2uc().move(-1e-5)

there is no need for the array.

0reactions
zerothicommented, Mar 4, 2022

Thanks for noticing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit Cells
We can translate this information into a unit-cell model for NaCl by remembering that the face-centered cubic unit cell is the simplest repeating...
Read more >
Interpretation of crystal structure determinations
A crystal can be described as a unit cell on which translation symmetry has been applied. Two examples of the ordering of molecules...
Read more >
The Cell object — ASE documentation - CAMD Wiki pages
The Cell object represents three lattice vectors forming a parallel epiped. ... Convert missing cell vectors into orthogonal unit vectors. copy()[source]¶.
Read more >
Fractional Coordinates - an overview | ScienceDirect Topics
Fractional coordinates are expressed as fractions of the unit cell in each of the three directions a, b, c separated by the angles...
Read more >
pymatgen.core.structure module
primitive (bool) – Whether to convert to a primitive cell Only available for cifs. ... tol (float) – A fractional tolerance to deal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found