Skip to content

🐛 Incorrect constructor for AtomsCalculatorsModel with PeriodicCell#71

Merged
Alexsp32 merged 9 commits into
mainfrom
atomscalculators-bugfix
Apr 22, 2026
Merged

🐛 Incorrect constructor for AtomsCalculatorsModel with PeriodicCell#71
Alexsp32 merged 9 commits into
mainfrom
atomscalculators-bugfix

Conversation

@Alexsp32

Copy link
Copy Markdown
Member

No description provided.

@Alexsp32
Alexsp32 force-pushed the atomscalculators-bugfix branch 3 times, most recently from 8ddf700 to fbdd62a Compare April 16, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes an incorrect AtomsCalculatorsModel constructor path when working with periodic cells, and expands tests to cover both infinite and periodic cell structures.

Changes:

  • Update AtomsCalculatorsModel constructors to always set ndofs to 3 instead of conditionally using the cell object.
  • Expand the AtomsCalculators test to run against both InfiniteCell() and PeriodicCell(...).
  • Tighten Subsystem.indices typing and add a Codecov upload step in CI.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
test/runtests.jl Adds coverage for AtomsCalculatorsModel using both infinite and periodic cells.
src/subsystems.jl Changes Subsystem.indices type and constructor signature/normalization logic.
src/classical_models/atomscalculators.jl Fixes the ndofs constructor argument to always be 3.
.github/workflows/CI.yml Adds Codecov upload step (currently without generating lcov.info).
Comments suppressed due to low confidence (1)

src/subsystems.jl:33

  • The Int normalization indices = [indices:indices] creates a Vector{UnitRange{Int}}, which is incompatible with the indices::Union{Vector{Int}, Colon} field type and will fail at construction. This should produce a Vector{Int} (e.g., a single-element vector or collect(indices:indices)) to match the struct field type and downstream indexing assumptions.
	if isa(indices, Int)
		indices = [indices:indices]
	elseif isa(indices, UnitRange{Int})
		indices = collect(indices)
	end

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

Comment thread src/subsystems.jl
Comment on lines +27 to 28
function Subsystem(model, indices::Union{Int, UnitRange{Int}}=:)
# Convert indices to a Vector{Int} or : for consistency

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

Subsystem(model) (and calls that pass Colon() explicitly) will now throw a MethodError because the constructor only accepts Int/UnitRange{Int} while the default value is : (a Colon). Consider widening the signature to also accept Colon (and likely AbstractVector{<:Integer}) so existing CompositeModel(...)=Subsystem.(models, Colon()) and Subsystem(model) keep working.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/CI.yml
Comment on lines +52 to +54
- uses: codecov/codecov-action@v3
with:
file: lcov.info

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow uploads lcov.info to Codecov, but there is no step enabling Julia test coverage or generating an LCOV report in this job. As-is, this will likely fail (missing file) or upload nothing; consider enabling coverage in julia-runtest and/or adding a coverage-to-lcov conversion step, and use the action input expected for multiple files (commonly files:) if needed.

Copilot uses AI. Check for mistakes.

@htsnowden htsnowden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All looks good

@Alexsp32
Alexsp32 merged commit 9f38df6 into main Apr 22, 2026
1 check passed
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.

3 participants