Skip to content

Commit

Permalink
Removed ComponentArrays deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricTravelletti committed Jan 15, 2024
1 parent aaa8130 commit c63edfc
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions src/atomsbase_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ function update_positions(system, positions::AbstractVector{<:AbstractVector{<:U
AbstractSystem(system; particles)
end

@doc raw"""
Creates a new system based on ``system`` but with atoms positions and lattice
vectors updated to the ones provided.
New generalized coordinates should be provided in a ComponentArray with
component `atoms` and `bounding_box`, containing new atomic positions
and lattice vectors respectively.
"""
function update_positions(system, positions::ComponentVector)
# Collect are needed with ComponentArrays to get concrete types.
particles = [Atom(atom; position) for (atom, position)
in zip(system, collect.(positions.atoms))]
AbstractSystem(system; particles, bounding_box=collect.(positions.bounding_box))
end

@doc raw"""
Creates a new system based on ``system`` where the non clamped positions are
updated to the ones provided (in the order in which they appear in the system).
Expand All @@ -44,25 +29,6 @@ function update_not_clamped_positions(system, positions::AbstractVector{<:Unitfu
update_positions(system, new_positions)
end

@doc raw"""
Creates a new system based on ``system`` where the non clamped positions and
lattice vectors are updated to the ones provided.
Note that the `atoms`component of `positions` should be a vector of
coordinates.
"""
function update_not_clamped_positions(system, positions::ComponentVector)
mask = not_clamped_mask(system)
new_positions = deepcopy(position(system))
atoms_positions = collect(positions.atoms)
new_positions[mask] = reinterpret(reshape, SVector{3, eltype(atoms_positions)},
reshape(atoms_positions, 3, :))
update_positions(system,
ComponentVector(atoms=new_positions,
bounding_box=collect.(positions.bounding_box))
)
end

@doc raw"""
Returns a mask for selecting the not clamped atoms in the system.
Expand Down

0 comments on commit c63edfc

Please # to comment.