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

Add H-Atoms #107

Closed
mlorenznano opened this issue Nov 8, 2021 · 5 comments
Closed

Add H-Atoms #107

mlorenznano opened this issue Nov 8, 2021 · 5 comments

Comments

@mlorenznano
Copy link
Collaborator

Hello,

I wanted to add H-Atoms to one edge of an AGNR-structure using the command geom.add_Hatoms but I found that this comment was removed during one update (probably because the geometry module used currently is the one from sisl and not the one from the Hubbard code itself).

Is there another way of adding H-Atoms except creating a new .xyz file?

Thank you very much!
Lorenz

@sofiasanz
Copy link
Member

Hi! Yes, we removed that function since it doesn't actually belong to this package. I don't know if sisl has a function to add H atoms, @zerothi ?

In any case I can leave you here the function that we had for adding H atoms to sp2 carbon-like nanostructures, hope is useful:

import numpy as np
import sisl


def add_Hatoms(geom, d=1.1, sp3=[]):
    ''' Function to saturate edge C atoms with Hydrogen 

    Parameters
    ----------
    geom : sisl.Geometry instance
        geometry of the system that is going to be saturated with H-atoms
    d : float, optional
        distance from the saturated C-atom to the H-atom
    sp3 : array_like, optional
        atomic indices where an sp3 configuration is desired

    Returns
    -------
    sisl.Geometry object of the system saturated with H-atoms
    '''
    Hxyz = []
    for ia in geom:
        idx = geom.close(ia, R=(0.1, 1.6))
        if len(idx[1]) == 2:
            a, b = idx[1]
            v1 = geom.axyz(a) - geom.xyz[ia, :]
            v2 = geom.axyz(b) - geom.xyz[ia, :]
            p = -1*(v1 + v2)
            p = p * d / ((p**2).sum())**0.5
            Hxyz.append(p+geom.xyz[ia, :])
            if ia in sp3:
                Hxyz[-1][2] -= 1.5
                p = Hxyz[-1]-geom.xyz[ia, :]
                p = p * d / ((p**2).sum())**0.5
                Hxyz[-1] = p + geom.xyz[ia, :]
                Hxyz.append(Hxyz[-1]*1.0)
                Hxyz[-1][2] -= 2*Hxyz[-1][2]
    Hgeom = sisl.Geometry(Hxyz, sisl.Atom(Z=1, R=d), sc=geom.sc)
    return geom.add(Hgeom)

@zerothi
Copy link
Collaborator

zerothi commented Nov 9, 2021

Yes, I really wanted to expand on Thomas' idea in zerothi/sisl#202 I just never got there... :(

@tfrederiksen
Copy link
Member

Yes, I really wanted to expand on Thomas' idea in zerothi/sisl#202 I just never got there... :(

Me neither...

@sofiasanz
Copy link
Member

Hi @mlorenznano was this useful for you? Can we close this issue?

@mlorenznano
Copy link
Collaborator Author

Sorry I completely forgot to answer..
Yes we can close the issue.

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

4 participants