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

[feature] add the support of NRL-TB #22

Merged
merged 66 commits into from
Oct 17, 2023
Merged

Conversation

QG-phy
Copy link
Collaborator

@QG-phy QG-phy commented Sep 14, 2023

related issue #17

  1. add or complete the support for non-orthogonal basis, that is add fitting for overlap matrix. But here we didn't set any constraints for the overlap matrix to ensure it is the positive-determined matrix.
  2. modify the onsite formula, to make it more flexible for NRL-TB formula.
  3. add the support of NRL-TB formula.
    **Note: ** The lambda for onsite density is different for different elements for compound, but now we did not have this freedom. so only it works for substance.
  4. add an example of a silicon NRL-TB case.

QG-phy and others added 29 commits July 27, 2023 21:16
update 12 files and create 1 file
1. add onsite formula
2. modify the onsitefunc to be the same style of sk hoping integralfunc
3. use the onsite formula to get onsite orbital energy
4. the strain mode is special still treat in the sk hopping style.
…ite_neurons settings in init_dptb and init_nnsk
1. add NRL TB onsite energy formula NRL in the onsite_formula.py
2.  modify the onsite_func.py to adopt the NRL
3. modify init_nnsk init_dptb to adopt the changes in onsite_func
3. modify the test train nnsk and dptb .py to  adopt the changes in onsite_func
4. add new parameters for NRL TB onsite energy in argcheck.py
5. add index_mapping NRL (temporarily using  the uniform format) in the future the t2g eg orbital will be added!
For init_correction_model for NRL TB json model.
remove the return in the test function
change   From  rev_latt =(np.matrix(structase.cell).I.T)
                          kdiff_cart = np.asarray(kdiff * rev_latt)

                 To:   rev_latt =  np.linalg.inv(np.array(structase.cell).T)
                          kdiff_cart = np.dot(kdiff, rev_latt)
add test test_NRL_skint_type_constants
dptb/nnops/apihost.py Outdated Show resolved Hide resolved
dptb/hamiltonian/hamil_eig_sk_crt.py Outdated Show resolved Hide resolved
dptb/hamiltonian/hamil_eig_sk_crt.py Outdated Show resolved Hide resolved
'''
assert self.overlap, 'overlap is False, no overlap function is defined.'

if self.functype == 'NRL':
Copy link
Member

Choose a reason for hiding this comment

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

If the user wants to define an overlap in the form of varTang96 or power-law, is there anything needed to be done besides modifying the formula here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the user wants to define an overlap in the form of varTang96 or power-law, is there anything that needs to be done besides modifying the formula here?

Re: now looks like that only modifying the formula is enough. If not, it must be some tiny changes to the other part. I don't check it.

x_env_indlist = onsite_env[kf][:,2] == xind
x_onsite_envs = onsite_env[kf][x_env_indlist,8] # r_jis

paras = {'x_onsite_envs':x_onsite_envs,
Copy link
Member

Choose a reason for hiding this comment

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

Bravo! This approach of getting analytic environmental-dependent onsites can easily generalize to the hopping part, which helps to implement the environment-dependent hoppings such as Prof. Pan's.

self.para_Consts = None

if functype == 'NRL':
self.para_Consts = NRL_skint_type_constants(reducted_skint_types)
Copy link
Member

Choose a reason for hiding this comment

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

Is this the deltas?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes!

nnsk_overlaps = batch_nnsk_overlaps[ii]
else:
nnsk_overlaps = None
onsiteEs, hoppings, onsiteSs, overlaps, soc_lambdas = nnsk_correction(
Copy link
Member

Choose a reason for hiding this comment

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

dptb does not correct overlap value right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, dptb will not correct the overlap. only hoppings are enough I think. at least at this stage.

{
"common_options": {
"unit": "Ry",
"onsitemode": "NRL",
Copy link
Member

Choose a reason for hiding this comment

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

Would it better to move onsitemode and onsite cutoff to onsite function in model_options?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, but moving this para to model options will make the previous model fail.

@@ -328,7 +344,7 @@ def model_options():

doc_model_options = "The parameters to define the `nnsk` and `dptb` model."

return Argument("model_options", dict, sub_fields=[skfunction(), sknetwork(), dptb()], sub_variants=[], optional=False, doc=doc_model_options)
return Argument("model_options", dict, sub_fields=[skfunction(), sknetwork(), onsitefuncion(), dptb()], sub_variants=[], optional=False, doc=doc_model_options)
Copy link
Member

Choose a reason for hiding this comment

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

Corresponding to onsitefunction, is it better to change skfunction to hoppingfunction?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I create a new issue to do this. since this NRL PR contains too much information.

Copy link
Member

Choose a reason for hiding this comment

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

Why is pth and json's result different?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why is pth and json's result different?

This is because the json model is from the original NRL model, but the pth one is from further trained result init by the json one.

@QG-phy QG-phy added the Feature Request New feature or request label Oct 17, 2023
@floatingCatty floatingCatty merged commit a9fb627 into deepmodeling:main Oct 17, 2023
2 checks passed
@QG-phy QG-phy deleted the nrl_qg branch April 12, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants