Closed kenko911 closed 10 months ago
Attention: 4 lines
in your changes are missing coverage. Please review.
Comparison is base (
9036184
) 98.00% compared to head (233cb4d
) 98.59%.
Files | Patch % | Lines |
---|---|---|
matgl/utils/training.py | 78.94% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm checking out the source in VS Code, and I jumped in from this merged PR. Not sure if this is the right place to ask, but I've got a question about model/_m3gnet.py
. On lines 341 and 342, when converting from fractional to Cartesian coordinates, why is it that the matrix product only involves the first row vector of the lattice?
g.edata["pbc_offshift"] = torch.matmul(g.edata["pbc_offset"], lat[0])
g.ndata["pos"] = g.ndata["frac_coords"] @ lat[0]
If so, then how does the subsequent code operate, such as the function compute_pair_vector_and_distance
:
dst_pos = g.ndata["pos"][g.edges()[1]] + g.edata["pbc_offshift"]
src_pos = g.ndata["pos"][g.edges()[0]]
bond_vec = dst_pos - src_pos
bond_dist = torch.norm(bond_vec, dim=1)
Jiang You
Summary
I finally figured out that the stress contribution due to the change of lattice vectors in the Potential class is missing in the current implementation, now I have modified the implementations to add the strain (st) variable for lattices to include the gradient of potential energy with respect to lattice vectors for stress calculations. I also added unit tests for checking force and stress implementations with central finite difference methods and completed the retraining of both universal M3GNet MLIPs. The resulting pretrained universal MLIPs achieve better accuracy and stability in benchmark examples. Finally, I have checked all Jupyter Notebook examples, and everything works for the implementation.
Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Tip: Install
pre-commit
hooks to auto-check types and linting before every commit: