cesmix-mit / InteratomicPotentials.jl

Contains methods and types for a variety interatomic potentials.
MIT License
27 stars 6 forks source link

Zero LJ potential, where non-zero value expected #49

Open mfherbst opened 1 year ago

mfherbst commented 1 year ago

This fails with an assertion error when checking the returned energy after evaluating the interatomic potential. I'm not sure what's going on, could be a wrongful screening.

using InteratomicPotentials
using Downloads
using AtomsIO
using Unitful
using UnitfulAtomic

Downloads.download("https://raw.githubusercontent.com/JuliaMolSim/DFTK.jl/904a6e291a7ebb1da76e690cc4ff665be73d8344/examples/Si.extxyz", "Si.extxyz")

system = load_system("Si.extxyz")
distance = norm(position(system, 1) - position(system, 2))

ε = 10.0u"eV"                                                        
σ = 0.25u"Å"                                                         
r_cutoff = 10u"Å"                                                    
lj = LennardJones(ε, σ, r_cutoff, [:Si, ])                           

@assert distance < r_cutoff                                          
@assert atomic_symbol(system, 1) == :Si                              
@assert atomic_symbol(system, 2) == :Si                                              

pe, f = energy_and_force(system, lj)                                                 

@assert !iszero(pe)     # Fails here
@assert !iszero(f)