Langevin dynamics seed number

I have 10000 jobs that I want to run independently that use Langevin thermostats. However, I am using the HTCondor job scheduling system to run high throughput simulations, so I do not need a loop variable to run my 10000 jobs. The problem I am having is that I have written one lamps script for all the job submissions, replaced the seed number for the Langevin thermostat with $(seed), and then used a batch script to create a file named seed.txt that contains 10000 positive integers. I instructed my HTCondor job submission to use the seed defined in my lammps input file as a variable that reads from my seed.txt (mpirun -np 4 lmp_mpi -var test1 $file seed $file2 -in test.in.txt). However, this results in this error from lammps below. Is there something that I am doing wrong or need to know about the Langevin thermostat?

fix                          thermo all langevin 1 1 1 ${seed}
ERROR on proc 0: Substitution for illegal variable seed (src/input.cpp:553)
Last command: fix                          thermo all langevin ${ext_temp} ${ext_temp} 1 ${seed}

Yes, on the command line you need to use the -var flag for every variable.

Note that another way to do what you want to do is to generate a random number using bash, replace the value of the seed variable in the input script, then run LAMMPS :

#!/bin/bash

seed=$RANDOM
newline='variable seed equal '$seed
linetoreplace=$(cat input.lammps | grep 'variable seed equal')
sed -i '/'"$linetoreplace"'/c\'"$newline" input.lammps

mpirun -np 4 lmp_mpi -in input.lammps

When I need independent trajectories, I use this script to generate the random seed. It will refresh the seed every time the script is run, so there is no need to change it.

# Create a random seed.
shell dd if=/dev/urandom of=/tmp/random_number count=2 bs=1
shell od -An --format=dI /tmp/random_number > /tmp/seed
variable s1 file /tmp/seed
variable s2 equal abs(v_s1)
print "Seed ${s2}"
variable r1 equal random(10000,1000000,${s2})

# Test it 5 times.
label loop
variable a loop 5
variable r format r1 %.0f
print "$r"
# fix TEMP all langevin 300. 300. 1000. $r
next a
jump SELF loop
1 Like