# vector

Calculate various types of vector quantities.

vector [<name>] <Type> [out <filename> [ptrajoutput]] [<mask1>] [<mask2>] [magnitude] [ired]

`<Type>`

= { mask | minimage | dipole | center | corrplane | box | boxcenter | ucellx | ucelly | ucellz principal [x|y|z] }

`[<name>]`

Vector data set name.

`<Type>`

Vector type; see below.

`[out <filename>]`

Write vector data to <filename> with format ’Vx Vy Vz Ox Oy Oz’ where V denotes vector coordinates and ’O’ denotes origin coordinates.

`[ptrajoutput]`

Write vector data in ptraj style (Vx Vy Vz Ox Oy Oz Vx+Ox Vy+Oy Vz+Oz). This prevents additional formatting of <filename> and is not

compatible with ’magnitude’.

`[<mask1>]`

Atom mask, required for all types except ’box’.

`[<mask2>]`

Second atom mask, only required for type ’mask’.

`[magnitude]`

Store the magnitude of the vector with aspect [Mag].

`[ired]`

Mark this vector for subsequent IRED analysis with commands ’matrix ired’ and ’ired’.

**Data Sets Created:**

`<name>`

Vector data set.

`<name>[Mag]`

(magnitude only) Vector magnitude.

This command will keep track of a vector value (and its origin) over the trajectory; the data can be referenced for later use based on the name (which must be unique). The types of vectors that can be calculated are:

`mask`

(Default) Store vector from center of mass of atoms in <mask1> to atoms in <mask2>.

`minimage`

Store minimum-imaged vector from center of mass of atoms in <mask1> to atoms in <mask2>.

`dipole`

Store the dipole and center of mass of the atoms specified in <mask1>. The vector is not converted to appropriate units, nor is the value well-defined if the atoms in the mask are not overall charge neutral.

`center`

Store the center of mass of atoms in <mask1>. The reference point is the origin (0.0, 0.0, 0.0).

`corrplane`

This defines a vector perpendicular to the (least-squares best) plane through the atoms in <mask1>.

The reference point is the center of mass of atoms in <mask1>.

`box`

(No mask needed) Store the box lengths of the trajectory. The reference point is the origin (0.0, 0.0, 0.0).

`boxcenter`

(No mask needed) Store the center of the box as a vector.

`ucell{x|y|z}`

(No mask needed) Store specified unit cell (i.e. box) vector.

`principal [x|y|z]`

Store one of the principal axis vectors determined by diagonalization of the inertial matrix from the coordinates of the atoms specified by <mask1>. The eigenvector with the largest eigenvalue is considered “x” (i.e., the hardest axis to rotate around) and the eigenvector with the smallest eigenvalue is considered “z”. If none of x or y or z are specified, then the “x” principal axis is stored. The reference point is the

center of mass of atoms in <mask1>.

CPPTRAJ supports writing out vector data in a pseudo-trajectory format for easy visualization. Once a vector data set has been generated the writedata command can be used with the vectraj keyword to write a pseudo trajectory consisting of two atoms, one for the vector origin and one for the vector from the origin (i.e. V+O). For example, to create a MOL2 containing a pseudo-trajectory of the minimum-imaged vector from residue 4 to residue 11:

trajin tz2.nc vector v8 minimage out v8.dat :4 :11 run writedata v8.mol2 vectraj v8 trajfmt mol2

Auto-correlation or cross-correlation functions can be calculated subsequently for vectors using either the corr analysis command or the timecorr analysis command (to calculate via spherical harmonic theory).