Running LAMMPS in MATLAB

Hello All,

I was trying to execute a simple program in LAMMPS from the MATLAB command window typing the following syntax:

> command_line = [‘lmp_nuceserial -var latconst 4 < in.test’];
>> system(command_line)

But an error is coming saying that “/bin/bash: lmp_nuceserial: command not found

Can anyone please help me rectify my mistake? Thank you so much

My in.test input file is as follows:

---------- Initialize Simulation ---------------------

units metal
dimension 3
boundary p p p
atom_style atomic
atom_modify map array

---------- Create Atoms ---------------------

lattice fcc 4
region box block 0 1 0 1 0 1 units lattice
create_box 1 box

lattice fcc 4 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
create_atoms 1 box
replicate 1 1 1

---------- Define Interatomic Potential ---------------------

pair_style eam/alloy
pair_coeff * * Al99.eam.alloy Al
neighbor 2.0 bin
neigh_modify delay 10 check yes

---------- Define Settings ---------------------

compute eng all pe/atom
compute eatoms all reduce sum c_eng

---------- Run Minimization ---------------------

reset_timestep 0
fix 1 all box/relax iso 0.0 vmax 0.001
thermo 10
thermo_style custom step pe lx ly lz press pxx pyy pzz c_eatoms
min_style cg
minimize 1e-25 1e-25 5000 10000

variable natoms equal “count(all)”
variable teng equal “c_eatoms”
variable length equal “lx”
variable ecoh equal “v_teng/v_natoms”

Thanks,

may be you need to use ./lmp_nuceserial instead of lmp_nuceserial and to be in correct directory.
e.g.

> command_line = [’./lmp_nuceserial -var latconst 4 < in.test’];

29.04.2013, 03:44, “Upamanyu Ray” <uray@…258…>:

Thanks a lot Maxim. Just followed what you said and executed it successfully.

Following commands are working for me in Mac using a loop in Matlab:

count = 0;
for i = 3.0:0.01:6.0

command_line = [’./lmp_openmpi -var latconst ’ num2str(i) ’ < in.fcc’];

% this next line executes the command line
system(command_line)