Setting the pair potential

This tutorial shows how to set the pair potential.

  • Created 5-29-07; code revision 203

Lennard-Jones Potential

In the previous tutorials such as Initialize System Random we created single component simulations where particles interact via the Lennard-Jones potential. We did this in the constructor of our custom class:

SetInteraction(new LennardJones);

This told the code to use the LennardJones interaction.

Alternatively, we could have done:

//declare an instance
LennardJones *potential = new LennardJones;

//set parameter
potential -> SetEpsilon(1.0);
potential -> SetSigma(1.0);

//set the interaction
SetInteraction(potential);

Setting other Potentials

A variety of interactions are available in the SimulationBuilder project, under Shared > SystemTypes&Interactions. These include:

To declare them, one needs only to follow the procedure above for LennardJones above. Note, not all potentials have the same parameters, refer to class documentation for descriptions.

Mixtures

Also under SystemTypes&Interactions is a class called CustomInteraction?, which allows one to easily define mixtures with different interactions between components. The following example sets AA, AB, and BB interactions for two types of particles A and B.

class BinaryInteraction : public CustomInteraction
{
   public:
      BinaryInteraction()
      {
         SetInteraction(type::A | type::A, new TwelveSixLjPotential);
         SetInteraction(type::B | type::B, new TwelveSixLjPotential);
         SetInteraction(type::A | type::B, new WcaPotential);
      }
};