Hi everyone,

I'm calling lammps as a shared lib from OpenFOAM. I would like to use

the "include" command as described here"

http://lammps.sandia.gov/doc/include.html " to include some variables

and fixes.

When I run the input script with lammps as standalone it includes the

files but when I call the script with lammps as a shared lib it doesn't

work. I've attached the input script and include files.

Any thoughts or tips? Thanks in advance.

i cannot reproduce it with the current version of LAMMPS (10 March 2017).

if i comment out the 'read_restart' command (for lack of having your

restart file), i can see "include" working via the library interface. e.g.

when using this little python script:

[[email protected]... Downloads]$ cat test.py

from lammps import *

lmp=lammps()

lmp.command('echo both')

lmp.file('in.lammps')

which produces the following screen output indicating that the "include"

directive is properly processed.

axel.

[[email protected]... Downloads]$ python test.py

LAMMPS (10 Mar 2017)

using 1 OpenMP thread(s) per MPI task

# input script lammpsFoam simulations

package omp 0

using multi-threaded neighbor list subroutines

atom_style sphere

atom_modify map array

boundary f f f

newton off

processors * * *

units cgs

comm_modify vel yes

# Read restart and import variables

variable path getenv "PWD"

print "path is \{path\}"
path is /home/akohlmey/Downloads
\# read\_restart restart\.grow
include {path}/variables

include /home/akohlmey/Downloads/variables

# Variables used in multiple scripts

# domain variables

variable H0 equal 11.5 # [cm]

variable EF equal 3.0 # [-]

variable hb equal v_H0*v_EF # [cm]

variable height equal 1.1*v_H0*v_EF # [cm], add 10% extra height to domain

variable width equal 1.0 # [cm]

variable depth equal 1.0 # [cm]

variable eps equal 1.-$((1.-0.4)/v_EF) # average vol fraction, needed for

particle insertion eqn

variable eps equal 1.-0.19999999999999998335

variable rhop equal 2.8 # [g/cm3]

# particle insertion variables

variable dslice equal 0.2 # thicknes of a single slice

variable slices equal floor(\{hb\}/{dslice}) # nr of insertion slices

variable slices equal floor(34.5/\{dslice\}\)
variable slices equal floor\(34\.5/0\.2\)
variable vslice equal (v_width)*\(v\_width\)\*v\_dslice \# volume of a single
slice
variable vslice equal 1\*(v_width)*v_dslice

variable vslice equal 1*1*v_dslice

variable dred equal 0.5 # reduction factor for insertion size

variable CG equal 2. # particle coarse graining factor

# Growth variables

variable dred equal 0.1 # reduction factor for insertion size

variable growts equal 25000

variable growevery equal 1

variable relaxts1 equal 10000

variable relaxts2 equal 100000

# granular variables (based on eqns from Landry 2003 )

variable dpav equal 0.025

variable mpav equal $(v_rhop*PI/6.*v_dpav*v_dpav*v_dpav)

variable mpav equal 2.2907446432425579132e-05

variable g equal 981.

variable kn equal \(2\.e5\*v\_mpav\*v\_g/v\_dpav\)
variable kn equal 179777\.63960167608457
variable kt equal (2./7.*v_kn)

variable kt equal 51365.039886193138955

variable gamman equal 50*\(sqrt\(v\_g/v\_dpav\)\)
variable gamman equal 50\*198\.09088823063012796
variable gammat equal {gamman}

variable gammat equal 9904.54441153151

variable mu equal 0.15

print "included variables"

included variables

include \{path\}/fixes
include /home/akohlmey/Downloads/fixes
\# pair\_style none
pair\_style gran/hertz/history/omp {kn} \{kt\} {gamman} \{gammat\} {mu} 1

pair_style gran/hertz/history/omp 179777.639601676 \{kt\} {gamman}

\{gammat\} {mu} 1

pair_style gran/hertz/history/omp 179777.639601676 51365.0398861931

\{gamman\} {gammat} \{mu\} 1
pair\_style gran/hertz/history/omp 179777\.639601676 51365\.0398861931
9904\.54441153151 {gammat} \{mu\} 1
pair\_style gran/hertz/history/omp 179777\.639601676 51365\.0398861931
9904\.54441153151 9904\.54441153151 {mu} 1

pair_style gran/hertz/history/omp 179777.639601676 51365.0398861931

9904.54441153151 9904.54441153151 0.15 1

pair_coeff * *

ERROR: Pair_coeff command before simulation box is defined

(../input.cpp:1762)