Getting comfortable with EMC scripting

Hello,
what is the best way to get comfortable with emc scripting?

I also have few questions:

  1. how to define simulation box dimensions?
  2. how to insert atoms(sites) at a certain location of the simulation box? (through region command?)

thanks.

Are you referring to EMC Setup or EMC? The former uses a subset of what is possible in the latter. Both formats are also very different. It would also help when you describe what exactly you are trying to build.

Thank you for replying Dr. Veld,

I wanted to know the philosophy of scripting of build.emc file. What I have found is that the manual Does not have enough examples. I just wish to know which scripting format (of which software) have you followed when developing this tool (that way I can understand the scripting language myself and then modify it according to my needs). In the manual it only has some examples of using the setup.pl code.

Also I would be grateful if you can share any documents that can be useful for beginners.

Finally, I wish to build a nanotube 5nm long, that has benzene ring grafted to its inner surface in the last 1 nm and hydroxyl (OH-) radical grafted in its 1st 1nm.

Thank you.

Dear User,

The scripting language used in the EMC C code is based on what Mathematica uses to define its variables. The same structures are used in the EMC input/output format. EMC Script does not support functions, in contrast to Mathematica. A few small evaluation functions are available, which typically are used in selection criteria. EMC Script – which syntax and descriptions can be found under ‘Scripting Commands’ in the manual – is typically more complex than EMC Setup scripting. A place to start would be to use EMC Setup to generate the EMC Script build.emc file. This could be used as a basis for understanding EMC Script. However, EMC Setup only supports a subset of possibilities in EMC Script. Some examples of EMC Script, which are in large not supported by EMC Setup, can be found in

$EMC_ROOT/examples/build

As to your particular problem, one could import your favorite carbon nanotube from a snippet produced by e.g. the nanotube builder in VMD. Make sure the diameter of your nanotube is large enough to hold your benzyl groups. Once imported, grafting of both benzyl and hydroxyl groups can be done by combining specific cylindrical build regions with

clusters = {graft -> {...}};

Box dimensions of a system are controlled by the system section of build command:

build = {system -> {geometry -> {}}};

Building of a system around the nanotube can be done by using a cylindrical exclusion group as part of the select section of the build command:

build = {select -> {exclude -> {...}}};

You could embed this nanotube in a matrix to simulate the flux through the tube. Please note though that currently EMC only allows to import one structure in total. This would mean, that you would have to construct the embedded nanotube as a whole and offer this as import to EMC. I would use EMC Setup to create the import framework plus group definitions by using

emc_template.sh import

This generates an .esh, which you can use to generate a build.emc. The latter you can use as a starting point – with most of the imported syntax of the above – to expand on.

Dear Dr. Veld

I’m looking to build a CNT+Polyethylene system with the pcff or compass forcefield using the method outlined here, but am unable to do so. I face the following issues.

  1. I have generated a cnt file from VMD (.pdb and .psf), but am unable to import it to EMC using pcff.
    nanotube.pdb (64.9 KB)
    nanotube.psf (320.2 KB)

  2. I’m also unable to figure out how to construct the matrix (PE) around the cnt. I keep running into the following error when I attempt to create an exclusion group:
    Error: core/script/build/system.c:338 ScriptBuildSystem:
    New geometry is too small (ntotal?).
    Program aborted.

Could you please share a sample build script or guide me in doing so

Dear user,

Could you create a new topic for this question? It would help other users finding this thread. Name it something like: How to embed a carbon nanotube in a polyethylene melt. Thanks in advance!

Dear Dr. Veld

I have created a new topic with the suggested name : How to embed a carbon nanotube in a polyethylene melt.