Skip to content

03_Creating_The_Cell

Ambuild-code edited this page Jul 19, 2019 · 2 revisions

3.1 Setting Up the Cell

Ambuild creates its structures in a cubic cell. The first step is to create an empty cell object. This is done using the following command:

boxDim=[20,20,20]

mycell = ab_cell.Cell( boxDim, atomMargin=0.5, bondMargin=0.5, bondAngleMargin=15, doLog=False )

This creates an empty cell object called ‘mycell’. The name mycell is used to prevent this clashing with ‘cell’, the name used to import the Cell code module.

The variables in the boxDim and cell arguments are given as:

  • boxDim: This is a list of three numbers specifying the size of the

cell A, B, and C dimensions (given in angstroms, Å). Dimensions are defined from 0 to A, B, or C.

  • atomMargin: The additional distance to be added on to the van der

Waals radii of two atoms to determine if they are close enough to clash.

  • bondMargin: Two atoms are considered close enough to bond if they are

within the bond length defined for the two atoms +/- the bondMargin.

  • bondAngleMargin: The tolerance (in degrees) from the ideal of 180 that

defines an acceptable bond.

  • doLog: This argument (expressed as True or False) specifies if a log

file will be created. This is not recommended as it generates lots of data and slows the program.

Alternatively, the cell can be read from a .car file using the filePath argument instead of the boxDim argument. The filePath argument gives the location of the .car file containing the cell dimensions and the coordinates of molecules. In this case the molecule will be read in as a static structure that is not moved during any of the MD or geometry optimisation steps. The name of this static will be named after the .car file. When using the filePath argument, the cell dimensions will be taken from the PBC line in the .car file, e.g.:

PBC 40.0000 30.0000 30.0000 90.0000 90.0000 90.0000 (P1)

3.2 Creating a Cell Library

With the cell defined, it is possible to begin specifying which fragments go into the cell. This is done by creating a cell library that contains all the building blocks that will be used in the simulation, using the following command:

mycell.libraryAddFragment( filename=fragA, fragmentType='A' )

The variables in the libraryAddFragment argument are:

  • filename: the path to the .car file. There will need to be a

corresponding .csv file that defines the endGroups and capAtoms etc.

  • fragmentType: a name that will be used to identify the fragment. This

cannot contain the ":" or "-" characters.

  • Solvent: This optional variable can be used to specify that this

fragmentType is solvent and so won't be clash-checked in Zip steps.

As many fragments can be added as desired. The only requirement is that each fragment is named differently.

3.3 Specifying Bonding Rules

With the fragments added, bonding rules can be specified using the following command:

mycell.addBondType( 'A:a-B:a' )

endGroups are defined by the fragmentType they belong to (which is set by the fragmentType argument to libraryAddFragment), along with the identifier for that endGroup which is specified in the first column of the .csv file. These are separated by a colon (“:”), so an endGroup is expressed in the form:

fragmentTypeX:endGroup**x**

A bond is specified by two endGroups, separated using a hyphen, giving a bond identifier the form of:

fragmentType1:endGroup**1**-fragmentType**2**:endGroup**2**

In the above example, a bond was formed between endGroup ‘a’ of fragmentType ‘A’ and endGroup ‘a’ of fragmentType ‘B’.

Building blocks can have multiple endGroups, depending on the nature of the building block, and so it is possible to form multiple bonds between two fragmentTypes.

Sometimes it is necessary to limit the number of bonds of a particular type to an individual fragment. For example, if a fragment has three nitrogen endGroups, but only one can be used before the others become unavailable for bonding. This is achieved with the setMaxBonds argument below:

mycell.addBondType( bondType='A:a-B:a', count=1 )

The arguments in the setMaxBonds argument are as follows:

  • bondType: The bondType as was specified when using the addBondType

argument above.

  • count: The maximum number of permissible bonds for a single fragment.