Skip to content

Conversation

@ERovers
Copy link

@ERovers ERovers commented Oct 28, 2025

I have added four functions of which two replace the previous soft-core potentials (LennardJonesSoftCore and CoulombSoftCore).

  • Added the soft-core potentials described in Beutler et al. (1994) in Chem. Phys. Lett. and called these functions LennardJonesSoftCoreBeutler and CoulombSoftCoreBeutler, these were similar to the previous soft-core potentials, but I reversed the λ-scaling so that for λ =1, the interaction is fully turned on and for λ=0, the interaction is turned off.
  • Added the soft-core potentials described in Gapsys et al. (2012) in JCTC and called these functions LennardJonesSoftCoreGapsys and CoulombSoftCoreGapsys.
  • Added a new atom type 'Atom_L' in preparation for atoms that will be controlled with λ. (Essentially the same as the 'Atom' type but with an added λ variable). However, it is not being used yet.
  • Updated the test/interactions.jl to include tests for these functions.
  • Updated the test/simulation.jl to run with LennardJonesSoftCoreBeutler in the HREMD.
  • Updated the soft-core potentials section in examples.md to showcase the difference between these two types of soft-core potentials and the effect of λ on both.
  • Updated documentations.md where soft-core potentials were mentioned.
  • Updated cutoffs.jl by exporting the force_cutoff function to enable plotting the magnitude of the forces. While it is not used in the examples.md, it was helpful when I was plotting the forces generally.

Important note: These interactions are for appearing and disappearing atoms only, not for transformations between different atoms (e.g. a alchemical transformation from carbon to hydrogen atom).

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 82.57576% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.84%. Comparing base (929e02f) to head (fc3f9bd).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/interactions/coulomb.jl 80.32% 12 Missing ⚠️
src/interactions/lennard_jones.jl 84.50% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   58.43%   58.84%   +0.41%     
==========================================
  Files          42       42              
  Lines        8223     8296      +73     
==========================================
+ Hits         4805     4882      +77     
+ Misses       3418     3414       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jgreener64 jgreener64 left a comment

Choose a reason for hiding this comment

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

Looks great, just a few small comments.

R = inter.α*sqrt(cbrt(((26/7)*(C12/C6)*(1-inter.λ))))
invR = 1/R
if r >= R
return (((12*C12)/r^13)-((6*C6)/r^7))
Copy link
Member

Choose a reason for hiding this comment

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

To save computation you can set r6 = r^6 then use r6 * r and r6 * r6 * r as appropriate. This also applies elsewhere.

src/types.jl Outdated
end

"""
Atom_L(; <keyword arguments>)
Copy link
Member

Choose a reason for hiding this comment

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

For now don't add this to Molly, as we may decide to have lambda in the main atom type.

src/cutoffs.jl Outdated
ShiftedForceCutoff,
CubicSplineCutoff
CubicSplineCutoff,
force_cutoff
Copy link
Member

Choose a reason for hiding this comment

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

Don't export, you can access with Molly.force_cutoff or using Molly: force_cutoff.

CoulombSoftCoreBeutler(; cutoff, α, λ, use_neighbors, σ_mixing, weight_special, coulomb_const)
The Coulomb electrostatic interaction between two atoms with a soft core.
The Coulomb electrostatic interaction between two atoms with a soft core, used for appearing and disappearing of atoms based on the potential described in Beutler et al. 1994 (Chem. Phys. Lett.).
Copy link
Member

Choose a reason for hiding this comment

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

Link to the DOI of the paper, like in src/simulators.jl line 358. Also link where it is mentioned in the docs.

Copy link
Member

@jgreener64 jgreener64 left a comment

Choose a reason for hiding this comment

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

Very nice, click merge (if the button isn't available, let me know and I can do it).

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