sampledoc

Simulation Class API

Class data structures for simulation data

class simulation.Simulation(name, verbose=False)[source]

Data structure for describing how a simulation can be performed. The attributes stored can be used by a caller to construct/gather the appropriate components to run a simulation.

There will be a tight coupling between objects of this class and the StructureContainer objects. Information from the StructureContainer objects will in general be used as part of the input to a simulation generated by using the data from this object

A template directory can be set. This is a common location for derived classes to access any template files needed to setup simulation

NOTE: 1. This is not the simulation code itself and does no calculations.

copyStructureContainerInto(strucC)[source]

Set the structure container. Deep copy performed, so that external changes to structure container are not reflected here.

createSimulation()[source]

Checks for existence of a top level simulation directory and writes out all files needed for running a simulation.

Files copied/output are contained in the attribute ‘inputFileNames’.

In principle many input files/scripts could be copied to this location. If directory not found, then directory is created. Directory is creating from top level of where this class is executed

getSimName()[source]

Return name used to create the simulation object

printStruc()[source]

Dump contents of held structure container

readOutput(fileName)[source]

This is the ‘effective’ base class interface for a method that reads in an external output file and populates an instance of this class object

This method should be redefined for each kind of file types (typically defined by simulation version eg LAMMPS, Gaussian etc) The derived classes must implement the following:

def readOutput(self, fileName): ... ... return None

Args:
fileName (str) string of filename to input
setStructureContainer(strucC)[source]

Setter for the structure container.

setTemplateDir(tdir)[source]

Set template directory location

writeInput(fileName)[source]

This is the ‘effective’ base class interface for a method that writes an input file based on the internal attributes of an instance of the Simulation object

This method should be redefined for each kind of file types (typically defined by simulation version eg LAMMPS, Gaussian etc) The derived classes must implement the following:

def writeOutput(self, fileName): ... ... return None

Args:
fileName (str) string of filename to input