Repository navigation
feat(lammps): support device-side model deviation with Kokkos #6023
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
base: master
Are you sure you want to change the base?
Changes from all commits
35e9509
3403744
b5b1ec1
aae754c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -407,6 +407,15 @@ void DeepPotPTExpt::init(const std::string& model, | |
| check_charge_spin_domain(default_chg_spin_, chg_spin_table_ranges_); | ||
| } | ||
|
|
||
| // A legacy compressed archive can carry a frozen default without shipping | ||
| // a fold. Retain that state without changing either conditioning width. | ||
| try { | ||
| default_chg_spin_ = | ||
| deepmd::ptexpt::read_default_chg_spin_for_query(metadata, dchgspin); | ||
| } catch (const deepmd::deepmd_exception& ex) { | ||
| default_chg_spin_query_error_ = ex.what(); | ||
| } | ||
|
|
||
| int num_intra_nthreads, num_inter_nthreads; | ||
| get_env_nthreads(num_intra_nthreads, num_inter_nthreads); | ||
| if (num_inter_nthreads) { | ||
|
|
@@ -451,6 +460,7 @@ void DeepPotPTExpt::set_charge_spin(const std::vector<double>& charge_spin) { | |
| *loader); | ||
| } | ||
| default_chg_spin_.swap(next_charge_spin); | ||
| default_chg_spin_query_error_.clear(); | ||
| } | ||
|
|
||
| std::vector<torch::Tensor> DeepPotPTExpt::run_model( | ||
|
|
@@ -2549,6 +2559,11 @@ void DeepPotPTExpt::compute_canonical_graph_gpu_impl( | |
| throw deepmd::deepmd_exception( | ||
| "compute_canonical_graph_gpu requires a compact canonical artifact."); | ||
| } | ||
| if (!has_atomic_virial()) { | ||
| throw deepmd::deepmd_exception( | ||
| "compute_canonical_graph_gpu requires atomic virials, but the model " | ||
| "was exported without them or does not declare atom_virial output."); | ||
| } | ||
| if (!gpu_enabled) { | ||
| throw deepmd::deepmd_exception( | ||
| "compute_canonical_graph_gpu requires a CUDA device."); | ||
|
|
@@ -2700,4 +2715,21 @@ bool DeepPotPTExpt::uses_canonical_graph_inference() const { | |
| return lower_input_is_canonical_; | ||
| } | ||
|
|
||
| std::vector<double> DeepPotPTExpt::get_default_chg_spin() const { | ||
| assert(inited); | ||
| if (!default_chg_spin_query_error_.empty()) { | ||
| throw deepmd::deepmd_exception(default_chg_spin_query_error_); | ||
| } | ||
| return default_chg_spin_; | ||
| } | ||
|
|
||
| bool DeepPotPTExpt::has_atomic_virial() const { | ||
| assert(inited); | ||
| // Canonical graphs expose public output names; other lower schemas use | ||
| // the internal energy derivative names consumed by compute(). | ||
| const char* key = lower_input_is_canonical_ ? "atom_virial" : "energy_derv_c"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Preserve atomic-virial detection for ordinary graph artifacts The new selector treats every non-canonical artifact as using Consequently, a normal graph .pt2 exported with Agent: dot |
||
| return do_atomic_virial && std::find(output_keys.begin(), output_keys.end(), | ||
| key) != output_keys.end(); | ||
| } | ||
|
|
||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.