Skip to content

Commit 0426f36

Browse files
committed
more keyword arguments in System constructor from AtomsBase system
1 parent 3beadb8 commit 0426f36

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

docs/src/documentation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ visualize(sys.loggers.coords, boundary, "sim_lj.mp4")
137137
```
138138
![LJ simulation](images/sim_lj.gif)
139139

140+
A Molly [`System`](@ref) can also be constructed from an AtomsBase.jl system. For example:
141+
```julia
142+
System(ab_sys; force_units=u"kJ/Å", energy_units=u"kJ")
143+
```
144+
140145
## GPU acceleration
141146

142147
To run simulations on the GPU you will need to have a GPU available and then load the appropriate package:

src/types.jl

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,17 +1199,25 @@ end
11991199
Base.show(io::IO, ::MIME"text/plain", s::Union{System, ReplicaSystem}) = show(io, s)
12001200

12011201
"""
1202-
System(abstract_system; force_units=u"kJ * mol^-1 * nm^-1", energy_units=u"kJ * mol^-1")
1202+
System(abstract_system; <keyword arguments>)
12031203
12041204
Convert an AtomsBase `AbstractSystem` to a Molly `System`.
12051205
1206-
`force_units` and `energy_units` should be set as appropriate.
1207-
To add properties not present in the AtomsBase interface (e.g. pair potentials) use the
1208-
convenience constructor `System(sys::System)`.
1206+
The keyword arguments `force_units` and `energy_units` should be set as appropriate.
1207+
Other keyword arguments are the same as for the main `System` constructor.
12091208
"""
12101209
function System(sys::AtomsBase.AbstractSystem{D};
1210+
topology=nothing,
1211+
pairwise_inters=(),
1212+
specific_inter_lists=(),
1213+
general_inters=(),
1214+
constraints=(),
1215+
neighbor_finder=NoNeighborFinder(),
1216+
loggers=(),
12111217
force_units=u"kJ * mol^-1 * nm^-1",
1212-
energy_units=u"kJ * mol^-1") where D
1218+
energy_units=u"kJ * mol^-1",
1219+
k=default_k(energy_units),
1220+
data=nothing) where D
12131221
bb = AtomsBase.cell_vectors(sys)
12141222
is_cubic = true
12151223
for (i, bv) in enumerate(bb)
@@ -1274,8 +1282,17 @@ function System(sys::AtomsBase.AbstractSystem{D};
12741282
boundary=molly_boundary,
12751283
velocities=vels,
12761284
atoms_data=atoms_data,
1285+
topology=topology,
1286+
pairwise_inters=pairwise_inters,
1287+
specific_inter_lists=specific_inter_lists,
1288+
general_inters=general_inters,
1289+
constraints=constraints,
1290+
neighbor_finder=neighbor_finder,
1291+
loggers=loggers,
12771292
force_units=force_units,
12781293
energy_units=energy_units,
1294+
k=k,
1295+
data=data,
12791296
)
12801297
end
12811298

0 commit comments

Comments
 (0)