Skip to content

Commit d853f7f

Browse files
authored
Update documentation for changes in NQCBase#11 (#351)
* Update documentation for changes in NQCBase#11 * Version bump. Compat bump for NQCModels.jl * Replaced PyCall with PythonCall in CI test * Forgot to switch Project.toml to PythonCall
1 parent 2fa4709 commit d853f7f

File tree

3 files changed

+45
-21
lines changed

3 files changed

+45
-21
lines changed

Project.toml

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NQCDynamics"
22
uuid = "36248dfb-79eb-4f4d-ab9c-e29ea5f33e14"
33
authors = ["James <[email protected]>"]
4-
version = "0.13.7"
4+
version = "0.14.0"
55

66
[deps]
77
AdvancedHMC = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
@@ -62,7 +62,7 @@ MKL_jll = "2023"
6262
MuladdMacro = "0.2"
6363
NQCBase = "0.2"
6464
NQCDistributions = "0.1"
65-
NQCModels = "0.8"
65+
NQCModels = "0.9"
6666
Optim = "1"
6767
OrdinaryDiffEq = "5, 6"
6868
Parameters = "0.12"
@@ -99,11 +99,27 @@ JuLIP = "945c410c-986d-556a-acb1-167a618e0462"
9999
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
100100
MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
101101
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
102-
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
102+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
103103
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
104104
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
105105
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
106106
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
107107

108108
[targets]
109-
test = ["Test", "SafeTestsets", "CSV", "DataFrames", "DiffEqNoiseProcess", "FiniteDiff", "DiffEqDevTools", "Logging", "MKL", "PyCall", "JuLIP", "Symbolics", "Statistics", "Plots", "JLD2"]
109+
test = [
110+
"Test",
111+
"SafeTestsets",
112+
"CSV",
113+
"DataFrames",
114+
"DiffEqNoiseProcess",
115+
"FiniteDiff",
116+
"DiffEqDevTools",
117+
"Logging",
118+
"MKL",
119+
"PythonCall",
120+
"JuLIP",
121+
"Symbolics",
122+
"Statistics",
123+
"Plots",
124+
"JLD2",
125+
]

docs/src/atoms.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ start_time = time()
44
```
55
# [Handling Atoms](@id atoms)
66

7-
This package makes the choice to separate the atomic parameters from their positions and
8-
velocities for ease of use with the differential equations solvers.
9-
This contrasts somewhat with most other software packages where these would be usually
10-
by joined together into a single object.
7+
!!! tip "Tip: NQCDynamics.jl handles atoms differently to `ase`"
8+
This package makes the choice to separate the atomic parameters from their positions and
9+
velocities for ease of use with the differential equations solvers.
10+
This contrasts somewhat with most other software packages where these would be usually
11+
be joined together into a single object.
1112

1213
The atomic parameters here are contained within the
1314
[`Atoms`](@ref) type introduced earlier
@@ -40,32 +41,39 @@ When working with NQCDynamics, the most useful packages are [AtomsIO](https://gi
4041
for reading and writing structures and trajectories, and [ASEconvert](https://github.com/mfherbst/ASEconvert.jl)
4142
for working with [ASE](https://wiki.fysik.dtu.dk/ase/index.html) from within Julia.
4243

43-
## Using ASE with ASEconvert.jl
44+
## Using Python's `ase` package from Julia
4445

45-
This example shows how ASEconvert can be used to build a structure, then convert
46-
from the ASE format into an AtomsBase compatible system:
46+
Julia provides multiple options to run Python-based code from Julia scripts. The NQCD packages
47+
provide compatibility with [**PythonCall.jl**](https://github.com/JuliaPy/PythonCall.jl), and some deprecated interfaces for [**PyCall.jl**](https://github.com/JuliaPy/PyCall.jl) exist as well.
48+
While both of these packages function similarly, PythonCall forces you as a user to think more about when data is copied in memory between Python and Julia, enabling more efficient code.
49+
50+
This example shows how `ase.build` can be used to build a structure from within Julia, then convert
51+
from the ASE format into the required objects for atoms, positions and unit cell for an NQCD simulation:
4752

4853
```julia
49-
using ASEconvert
54+
using PythonCall
55+
using NQCBase
5056

51-
# Make a silicon supercell using ASE
52-
atoms_ase = ase.build.bulk("Si") * pytuple((4, 1, 1))
57+
ase_build = pyimport("ase.build")
5358

54-
# Convert to an AtomsBase-compatible structure
55-
atoms_ab = pyconvert(AbstractSystem, atoms_ase)
59+
# Make a silicon supercell using ASE
60+
atoms_ase = ase_build.bulk("Si") * pytuple((4, 1, 1))
5661
```
5762

5863
It is currently not possible to use an AtomsBase system directly with NQCDynamics, but can
5964
be quickly converted to the correct format:
6065

6166
```julia
6267
using NQCDynamics
63-
atoms_nqcd = Atoms(atoms_ab)
64-
r = Position(atoms_ab)
65-
v = Velocity(atoms_ab)
66-
c = Cell(atoms_ab)
68+
69+
atoms_nqcd, positions_nqcd, cell_nqcd = convert_from_ase_atoms(atoms_ase)
70+
71+
println(atoms_nqcd)
72+
println(positions_nqcd)
73+
println(cell_nqcd)
6774
```
6875

76+
6977
## Saving and loading with AtomsIO.jl
7078

7179
After running a simulation it often desirable to save the trajectory in a standard format for visualization.

test/Analysis/diatomic.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Test
22
using NQCDynamics
33
using Unitful, UnitfulAtomic
4-
using PyCall
4+
using PythonCall
55
using NQCModels
66
using JLD2
77

0 commit comments

Comments
 (0)