Pattern Commands

Pattern Commands

Automatically or manually create pattern descriptions for models.

clearpatterns

Syntax:

void clearpatterns(); 

Delete the pattern description of the current model. It's a good idea to run this command before adding a pattern definition by hand with calls to newpattern.

For example:

clearpatterns();

createpatterns

Syntax:

void createpatterns(); 

Automatically detect and create the pattern description for the current model.

For example:

createpatterns();

currentpattern

Syntax:

pattern currentpattern(); 
pattern currentpattern(name); 
string  name;
pattern currentpattern(id); 
int  id;

Get the named pattern or pattern with given id (if either was specified), returning its reference and setting it to be the current pattern.

For example:

pattern p = currentpattern("liquid");

sets the pattern named 'liquid' in the current model to be the current pattern, setting its reference in the variable p.

pattern p = currentpattern();

returns a reference to the current pattern.

getpattern

Syntax:

pattern getpattern(name); 
string  name;
pattern getpattern(id); 
int  id;

Get the named pattern, or pattern with id specified, returning its reference.

For example:

pattern p = getpattern("solid");

gets the pattern named 'solid' in the current model, setting its reference in the variable p.

getpattern(3);

gets the third pattern in the current model.

listpatterns

Syntax:

void listpatterns(); 

List the patterns in the current model.

For example:

listpatterns();

newpattern

Syntax:

pattern newpattern(name,  
 nmols,  
 atomspermol); 
string  name;
int  nmols;
int  atomspermol;

Add a new pattern node to the current model, spanning nmols molecules of atomspermol atoms each, and called name. A reference to the new pattern is returned.

For example:

pattern p = newpattern("water", 100, 3);

creates a new pattern description of 100 molecules of 3 atoms each named 'water' (i.e. 100 water molecules) in the current model, and returns its reference