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

Do you know of a way to integrate density within a particular Miller (HKL) plane? #96

Open
sgbaird opened this issue Feb 24, 2022 · 8 comments

Comments

@sgbaird
Copy link

sgbaird commented Feb 24, 2022

For an arbitrary crystal structure and an arbitrary Miller plane (e.g. 110), integrate the density across the polygon that's bounded within the unit cell.

@jmmshn
Copy link
Collaborator

jmmshn commented Mar 20, 2022

Hi, @sgbaird I think will have to define a grid and a set of inequalities to create a mask for that grid then apply the mask and get the integrated charge.

@mkhorton
Copy link
Member

mkhorton commented Apr 4, 2022

I'm actually interested in this or similar functionality too. I'm wondering what a convenience method might look like:

def get_density_orientated_by_plane(self, hkl: Tuple[float, float, float]) -> np.ndarray:
    """
    Converts charge density to conventional setting, rotates charge density to 
    align with chosen plane defined by its Miller indices, and returns a 3D 
    array that can be sliced and integrated as necessary.
    """
    ...

def get_density_through_sites(self, sites: Tuple[PeriodicSite, ...]) -> np.ndarray:
    """
    Same as above, but calculates plane automatically based on provided sites.

    Perhaps could return the slice (eg 2D array) automatically?
    """

I'm looking at this StackOverflow answer, does this seem reasonable?

@mkhorton
Copy link
Member

mkhorton commented Apr 4, 2022

Does pyrho already allow arbitrary rotations @jmmshn? I guess it could be done with the right supercell matrix?

@jmmshn
Copy link
Collaborator

jmmshn commented Apr 4, 2022

Does pyrho already allow arbitrary rotations @jmmshn? I guess it could be done with the right supercell matrix?

Correct.

@jmmshn
Copy link
Collaborator

jmmshn commented Apr 4, 2022

I'm looking at this StackOverflow answer, does this seem reasonable?

I think it will be easier to get the reorientation information and boundaries in the transformed cell (without any consideration for the numpy volumetric data) then just use the internal machinery we already have for the interpolation.

@sgbaird
Copy link
Author

sgbaird commented Apr 4, 2022

I should probably mention that I implemented something similar in Mathematica using some nice analytical and numerical integration functions for 3D objects. See https://github.com/sgbaird/LatticePlane and https://doi.org/10.1107/S1600576722001492. I had explored doing this in Python with some geometry packages (scikit-geom or something like that), but had some trouble.

@jmmshn
Copy link
Collaborator

jmmshn commented Apr 6, 2022

Cool, so this looks like you had an analytic form for your density so calculating it for a set of points directly is going to be much more accurate.

@sgbaird
Copy link
Author

sgbaird commented Apr 6, 2022

@jmmshn thanks! For the LatticePlane study, I approximated atoms as hard spheres, points, or isotropic Gaussian distributions based on CIF input data. While I mentioned applicability to DFT data, I never used DFT data directly. If I were to use LatticePlane, I'd consider doing a 3D (e.g. spline) interpolation of the points prior to numerical integration across the plane. Interpolation probably isn't necessary if densities are probeable at arbitrary locations without expensive, additional calculations.

On a separate note, @mkhorton what got you interested in density integration within a bounded plane?

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

No branches or pull requests

3 participants