Skip to content

Commit

Permalink
minor updates needed elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaMolSim committed May 19, 2024
1 parent 7e9c627 commit e484aa7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ See `?bulk` and `?rattle!` for more information.

## Contributions

The current version of the package is essentially a copy-paste of a subset of functionality from an older package that is no longer developed. Contributions to expand the capabilities, improve the implementation, or entirely replace it are very welcome. Some packages that contain overlapping functionalities that could replace or add to `AtomsBuilder.jl` include
The current version of the package is essentially a copy-paste of a subset of functionality from an older package that is no longer developed. I needed this functionality to starting moving over my workflow to the AtomsBase eco-system. Contributions to expand the capabilities, improve the implementation, or entirely replace it are very welcome. There are most certainly more general and more elegant implementations available than what I provide. Some packages that contain overlapping functionalities that could replace or add to `AtomsBuilder.jl` include
* [`Electrum.jl`](https://github.com/brainandforce/Electrum.jl)
* [`AtomsToolbox.jl`](https://github.com/rashidrafeek/AtomsToolbox.jl)
* [`SimpleCrystals.jl`](https://github.com/ejmeitz/SimpleCrystals.jl)
* [`Packmol.jl`](https://github.com/m3g/Packmol.jl)
* [`ASEconvert.jl`](https://github.com/mfherbst/ASEconvert.jl)

21 changes: 21 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ _set_position(x::Atom, 𝐫) = Atom(; position = 𝐫,
atomic_number = x.atomic_number,
atomic_symbol = x.atomic_symbol)

function _get_positions(at::FlexibleSystem)
[ x.position for x in at.particles ]
end

function _set_positions(at::FlexibleSystem,
X::AbstractVector{SVector{3, T}}) where {T}
particles = [ _set_position(at.particles[i], X[i])
for i in 1:length(at) ]
return FlexibleSystem(particles, at.bounding_box, at.boundary_conditions)
end

function _get_atomic_numbers(at::FlexibleSystem)
[ x.atomic_number for x in at.particles ]
end

function _set_atomic_numbers(at::FlexibleSystem, Z::AbstractVector{<: Integer})
particles = [ Atom(Z[i], x.position, x.velocity)
for (i, x) in enumerate(at.particles) ]
return FlexibleSystem(particles, at.bounding_box, at.boundary_conditions)
end


"""
```
Expand Down

0 comments on commit e484aa7

Please sign in to comment.