Start using Molly.jl: place_atoms not defined in module Molly?

I started looking into Molly.jl and attempting to run one its examples. I get the error described below. Insight would be nice to receive. Thx!

julia> using Molly

julia> n_atoms = 100

100

julia> atom_mass = 10.0u"u"

10.0 u

julia> atoms = [Atom(mass=atom_mass, Οƒ=0.3u"nm", Ο΅=0.2u"kJ * mol^-1") for i in 1:n_atoms]

100-element Vector{Atom{Quantity{Float64, 𝐈 𝐓, Unitful.FreeUnits{(C,), 𝐈 𝐓, nothing}}, Quantity{Float64, 𝐌, Unitful.FreeUnits{(u,), 𝐌, nothing}}, Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}, Quantity{Float64, 𝐋² 𝐌 𝐍⁻¹ 𝐓⁻², Unitful.FreeUnits{(kJ, mol⁻¹), 𝐋² 𝐌 𝐍⁻¹ 𝐓⁻², nothing}}}}:

Atom with index 1, charge=0.0 C, mass=10.0 u, Οƒ=0.3 nm, Ο΅=0.2 kJ mol⁻¹

…

julia> box_size = SVector(2.0, 2.0, 2.0)u"nm"

3-element SVector{3, Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}} with indices SOneTo(3):

2.0 nm

2.0 nm

2.0 nm

julia> coords = place_atoms(n_atoms, box_size, 0.3u"nm")

ERROR: UndefVarError: place_atoms not defined

Stacktrace:

[1] top-level scope

@ REPL[6]:1

[2] top-level scope

@ ~/.julia/packages/CUDA/Axzxe/src/initialization.jl:52

Works fine for me - based on your question in the other thread I’m assuming that you’re just dumping all packages into your default environment, therefore ending up with outdated package versions. Don’t do this, create project-specific environments instead installing only the specific packages required for an analysis.

What’s the output of ]st?

True. I am dumping all packages to default.

Output of ]st is below.

I am happy to resort to a less naive approach.

\Status ~/.julia/environments/v1.6/Project.toml
[2169fc97] AlgebraicMultigrid v0.4.2
[6e4b80f9] BenchmarkTools v1.3.1
[159f3aea] Cairo v1.0.5
[39db22c5] ClipData v0.2.2
[a93c6f00] DataFrames v1.3.2
[9fdde737] DiffEqOperators v4.41.0
[0c46a032] DifferentialEquations v7.1.0
[5b8099bc] DomainSets v0.5.9
[587475ba] Flux v0.12.9
[1fa38f19] Format v1.3.2
[713c75ef] Franklin v0.10.69
[e9467ef8] GLMakie v0.5.4
[28b8d3ca] GR v0.64.0
[c91e804a] Gadfly v1.3.4
[705231aa] Gmsh v0.1.1
[7073ff75] IJulia v1.23.2
[40713840] IncompleteLU v0.2.0
[a98d9a8b] Interpolations v0.13.5
[42fd0dbc] IterativeSolvers v0.9.2
[b964fa9f] LaTeXStrings v1.3.0
[ee78f7c6] Makie v0.16.5
[94925ecb] MethodOfLines v0.1.0
[961ee093] ModelingToolkit v8.5.1
[aa0f7f06] Molly v0.5.0
[2774e3e8] NLsolve v4.5.1
[8913a72c] NonlinearSolve v0.3.15
[5fb14364] OhMyREPL v0.5.12
[1dea7af3] OrdinaryDiffEq v6.7.0
[f0f68f2c] PlotlyJS v0.18.8
[91a5bcdd] Plots v1.26.0
[af69fa37] Preconditioners v0.5.0
[47a9eef4] SparseDiffTools v1.20.2
[684fba80] SparsityDetection v0.3.4
[276daf66] SpecialFunctions v1.8.4
[90137ffa] StaticArrays v1.4.1
[c3572dad] Sundials v4.9.2
[0c5d862f] Symbolics v4.3.0
[1986cc42] Unitful v1.11.0
[e88e6eb3] Zygote v0.6.35

The latest release for Molly is 0.8. You are using an outdated version, which is why the examples in the documentation won’t work. You can either install the latest version of Molly or read an older version of the documentation (in the lower left corner of the docs you’ll find a dropdown menu to select the version).

Have a look at this related thread:

and read the relevant sections of the Pkg.jl manual, e.g.

https://pkgdocs.julialang.org/v1/environments/

1 Like