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

[WIP] Cell-related gradient modifications #12

Closed
wants to merge 4 commits into from

Conversation

So-Takamoto
Copy link
Contributor

I found that the current implementation has several performance issues regarding gradient wrt. cell.
This PR modifies that. Since the changes are relatively much, I will put some comments.

Change summary:

  • Use shift for gradient instead of cell.
  • shift is now length scale instead cell unit.
  • Calculate Voigt notation style stress directly

Also, this PR contains bugfix related to sked cell.

@So-Takamoto So-Takamoto added bug Something isn't working enhancement New feature or request labels Sep 16, 2021
@@ -6,7 +6,7 @@
setup_requires: List[str] = []
install_requires: List[str] = [
"ase>=3.18, <4.0.0", # Note that we require ase==3.21.1 for pytest.
"pymatgen",
"pymatgen>=2020.1.10",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function get_neighbor_list() used in this library is recently introduced.

@@ -20,6 +20,9 @@ def _create_atoms() -> List[Atoms]:
atoms = molecule("CH3CH2OCH3")

slab = fcc111("Au", size=(2, 1, 3), vacuum=80.0)
slab.set_cell(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified cell shape to find potential bugs related to the skewed cell.

@@ -58,6 +61,8 @@ def _assert_energy_force_stress_equal(calc1, calc2, atoms: Atoms):
atoms.calc = calc1
f1 = atoms.get_forces()
e1 = atoms.get_potential_energy()
if np.all(atoms.pbc == np.array([True, True, True])):
s1 = atoms.get_stress()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modify reported test bug in #7

shift = S
else:
# shift = S
shift = torch.mm(S, cell.detach())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shift contains different data from the previous one.
Current shift equals to previous_shift * cell
This is because shift is used for requires_grad_(True) directly instead of cell.

@So-Takamoto So-Takamoto changed the title Cell-related gradient modifications [WIP] Cell-related gradient modifications Sep 16, 2021
@So-Takamoto
Copy link
Contributor Author

It seems I pushed slightly different commit. I will create PR again. Sorry for that.

shinh pushed a commit to shinh/torch-dftd that referenced this pull request Jun 15, 2023
fix cases where --pad_num_foobar are not specified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant