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

issue in using dplr with hybrid/scaled pair_style #4273

Closed
fengwangxmu opened this issue Oct 29, 2024 · 6 comments · Fixed by #4274 or #4313
Closed

issue in using dplr with hybrid/scaled pair_style #4273

fengwangxmu opened this issue Oct 29, 2024 · 6 comments · Fixed by #4274 or #4313
Labels

Comments

@fengwangxmu
Copy link

fengwangxmu commented Oct 29, 2024

When using dplr with hybrid/scaled pair_style to combining two dplr models, fix_dplr can not be used to define all dplr models.
input:

pair_style hybrid/scaled &
           v_LAMBDA_i deepmd ini.pb &
           v_LAMBDA_f deepmd fin.pb

pair_coeff *  * deepmd 1
pair_coeff *  * deepmd 2


fix   0 all dplr model ini.pb type_associate 1 4 bond_type 1
fix_modify  0 virial yes
fix   1 all dplr model ini.pb type_associate 1 5 bond_type 1
fix_modify  1 virial yes

log.lammps:

ERROR: pair_style deepmd should be set before this fix
 (/home/conda/feedstock_root/build_artifacts/deepmd-kit_1707091051406/work/source/lmp/fix_dplr.cpp:144)
Last command: fix   0 all dplr model ini.pb type_associate 1 4 bond_type 1

@njzjz
Copy link
Member

njzjz commented Oct 29, 2024

I've read the related LAMMPS code. It seems when there are more than one deepmd pairs match, and no index is assigned, no pair is returned.

https://github.com/lammps/lammps/blob/6d0e633edf0b6fd27f97d06e01480089eebcd8d0/src/force.cpp#L288-L310

I am not sure whether it is okay to set index to 1 or an argument for index should be passed in this case.

@njzjz njzjz added the bug label Oct 29, 2024
njzjz added a commit to njzjz/deepmd-kit that referenced this issue Oct 29, 2024
…airs

Fix deepmodeling#4273.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@fengwangxmu
Copy link
Author

Thank you very much for adding this new feature into the fix_dplr. I am testing this new feature.
Furthermore, I wander if the the corresponding potential energy for ini.pb and fin.pb can be scaled by the hybrid/scale method with this new feature?

github-merge-queue bot pushed a commit that referenced this issue Nov 1, 2024
…airs (#4274)

Fix #4273.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new optional keyword `pair_deepmd_index` in the `fix
dplr` command for enhanced control in simulations.
- Updated documentation with clearer instructions and examples for the
DPLR model, including training process and simulation setup.

- **Bug Fixes**
- Improved error handling related to the new `pair_deepmd_index`
parameter to ensure proper usage.

- **Documentation**
	- Enhanced descriptions and usability of the DPLR model documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@njzjz
Copy link
Member

njzjz commented Nov 5, 2024

I wander if the the corresponding potential energy for ini.pb and fin.pb can be scaled by the hybrid/scale method with this new feature?

It looks unrelated. If you find bugs, please open a new issue.

@njzjz njzjz closed this as completed Nov 5, 2024
@fengwangxmu
Copy link
Author

keys.push_back("pair_deepmd_index") should be added in the fix_dplr.cpp to activate the new parameter "pair_deepmd_index"

@njzjz njzjz reopened this Nov 5, 2024
@njzjz
Copy link
Member

njzjz commented Nov 5, 2024

keys.push_back("pair_deepmd_index") should be added in the fix_dplr.cpp to activate the new parameter "pair_deepmd_index"

Thank you for reporting the bug. Did it work after it is added?

@fengwangxmu
Copy link
Author

fengwangxmu commented Nov 5, 2024 via email

njzjz added a commit to njzjz/deepmd-kit that referenced this issue Nov 5, 2024
…lr.cpp`

Fix deepmodeling#4273.

* Modify `is_key` function to include `keys.push_back("pair_deepmd_index")`

Update tests in `test_dplr.py` to include `pair_deepmd_index` command

* Add `pair_deepmd_index 0` to various `lammps.fix` commands in the test cases
@njzjz njzjz linked a pull request Nov 5, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Nov 6, 2024
…4313)

Fix #4273. Tests are added in this PR.

* Modify `is_key` function to include
`keys.push_back("pair_deepmd_index")`

Update tests in `test_dplr.py` to include `pair_deepmd_index` command

* Add `pair_deepmd_index 0` to various `lammps.fix` commands in the test
cases

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new key, `pair_deepmd_index`, enhancing the `FixDPLR`
class for improved pair validation in simulations.
  
- **Bug Fixes**
- Updated error handling to ensure robustness when the new
`pair_deepmd_index` is not provided.

- **Tests**
- Modified test parameters to include `pair_deepmd_index 0`, ensuring
compatibility with the new functionality while maintaining existing
validations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants