# Start using Molly.jl: place\_atoms not defined in module Molly?

**URL:** <https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521>\
**Category:** Numerics\
**Tags:** package\
**Created:** [March 7, 2022, 3:44pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521 "2022-03-07T15:44:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Post date:** [March 7, 2022, 3:44pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521/1 "2022-03-07T15:44:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 7, 2022, 4:04pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521/2 "2022-03-07T16:04:27Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Post date:** [March 7, 2022, 4:09pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521/3 "2022-03-07T16:09:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 7, 2022, 4:14pm UTC](https://discourse.julialang.org/t/start-using-molly-jl-place-atoms-not-defined-in-module-molly/77521/4 "2022-03-07T16:14:53Z")

</div>

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:

> [@Should we have a package update PSA?](https://discourse.julialang.org/t/should-we-have-a-package-update-psa/61923):
>
> I’ve been tinkering with the idea of writing this for a while but never got around to it, so I’ll at least put the idea here in case anyone agrees and wants to make a start. I believe over the last few months the most frequently repeated question is “I can’t update package X to its latest version”, and always invariably the answer is: Do ]add X@versionyouwant to find out what’s holding you back; and Work with environments, as you actually don’t need ObscurePackageHoldingEverythingBack which yo…

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

[https://pkgdocs.julialang.org/v1/environments/](https://pkgdocs.julialang.org/v1/environments/)
