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

Density #28

Merged
merged 14 commits into from
Dec 25, 2018
Merged

Density #28

merged 14 commits into from
Dec 25, 2018

Conversation

sofiasanz
Copy link
Member

First attempt to add possibility to create a real space grid from a DensityMatrix sisl object to plot in real space physical quantities that involve densities (such as charge, charge difference, spin polarization...) to fix #13. In principle it works.

Copy link
Collaborator

@zerothi zerothi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments :)

import sisl

# Set new sc to create real-space grid
sc = sisl.SuperCell([self.xmax-self.xmin, self.ymax-self.ymin, 3.2])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you should use origo instead of move. It makes checking stuff easier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I found is that by only setting the origo of the geometry/supercell, only atoms with positive xyz coordinates appear in the plot, while negative ones don't. I'm not sure why...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I think is related to the wavefunction method, because when using a DensityMatrix object it works perfectly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, let me see if I can reproduce.
They should work similarly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can let me know which test shows this, I'll use that as a baseline?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try going to folder tests/ and run the file test-hubbard-plots.py which tests all plotting functionalities. In principle testing all these functions is not really necessary, since Charge, ChargeDifference, and SpinPolarization are very similar (the real space grid is created from a DensityMatrix object from sisl), while they differ from Wavefunction, where the real space grid is created from a wavefunction object (from sisl).
The one that I am having problems with is the latter one, while the other ones work fine when using origo instead of move. Let me know if you try and what you get :-).

Copy link
Collaborator

@zerothi zerothi Dec 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. The reason is that sisl currently handles unit-cells such that the specified coordinates must be within the unit-cell. If not spurious things may happen, see zerothi/sisl#102.

Hence, if you shift the atomic coordinates into the primary cell, it will work with origo... :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works by shifting only negative coordinates into the primary cell (see my last commit 90b2ed8) . I will merge this on the master branch now :-)

Since the realspace and orbitals functions in charge.py
and wavefunction.py are the same, defining them once in the
GeometryPlot class is enough
Since these functions are now defined in plot.py they can be used from
there.
…space

Since these functions are now defined in plot.py they can be used from
there.
…ions

Since these functions are now defined in plot.py the can be used
from there.
…ion.py

Since they are now defined in plot.py they can be used from there
@sofiasanz sofiasanz merged commit 7694db7 into master Dec 25, 2018
@sofiasanz sofiasanz deleted the density branch December 25, 2018 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Densities on 3D grids
2 participants