I agree that one or a few numeric array(s) without boxing is
preferable. If each atom has the same number of forces it's certainly
best. Boxing is to be avoided usually.
If I remember aright from many years back, at the end of one highschool
year I offered to teach J to a promising sophomore, one Marshall
Lochbaum, the next year. To get a head start, he chose as his first
(entirely untutored) summer project atomic collisions in varying numbers
of dimensions. He showed up at the start of the semester with about 50
lines, which worked fine, showing the Maxwell-Boltzmann distribution (in
3 dimensions). All tacit code it was. You follow in broad footsteps.
Henry Rich
On 7/15/2023 9:15 AM, Raul Miller wrote:
I think the approaches you described are fine.
That said, another approach would be to think of your dataset as a
table -- one row for each atom, with each column having different
significance. coordinate x,y, z; velocity x,y,z; force x,y,z, So, if
you had 42 atoms, your data would be a 42 by 9 matrix.
Or, perhaps it would be better to distinguish x,y,z from
coordinate/velocity/force (the 42 atom example being represented with
a 42 by 3 by 3 array or perhaps more conveniently a 3 by 42 by 3
array).
This last approach might have an implementation something like:
do_step=: positions_update, velocities_update,: forces_update
where each of the update verbs obtains the requisite information from
its y argument.
I hope this makes sense,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm