Getting comfortable with EMC scripting

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?)


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 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


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 not 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 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.