-
Notifications
You must be signed in to change notification settings - Fork 526
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
feat(pt): support complete form energy loss #3782
Conversation
WalkthroughThe update enhances the energy loss computation in the Changes
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 4
Out of diff range and nitpick comments (1)
source/tests/pt/test_loss.py (1)
Line range hint
132-197
: The TensorFlow placeholder initialization can be extracted into a separate method to improve readability and maintainability.# tf self.g = tf.Graph() with self.g.as_default(): t_cur_lr, t_natoms, t_penergy, t_pforce, t_pvirial, t_patom_energy, t_lenergy, t_lforce, t_lvirial, t_latom_energy, t_atom_pref, t_atom_ener_coeff, t_drdq, find_energy, find_force, find_virial, find_atom_energy, find_atom_pref, find_drdq, find_atom_ener_coeff = self._initialize_tf_placeholders() model_dict = { "energy": t_penergy, "force": t_pforce, "virial": t_pvirial, "atom_ener": t_patom_energy, } label_dict = { "energy": t_lenergy, "force": t_lforce, "virial": t_lvirial, "atom_ener": t_latom_energy, "atom_pref": t_atom_pref, "drdq": t_drdq, "atom_ener_coeff": t_atom_ener_coeff, "find_energy": find_energy, "find_force": find_force, "find_virial": find_virial, "find_atom_ener": find_atom_energy, "find_atom_pref": find_atom_pref, "find_drdq": find_drdq, "find_atom_ener_coeff": find_atom_ener_coeff, } self.tf_loss_sess = self.tf_loss.build( t_cur_lr, t_natoms, model_dict, label_dict, "" )
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #3782 +/- ##
==========================================
+ Coverage 82.49% 82.59% +0.09%
==========================================
Files 515 515
Lines 48642 48726 +84
Branches 2980 2979 -1
==========================================
+ Hits 40126 40243 +117
+ Misses 7605 7572 -33
Partials 911 911 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 5
Support atomic energy, atomic prefactor force, generalized force, `relative_f`, `enable_atom_ener_coeff` for `EnergyStdLoss`. Support atomic energy, `enable_atom_ener_coeff` for `EnergySpinLoss`. virial support for `EnergySpinLoss` needs discussion and another PR. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new parameters for enhanced energy loss computation, including `relative_f`, `enable_atom_ener_coeff`, and `numb_generalized_coord`. - Improved handling of atomic energy loss with the addition of `pref_ae` calculation. - **Bug Fixes** - Refined conditional logic for energy computation to ensure accurate handling of new parameters. - **Tests** - Expanded test coverage with new classes and methods to validate the new features and ensure consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Support atomic energy, atomic prefactor force, generalized force,
relative_f
,enable_atom_ener_coeff
forEnergyStdLoss
.Support atomic energy,
enable_atom_ener_coeff
forEnergySpinLoss
.virial support for
EnergySpinLoss
needs discussion and another PR.Summary by CodeRabbit
New Features
relative_f
,enable_atom_ener_coeff
, andnumb_generalized_coord
.pref_ae
calculation.Bug Fixes
Tests