I am attempting to rapidly compute the energy of interaction between pairs of ellipsoidal particles in specific positions & orientations using the lammps python module (e.g. up to 10k pairs of particles and up to 1k unique sets parameters).
I initially hoped to manually set quaternions like one would set atom positions or properties but it does not appear that python can access the pointers for the quaternions based on the conversation here: Cannot extract quaternions with python - #2 by akohlmey . I did attempt to compute the quaternion and then set the compute pointers to the desired values, but it didn’t update the quaternions (unsurprisingly).
Does anyone know - Is there another backdoor way to directly set an ellipsoid’s quaternion?
As a 2nd (slightly slower) successful approach, I created two ellipsoids via in the desired positions & orientations, calculated their energy, deleted the ellipsoids, and create two new ellipsoids in the desired positions & orientations using read_data, and repeated.
Here is an example single script that shows how to do it for future reference. You can decompose the script and run the commands from python.
#2 GB Particles
dimension 3
units real
boundary f f f
atom_style ellipsoid
pair_style gayberne 1.0 1.0 1.0 20.0 #gamma, upsilon, mu, cutoff
read_data "GB_template1.data"
pair_coeff 1 1 1.0 1.0 2.0 1.0 3.0 2.0 1.0 3.0
# i j eps sig e1a e1b e1c e2a e2b e2c
compute gbpair all pair gayberne epair
compute quat all property/atom quati quatj quatk quatw
group GB id 1:2 #necessary for the delete_atoms
timestep 1
#Run
fix 1 all nve
run 0
unfix 1
delete_atoms group GB
read_data "GB_template2.data" add append
pair_coeff 1 1 1.0 1.0 2.0 1.0 3.0 2.0 1.0 3.0
# i j eps sig e1a e1b e1c e2a e2b e2c
timestep 1
#Run
fix 1 all nve
run 0
unfix 1
and the GB_template#.data files are:
Lammps Description
2 atoms
1 atom types
2 ellipsoids
0 40.0 xlo xhi
0 40.0 ylo yhi
0 40.0 zlo zhi
Atoms # atom-ID atom-type ellipsoidflag density x y z
1 1 1 1 0.0 0.0 0.0
2 1 1 1 5.0 0.0 0.0
Ellipsoids # atom-ID shapex shapey shapez quatw quati quatj quatk **Diameters**
1 2.0 1.5 1.0 1.0 0.0 0.0 0.0
2 2.0 1.5 1.0 1.0 0.0 0.0 0.0