# External interaction¶

## Axial stretching¶

class AxialStretching(all_info, group)

The constructor of a stretching object of the box for a group of particles.

Parameters: all_info (AllInfo) – The system information. group (ParticleSet) – The group of particles.
setBoxLength(Variant vL, string direction)

specifies the change of box length and its direction with Variant. The candidates are “X”, “Y”, “Z”.

Example:

v = galamost.VariantLinear()
v.setPoint(0, 31) # time step, box length.
v.setPoint(100000, 60)

axs = galamost.AxialStretching(all_info, group)
axs.setBoxLength(v, 'Y')


## External force¶

class ExternalForce(all_info, group)

The constructor of an external force object for a group of particles. The external force $$F$$ will be added on the group of particles and each particle have a $$F/N$$, where $$N$$ is the number of particles.

Parameters: all_info (AllInfo) – The system information. group (ParticleSet) – The group of particles.
setForce(Variant vf, std::string direction)

specifies the force magnitude varying by time steps and direction (the candidates are “X”, “Y”, and “Z”).

setForce(Variant vf, float x, float y, float z)

specifies the force magnitude varying by time steps and direction vector (x, y, z).

setParams(string type, float factor)

specifies the factor of external force for a particle type (the default value is 1.0).

setParams(unsigned int index, float factor)

specifies the factor of external force for a particle with index.

Example:

v = galamost.VariantSin()
v.setPoint(0, 1000, 1, -1)
v.setPoint(1000000, 1000, 1, -1)
# set the parameters of sinusoid force by time step, period, max and min value where
# the latter three parameters are linearly varying by time step.

groupA = galamost.ParticleSet(all_info, "A")
ef = galamost.ExternalForce(all_info, groupA)
#initializes an external force object with system information and particle group.
ef.setForce(v, "X")
# sets parameters with force and direction.