#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "array.h"
#include "hawaii.h"
#include <cvode/cvode.h>
#include <nvector/nvector_serial.h>
#include <sunmatrix/sunmatrix_dense.h>
#include <sunlinsol/sunlinsol_dense.h>
#include <cvode/cvode_direct.h>
#include <sundials/sundials_types.h>
Go to the source code of this file.
|
int | rhs (realtype t, N_Vector y, N_Vector ydot, void *user_data) |
| rhs function is passed to CVode library to propagate the trajectory. First, the phase-point coordinates are stored into MoleculeSystem struct. A contiguous vector of coordinates is assembled via extract_q_and_write_into_ms. Next, by calling the external function dpes, the derivatives of potential energy are computed and stored into MoleculeSystem::dVdq field. The components of derivative vector are then copied into the field Monomer::dVdq of the corresponding Monomer via the call to extract_dVdq_and_write_into_monomers. The right-hand side of Hamilton's equations with respect to intermolecular degrees of freedom are readily obtained and filled into output ydot, while the derivatives with respect to monomer's coordinates are handled by rhsMonomer function.
|
Trajectory | init_trajectory (MoleculeSystem *ms, double reltol) |
| init_trajectory initializes a Trajectory structure for propagating Hamilton's equations of motion for the provided molecule system. The trajectory will be configured with the specified with the specified relative tolerance for numerical integration. The returned Trajectory should be properly freed using free_trajectory after use to avoid memory leaks.
|
void | free_trajectory (Trajectory *traj) |
| free_trajectory
|
bool | trajectory_apply_requantization (Trajectory *traj) |
void | trajectory_reinit (Trajectory *traj) |
| free_trajectory
|
int | make_step (Trajectory *traj, double tout, double *t) |
| make_step Invokes the main function of CVode and, if enabled, applies requantization to the monomers' angular momenta. When the apply_requantization flag within the MoleculeSystem is set, * the momenta in qp are rescaled to adjust the angular momentum to the nearest half-integer or integer, according to the requantization rule which is represented within the Monomer type. Subsequently, the function synchronizes the internal trajectory phase-space vector with the MoleculeSystem's phase-space vector, and reinitializes the state of CVode to reset its state since a sudden change of phase-point has occured.
|
void | set_initial_condition (Trajectory *traj, Array qp) |
| set_initial_condition
|
N_Vector | make_vector (int size) |
| make_vector
|
void | set_tolerance (Trajectory *traj, double tolerance) |
| set_tolerance
|
void | reinit_trajectory (Trajectory *traj, double t) |
◆ free_trajectory()
◆ init_trajectory()
init_trajectory initializes a Trajectory structure for propagating Hamilton's equations of motion for the provided molecule system. The trajectory will be configured with the specified with the specified relative tolerance for numerical integration. The returned Trajectory should be properly freed using free_trajectory after use to avoid memory leaks.
◆ make_step()
int make_step |
( |
Trajectory * | traj, |
|
|
double | tout, |
|
|
double * | t ) |
make_step Invokes the main function of CVode and, if enabled, applies requantization to the monomers' angular momenta. When the apply_requantization flag within the MoleculeSystem is set, * the momenta in qp are rescaled to adjust the angular momentum to the nearest half-integer or integer, according to the requantization rule which is represented within the Monomer type. Subsequently, the function synchronizes the internal trajectory phase-space vector with the MoleculeSystem's phase-space vector, and reinitializes the state of CVode to reset its state since a sudden change of phase-point has occured.
◆ make_vector()
N_Vector make_vector |
( |
int | size | ) |
|
◆ reinit_trajectory()
void reinit_trajectory |
( |
Trajectory * | traj, |
|
|
double | t ) |
◆ rhs()
int rhs |
( |
realtype | t, |
|
|
N_Vector | y, |
|
|
N_Vector | ydot, |
|
|
void * | user_data ) |
|
extern |
rhs function is passed to CVode library to propagate the trajectory. First, the phase-point coordinates are stored into MoleculeSystem struct. A contiguous vector of coordinates is assembled via extract_q_and_write_into_ms. Next, by calling the external function dpes, the derivatives of potential energy are computed and stored into MoleculeSystem::dVdq field. The components of derivative vector are then copied into the field Monomer::dVdq of the corresponding Monomer via the call to extract_dVdq_and_write_into_monomers. The right-hand side of Hamilton's equations with respect to intermolecular degrees of freedom are readily obtained and filled into output ydot, while the derivatives with respect to monomer's coordinates are handled by rhsMonomer function.
◆ set_initial_condition()
◆ set_tolerance()
void set_tolerance |
( |
Trajectory * | traj, |
|
|
double | tolerance ) |
◆ trajectory_apply_requantization()
bool trajectory_apply_requantization |
( |
Trajectory * | traj | ) |
|
◆ trajectory_reinit()