Skip to content

Conversation

@David-Araripe
Copy link
Collaborator

The cdk2 test is passing just fine. I tested it with:

python runTEST.py -a gpu -t 10 -r cdk2 -k All

The thrombin example seems to have a bug or something different in the implementation. See the output for thet test run:

python runTEST.py -a gpu -t 10 -r thrombin -k All

Where we get:

Energy not matching for nonbonded pp el, Q5 -4303.30 Q7 -4303.29
Energy not matching for nonbonded pp vdw, Q5 -804.21 Q7 -804.12
Energy not matching for nonbonded pw vdw, Q5 -270.60 Q7 -270.59
Energy not matching for nonbonded ww el, Q5 -421.82 Q7 -421.83
Energy not matching for bonded p bond, Q5 1101.60 Q7 1101.55
Energy not matching for bonded p angle, Q5 2974.41 Q7 2974.38
Energy not matching for restraint Total, Q5 6657.57 Q7 6657.74
Energy not matching for restraint Ufix, Q5 4381.08 Q7 4381.09
Energy not matching for restraint Uradx, Q5 2248.54 Q7 2248.53
Energy not matching for restraint Ushell, Q5 0.00 Q7 0.17
Energy not matching for SUM total, Q5 9865.71 Q7 9865.90
Energy not matching for SUM Upot, Q5 9760.34 Q7 9760.53
Energy not matching for SUM Ukin, Q5 105.37 Q7 105.36
Compared energies for frame 10

Larger differences are observed for nonbonded pp vdw and for restraint Ushell. That's something we should investigate.

One suggestion I would have is making the tests slightly more permissive for declaring "Energy not matching". We have this message even with 0.01 difference. I don't know how permissive we'd like to be, though.. If you let me know I can include this change to this PR.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the arithmetic van der Waals (vdW) combination rule to Q-GPU, which previously only supported the geometric rule. The arithmetic rule uses arithmetic averaging for atomic radii (R*_ij = R*_i + R*_j) combined with geometric averaging for epsilon parameters (eps_ij = sqrt(eps_i * eps_j)).

Changes:

  • Added vdw_rules.h header file defining geometric and arithmetic vdW calculation functions
  • Added vdw_rule field to system topology structure and CSV I/O
  • Updated all nonbonded force calculation functions to support both rules with runtime selection
  • Added parameter preprocessing to convert epsilon values to sqrt(epsilon) for arithmetic rule
  • Updated Python topology parser to read and validate vdW rule specifications

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/core/vdw_rules.h New header defining inline functions for geometric and arithmetic vdW calculations with CUDA support
src/core/system.h Added vdw_rule integer field to topo_t structure
src/core/parse.cu Added vdw_rule reading, validation, and parameter preprocessing for both catypes and q_catypes
src/core/solvent.cu Updated water-water interactions to support both vdW rules with optimized coefficient precomputation
src/core/qatoms.cu Updated Q-atom interactions (QP, QW, QQ) to dispatch to appropriate vdW calculation function
src/core/nonbonded.cu Updated protein-protein interactions to support both vdW rules
src/core/cuda/src/CudaNonbondedForce.cu Updated CUDA kernel to pass vdw_rule parameter and call appropriate calculation function
src/Qgpu/topology.py Enhanced topology parser to detect vdW format, validate consistency, and write vdw_rule to CSV

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 48 to 49
*V_a = sqrt_eps_ij * R6 * R6 * r6 * r6; // eps * R^12 * r^-12
*V_b = 2.0 * sqrt_eps_ij * R6 * r6; // 2 * eps * R^6 * r^-6
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment states "eps * R^12 * r^-12" but the code uses sqrt_eps_ij which equals sqrt(eps_i * eps_j), not eps_ij. The comment should clarify this is sqrt(eps_i * eps_j) rather than eps_ij. Similarly for line 49, the comment should specify this is 2 * sqrt(eps_i * eps_j), not 2 * eps_ij.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link

Copilot AI commented Jan 28, 2026

@David-Araripe I've opened a new pull request, #79, to work on those changes. Once the pull request is ready, I'll request review from you.

@David-Araripe David-Araripe self-assigned this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants