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 support atomwise rmax for sktb module #209

Merged
merged 68 commits into from
Dec 21, 2024
Merged

Conversation

QG-phy
Copy link
Collaborator

@QG-phy QG-phy commented Sep 20, 2024

No description provided.

QG-phy and others added 30 commits September 14, 2024 18:57
…nly support the format of ['2s','3p','d*'], where the main quantum number must be there before the orbital or the * after the orbital symbol.
This commit adds a new function `cal_rmin_rmax` to calculate the minimum and maximum atomic radii based on the given skdata. It uses the `find_first_false` function to find the index of the first occurrence of False in each row of a 2D array. The calculated atomic radii are stored in the `atomic_r_min_dict` and `atomic_r_max_dict` dictionaries.
… to align the distance introduce the mask for rij out the grid from skfiles.

This commit modifies the SKParam class in sk_param.py to calculate and update the minimum and maximum atomic radii based on the given skdata. It introduces a new function `cal_rmin_rmax` that uses the `find_first_false` function to find the index of the first occurrence of False in each row of a 2D array. The calculated atomic radii are stored in the `atomic_r_min` and `atomic_r_max` attributes of the SKParam class.
This commit adds a range check for the bond distance `rij` in the `HoppingIntp` class of `hopping_dftb.py`. If any `rij` values are outside the interpolation range defined by `min_x` and `max_x`, a warning message is logged and those values are set to 0.0. The interpolated values are then calculated using the modified `rij` array.
…fy the class

This commit adds the 'poly4pow' hopping formula to the HoppingFormula class in hopping.py. The formula calculates the SK integrals without the environment dependence of the form of powerlaw. It takes into account parameters such as alpha1, alpha2, alpha3, alpha4, alpha5, and alpha6. The function poly4pow() is used to calculate the value of the hopping formula. If the functype is 'NRL0' or 'NRL1', the NRL_HOP method is called. Otherwise, the method corresponding to the functype is called. If the functype is not recognized, a ValueError is raised.
This commit adds the 'poly3exp' and 'poly4exp' hopping formulas to the HoppingFormula class in hopping.py. These formulas calculate the SK integrals without the environment dependence of the form of powerlaw. They take into account parameters such as alpha1, alpha2, alpha3, alpha4, alpha5, and alpha6. The functions poly3exp() and poly4exp() are used to calculate the values of the hopping formulas. If the functype is 'NRL0' or 'NRL1', the NRL_HOP method is called. Otherwise, the method corresponding to the functype is called. If the functype is not recognized, a ValueError is raised.
QG-phy and others added 21 commits October 20, 2024 22:52
…and CosineAnnealingLR learning rate scheduler
…hen r_max is not provided in dftbsk model options
@QG-phy QG-phy requested a review from floatingCatty November 27, 2024 15:33
dptb/data/AtomicData.py Show resolved Hide resolved
for k in r_max.keys():
assert len(k.split('-')) == 2
atom_a, atom_b = k.split('-')
if atom_a not in atom_species_num:
Copy link
Member

Choose a reason for hiding this comment

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

这里atom_a, atom_b 应该是str,atom_species_num里应该放的是 int,为啥判断atom_a not in atom_species_num?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

嗯是的这里写错了。不过似乎不用加判断也许。后面用到atom_species_num的时候只是用到了取最大值。

atom_a, atom_b = k.split('-')
if atom_a not in atom_species_num:
atom_species_num.append(atomic_num_dict[atom_a])
if atom_b not in atom_species_num:
Copy link
Member

Choose a reason for hiding this comment

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

same as ..

dptb/data/transforms.py Show resolved Hide resolved
@@ -64,122 +150,388 @@ def symmetrize(self):
self.overlap_params.data[:,self.idp_sk.orbpair_maps[k],:] = 0.5 * (params[:,self.idp_sk.orbpair_maps[k],:] + reflect_params[:,self.idp_sk.orbpair_maps[k],:])

return True

def save(self,filepath):
Copy link
Member

Choose a reason for hiding this comment

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

感觉这个功能很像是deeptb软件的一个插件。所有功能基本都独立,参数也独立写了一个子集

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个其实是一个非常不常用的功能。只有在做dftb2nnsk的的大模型才用到,用来存中间的存档。其他时间用不到。单个体系的训练这部分其实也不要中间存训练的存档。没必要在这个地方搞什么事情。

dptb/nn/nnsk.py Show resolved Hide resolved
dptb/nn/nnsk.py Show resolved Hide resolved
dptb/nn/nnsk.py Show resolved Hide resolved
@QG-phy QG-phy merged commit 42eaf5d into deepmodeling:main Dec 21, 2024
2 checks passed
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.

2 participants