ModelExample

class ModelExample : public feasst::ModelTwoBody

Add a model to FEASST by using this file as a template and instruction set. Follow the same steps detailed in /feasst/plugin/example/README.rst. In summary, copy model_example.[h/cpp] to new_name.[h/cpp], replace ModelExample with NewName, then replace MODEL_EXAMPLE with NEW_NAME.

In some cases, TablePotential may be a more convenient and efficient approach to implementing a custom potential in FEASST.

For more inspiration, take a look at other existing ModelTwoBody, such as LennardJones or LennardJonesCutShift, or the models plugin. Sometimes it is easiest to find an existing model that is the more similar to what you need, and copy/rename those files instead.

As an example, consider the Jagla model,[1] but with the variables renamed as follows: \(\epsilon_1 \rightarrow \gamma\), \(\epsilon_2 \rightarrow \epsilon\), \(\lambda_1 \rightarrow \lambda\), \(\lambda_2 \rightarrow r_c\).

\[\begin{split}U(r) = \left\{ \begin{array}{ll} \infty & : r < \sigma, \\ \frac{\gamma(\lambda - r)-\epsilon(r-\sigma)}{\lambda-\sigma} & : \sigma \le r \le \lambda, \\ -\frac{\epsilon(r_c - r)}{r_c-\lambda} & : \lambda \le r \le r_c, \\ 0 & : r \ge r_c. \end{array} \right.\end{split}\]

In some studies, the continuous linear ramp has been converted into a number of discrete steps to enable simulations with discontinuous molecular dynamics. For example, see Fig. 1(d) of de Haro et al.[2]

References:

Public Functions

double num_discretized_steps() const

Return the argument num_discretized_steps in read-only fashion.

void precompute(const ModelParams &existing)

Precompute model parameters based on existing model parameters.

double energy(const double squared_distance, const int type1, const int type2, const ModelParams &model_params)

The energy between two site types depends upon the distance between them and the model parameters.

void serialize(std::ostream &ostr) const

Serialization is the flatening of an object into a stream of characters which may be saved to file and later deserialized back into the object.

std::shared_ptr<Model> create(std::istream &istr) const

Deserialization is the reverse process of the above.

Arguments

  • num_discretized_steps: convert the continuous ramp potential into a number of dicontinuous, discretized steps. If 0, then use the linear ramp potential (default: 0).

Use this comment to describe and add any user arguments (or delete if no user arguments are required). Ensure the default value corresponds to the one in the .cpp file. Note that “Site Properties” in fstprt files are not added here.