Model Commands

Model Commands

Model creation and management.

createatoms

Syntax:

void createatoms(); 

Can be run when importing trajectory frames. Creates enough atoms in the current trajectory frame to match the parent model.

For example:

createatoms();

currentmodel

Syntax:

model currentmodel(); 
model currentmodel(id); 
int  id;
model currentmodel(name); 
string  name;
model currentmodel(m); 
model  m;

Returns a reference to the current model (if no argument is given) or selects the supplied model and makes it the current model. The model may be selected either by name, by its integer position in the list of loaded models (i.e. 1 to N), or a model-type variable containing a valid model reference may be passed.

For example:

currentmodel(4);

selects the fourth loaded model.

currentmodel("Protein coordinates")

selects the model named "Protein coordinates" (provided it exists)

model m1, m2;
m1 = newmodel("Test model 1");
m2 = newmodel("Test model 2");
currentmodel(m1);

creates two models, storing references to each, and then re-selects the first one and makes it the current target again.

deletemodel

Syntax:

voiddeletemodel(id); 
int  id;
void deletemodel(name); 
string  name;
void deletemodel(m); 
model  m;

Deletes the current model (if no argument is given) or the supplied model.

firstmodel

Syntax:

model firstmodel(); 

Makes the first loaded / created model the current model, and returns a reference to it.

For example:

firstmodel();

info

Syntax:

void info(); 

Print out information on the current model and its atoms.

For example:

info();

finalisemodel

Syntax:

void finalisemodel(); 

Performs various internal tasks after a model has been fully created within a filter. Should be called after all operations on each created model have finished.

For example:

finalisemodel();

getmodel

Syntax:

model getmodel(id); 
int  id;
model getmodel(name); 
string  name;
model getmodel(m); 
model  m;

Returns a reference to the requested model, but unlike currentmodel does not make it the current model.

For example:

model alpha = getmodel("alpha2");

grabs a reference to the model named 'alpha2'.

model m = getmodel(5);

gets a reference to the fifth loaded model.

lastmodel

Syntax:

model lastmodel(); 

Makes the last loaded / created model the current model, and returns a reference to it.

For example:

model final = lastmodel();

listmodels

Syntax:

void listmodels(); 

Lists all models currently available.

For example:

listmodels();

loadmodel

Syntax:

int loadmodel(filename); 
string  filename;
int loadmodel(filename,  
 newname); 
string  filename;
string  newname;

Load model(s) from the filename provided, changing the name of the the (last loaded) model to newname (if provided). The last loaded model becomes the current model, and the number of models loaded is returned.

For example:

loadmodel("/home/foo/coords/test.xyz", "mymodel");

loads a model called 'test.xyz' and gives it the new name 'mymodel'.

modeltemplate

Syntax:

void modeltemplate(); 

Can only be run when importing trajectory frames. Templates the atoms in the trajectory's parent model by creating an equal number of atoms in the target trajectory frame, and copying the element and style data. Positions, forces, and velocities are not copied from the parent model atoms.

For example:

modeltemplate();

newmodel

Syntax:

model newmodel(name); 
string  name;

Create a new model called name which becomes the current model, and return a reference to it.

For example:

newmodel("emptymodel");

creates a new, empty model called 'emptymodel' and makes it current.

model c12 = newmodel("dodecane");

creates a new, empty model called 'dodecane', makes it current, and stores a reference to it in the variable c12.

nextmodel

Syntax:

model nextmodel(); 

Skips to the next loaded model, makes it current, and returns a reference to it.

For example:

model next = nextmodel();

parentmodel

Syntax:

void parentmodel(); 

Makes the parent model of the current trajectory frame the current model.

For example:

parentmodel();

prevmodel

Syntax:

model prevmodel(); 

Skips to the previous loaded model, makes it current, and returns a reference to it.

For example:

model prev = prevmodel();

savemodel

Syntax:

int savemodel(format,  
 filename); 
string  format;
string  filename;

Save the current model in the format given (which should correspond to a model export Filter nickname) to the filename specified. If the save was successful, an integer value of '1' is returned, otherwise '0'.

For example:

int success = savemodel("xyz", "/home/foo/newcoords/test.config");

saves the current model in xyz format to the filename given.

setname

Syntax:

void setname(name); 
string  name;

Sets the name of the current model.

For example:

setname("panther)";

gives the current model the cool-sounding name of 'panther'! Ahem.