-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
@@ -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", |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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
.
It seems I pushed slightly different commit. I will create PR again. Sorry for that. |
fix cases where --pad_num_foobar are not specified
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:
shift
for gradient instead ofcell
.shift
is now length scale instead cell unit.Also, this PR contains bugfix related to sked cell.