EMC Building Outside Simulation Box

Hi!
I am very new to LAMMPS and EMC so please don’t roast me too much.

I am trying to build a whole bunch of structure files for some polymers with PyEMC so that I can compute their glass transition.

However, I am having issues with the program building the structure outside the simulation box. Here is am image in OVITO of the output

and the correct structure obtained elsewhere

In the manual it doesn’t seem to have an option for setting the box dimensions. So how do I prevent this?

Hi Wyatt,

I assume you have not defined the density. By default, the density is set to 1 g/cc. You can lower this density to say 0.1 g/cc if you want to build one structure in a much larger box. In EMC Setup you would do this by setting density under ITEM OPTIONS to 0.1. I am not quite sure how to do this when using PyEMC. Just out of curiosity: are you planning on calculating Tg based on a single polymer/oligomer molecule, or are you wanting to deduce Tg from a density vs. temperature plot of polymers at their condensed phase density? Just for your information: EMC includes a Tg determination example under examples/setup/environment/t_glass.

1 Like

Thank you so much for the response!

I have played around with the density setting, and it still seems to still build outside the box even when I choose something like density = 0.01.
I thought it might have something to do with the ‘system_pbc’ setting, but this also did not change anything… Hmm.

I was able to manually rewrite the data file with a little python script to produce what I thought system_pbc would do:

My plan was to compute Tg from a temperature/density plot after annealing a sample of several oligomers. I was not aware there was another way.

I will take a look at that example, that sounds mighty useful! I saw it there before but I haven’t figured out how to get it to work yet… I had issues with the ${dir} variable (it makes a folder called …/a-pp/200 205 210…300 instead of separate ones and then the script thinks they’re separate arguments) and also the atom.sh script isn’t able to find the .pl scripts even though I think I added the ‘scripts’ and ‘bin’ folders to my PATH. Is this something wrong with my setup file, or an issue with my installation?

Well… Boxes always assume periodic images. This means that whatever looks to be outside of your box will actually be inside the box, since it is mapped back in when the periodic image convention is applied. I assume you are using .pdb and .psf for your visualization. Set the options pdb_unwrap and pdb_pbc under ITEM OPTIONS to false if you do not want to unwrap your polymer and you want to apply periodic boundary conditions to the box you visualize.

Having said that, you will want to simulate at condensed matter conditions. This means that your density should be around 1 g/cc and not at very low conditions like 0.01 g/cc.

I am not sure which ${dir} variable in what file you are referring to. Could you be more specific? Also, could you tell me what operating system you are using?

1 Like

Oh! That fixed the issue in the title, maybe it wasn’t even going to be a problem.

Noted!

I am using Mac OSX 13.6.7

The first few lines of the log file look like this:

### started at Wed Jul 31 05:43:25 CDT 2024

### data/00/a-pp/210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300/00/build
./run/2023072600.sh: line 325: [: too many arguments
./run/2023072600.sh: line 329: [: too many arguments
cd data/00/a-pp/210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300/00/build
./run/2023072600.sh: line 22: cd: data/00/a-pp/210: No such file or directory
/Users/wyattkuehster/Desktop/project/chemistry/scripts/atom.sh -project atom -stage 00 -trial a-pp -temperature 210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 -density 0.85 -copy 00 atom
emc_setup.pl -lammps=2018 -preprocess=1 -project=atom -workdir=/Users/wyattkuehster/Desktop/project -emc_execute=false atom.esh
EMC Setup v4.1.5 (March 21, 2023), (c) 2004-2023 Pieter J. in 't Veld
Info: reading script from “./atom.esh”
Error: :20:9: error: invalid preprocessing directive
run.sh -memory default -ppn default -n 1 -walltime 00:40:00 -starttime now -queue default -project atom -output build.out emc_ -seed=1722422605 build.emc

### run.sh v3.5 started at Wed Jul 31 05:43:26 CDT 2024 ###

ERROR: ‘emc_’ not found

Then it continues like that for a long while…

2023072600.log (19.1 KB)

The ${dir} variable I am referring to is in this line 325 of ./run/2023072600.sh:

run_emc() {
local dir=“$1”; shift;
printf “### ${dir}\n\n”;
if [ ! -e ${dir} ]; then
run mkdir -p ${dir};
fi; `

It looks like it is supposed to be set by this line in the same file:
dir="data/${STAGE}/${TRIAL}/${TEMPERATURE}/${COPY}";
and I’m pretty sure that’s what’s causing that very first error. The further errors (“invalid preprocessing directive” and “can’t find emc_”) are completely mysterious to me, but a lot of them seem vaguely directory-related

Thank you for the logs. Did you use emc.pl or emc_setup.pl to generate ./run/2023072600.sh? Do you have access to a queueing system on the machine you started ./run/2023072600.sh from?

1 Like

I believe I have fixed the strange filesystem creation problem!! However I couldn’t tell you what exactly was wrong. After clearing everything out of my PATH variable and reinstalling EMC it just worked suddenly.

I used emc_setup.pl to generate that last run script.
emc.pl generates some different errors but actually fewer!
2023072600_emc_setup.log (166.9 KB)
2023072600_emc.log (79.4 KB)

I do have access to an HPC with slurm, but I have been trying to get as much building and troubleshooting done locally as possible.

Furthermore, the error “ERROR: ‘emc_’ not found” was an issue with my HOST environment variable as described here: New confusions - #2 by veld

If I run it with emc.pl then at least the build script runs! :tada:
Thanks so much Dr. Veld