How to make selected atom types oscillate around fixed positions in LJ system?

Hello,

I am working with a Kob-Andersen Lennard Jones (KA-LJ) glass model in units lj.
First I equilibrate the standard KA binary LJ mixture (types 1 and 2). Then I convert the system into a 4-species model so that:

type 1  → mobile species A
type 2  → mobile species B
type 3  → vibrating A'
type 4  → vibrating B'

Now I would like type 3 and type 4 atoms to oscillate (vibrate) around their own initial equilibrium positions, with a user-controlled frequency and amplitude, while type 1 and type 2 atoms evolve normally under LJ interactions.

Also, the masses of type 3 and 4 are defined in the data file and should be adjustable.

So in short:

:check_mark: Types 1 & 2 → integrated with NVT
:check_mark: Types 3 & 4 → prescribed sinusoidal motion around their initial position
:check_mark: All interactions use LJ (KA parameters)


:red_exclamation_mark: Problem

I tried to implement this using fix move and fix spring/self, but my script is not working as expected. Either the atoms do not move, or LAMMPS throws errors (for example, Illegal fix move command). So I think I may be using the wrong approach.


:red_question_mark: Question

What is the correct way in LAMMPS to make only atom types 3 and 4 oscillate sinusoidally around their initial positions, while the rest of the atoms evolve normally? Any guidance, example scripts, or relevant references would be highly appreciated.

Here is my script :

================== KA LJ WITH VIBRATING / PINNED TYPE 3 & 4 ==================

variable a loop 1
clear
reset_timestep 0

==========================================

Main parameters

variable s index 7.00 # temperature
variable g index 100 # thermo + dump interval
variable l index 100000 # run length (steps)
variable f index 0.005 # timestep
variable j index 0.5 # thermostat Tdamp

vibration controls

variable freq index 0.1 # frequency (0 => pinned)
variable A equal 0.1 # amplitude (LJ units)

==========================================

units lj
atom_style atomic
read_data data_file_T_${s}.dat

==========================================

Define groups

group nonrigid1 type 1
group nonrigid2 type 2
group vib3 type 3
group vib4 type 4
group vib union vib3 vib4

log log-equli_T.${s}

==========================================

Neighbors

neighbor 0.4 bin
neigh_modify delay 0 every 5 check no

==========================================

KA Lennard-Jones interactions

pair_style lj/cut 2.5
pair_modify shift yes
pair_coeff 1 1 1.0 1.0 2.5
pair_coeff 2 2 0.5 0.88 2.2
pair_coeff 3 3 1.0 1.0 2.5
pair_coeff 4 4 0.5 0.88 2.2
pair_coeff 1 2 1.5 0.8 2.0
pair_coeff 1 3 1.0 1.0 2.5
pair_coeff 1 4 1.5 0.8 2.0
pair_coeff 2 3 1.5 0.8 2.0
pair_coeff 2 4 0.5 0.88 2.2
pair_coeff 3 4 1.5 0.8 2.0

==========================================

STORE INITIAL POSITIONS (reference)

==========================================

compute ref all property/atom x y z
variable x0 atom c_ref[1]
variable y0 atom c_ref[2]
variable z0 atom c_ref[3]

==========================================

TIME & OSCILLATION

==========================================

variable PI equal 3.141592653589
variable t equal time
variable w equal 2*{PI}*{freq}

sinusoidal displacement (x-direction only for now)

variable dx atom {A}*sin({w}*${t})
variable dy atom 0.0
variable dz atom 0.0

final vibrating positions

variable xt atom v_x0+v_dx
variable yt atom v_y0+v_dy
variable zt atom v_z0+v_dz

==========================================

APPLY VIBRATION / PINNING

==========================================

if “${freq} < 1e-12” then &
“fix vibmove vib setforce 0 0 0” &
else &
“fix vibmove vib move atom v_xt v_yt v_zt”

==========================================

THERMOSTAT MOBILE PARTICLES ONLY

==========================================

fix 1 nonrigid1 nvt temp {s} {s} {j} fix 2 nonrigid2 nvt temp {s} {s} {j}

==========================================

OUTPUT

==========================================

thermo ${g}
thermo_modify flush yes
thermo_style custom step temp pe ke etotal press vol

dump d1 all custom {g} dump_vib_{s}.lammpstrj id type x y z
dump_modify d1 sort id

==========================================

RUN

==========================================

timestep {f} run {l}

==========================================

CLEANUP

==========================================

unfix 1
unfix 2
unfix vibmove
undump d1

Fix move is the way to go. It has the “wiggle” option specifically for this purpose.
To learn how to use a command, you should use the manual.
Rather than experimenting with your production input, I always recommend to create a minimal example with just a small number of atoms to experiment with commands that one is learning and this way one can monitor every step. With oscillatory processes one has to be careful to not output data on a multiple of the oscillation period as that can give the impression of nothing happening.

Then you are probably not using the command correctly.
You have to be more specific. We cannot read minds.

Thiis is not properly quoted and thus difficult to read. Please see the “Guidelines and Suggestions” post for more information on that. It also explains what you can and cannot expect from a public forum like this and what you have to do in general to have the best chances to get the help you need.