USER-BOCS and other compute pressures
This commit is contained in:
@ -158,9 +158,12 @@ void ComputePressureBocs::init()
|
|||||||
if (dihedralflag && force->dihedral) nvirial++;
|
if (dihedralflag && force->dihedral) nvirial++;
|
||||||
if (improperflag && force->improper) nvirial++;
|
if (improperflag && force->improper) nvirial++;
|
||||||
}
|
}
|
||||||
if (fixflag)
|
if (fixflag) {
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
Fix **fix = modify->fix;
|
||||||
if (modify->fix[i]->virial_flag) nvirial++;
|
int nfix = modify->nfix;
|
||||||
|
for (int i = 0; i < nfix; i++)
|
||||||
|
if (fix[i]->thermo_virial) nvirial++;
|
||||||
|
}
|
||||||
|
|
||||||
if (nvirial) {
|
if (nvirial) {
|
||||||
vptr = new double*[nvirial];
|
vptr = new double*[nvirial];
|
||||||
@ -174,7 +177,7 @@ void ComputePressureBocs::init()
|
|||||||
vptr[nvirial++] = force->improper->virial;
|
vptr[nvirial++] = force->improper->virial;
|
||||||
if (fixflag)
|
if (fixflag)
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (int i = 0; i < modify->nfix; i++)
|
||||||
if (modify->fix[i]->virial_flag)
|
if (modify->fix[i]->virial_global_flag && modify->fix[i]->thermo_virial)
|
||||||
vptr[nvirial++] = modify->fix[i]->virial;
|
vptr[nvirial++] = modify->fix[i]->virial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,26 +187,24 @@ void ComputePressureBocs::init()
|
|||||||
else kspace_virial = nullptr;
|
else kspace_virial = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra functions added for BOCS */
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Compute the pressure correction for the analytical basis set
|
Compute the pressure correction for the analytical basis set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double ComputePressureBocs::get_cg_p_corr(int N_basis, double *phi_coeff,
|
double ComputePressureBocs::get_cg_p_corr(int N_basis, double *phi_coeff,
|
||||||
int N_mol, double vavg, double vCG)
|
int N_mol, double vavg, double vCG)
|
||||||
{
|
{
|
||||||
double correction = 0.0;
|
double correction = 0.0;
|
||||||
for (int i = 1; i <= N_basis; ++i)
|
for (int i = 1; i <= N_basis; ++i)
|
||||||
{
|
|
||||||
correction -= phi_coeff[i-1] * ( N_mol * i / vavg ) *
|
correction -= phi_coeff[i-1] * ( N_mol * i / vavg ) *
|
||||||
pow( ( 1 / vavg ) * ( vCG - vavg ),i-1);
|
pow( ( 1 / vavg ) * ( vCG - vavg ),i-1);
|
||||||
}
|
|
||||||
return correction;
|
return correction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Find the relevant index position if using a spline basis set
|
Find the relevant index position if using a spline basis set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double ComputePressureBocs::find_index(double * grid, double value)
|
double ComputePressureBocs::find_index(double * grid, double value)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -230,7 +231,7 @@ double ComputePressureBocs::find_index(double * grid, double value)
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type,
|
double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type,
|
||||||
double vCG)
|
double vCG)
|
||||||
{
|
{
|
||||||
int i = find_index(grid[0],vCG);
|
int i = find_index(grid[0],vCG);
|
||||||
double correction, deltax = vCG - grid[0][i];
|
double correction, deltax = vCG - grid[0][i];
|
||||||
@ -256,8 +257,10 @@ double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type,
|
|||||||
send cg info from fix_bocs to compute_pressure_bocs for the analytical
|
send cg info from fix_bocs to compute_pressure_bocs for the analytical
|
||||||
basis set
|
basis set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis,
|
void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis,
|
||||||
double *sent_phi_coeff, int sent_N_mol, double sent_vavg)
|
double *sent_phi_coeff, int sent_N_mol,
|
||||||
|
double sent_vavg)
|
||||||
{
|
{
|
||||||
if (basis_type == BASIS_ANALYTIC) { p_basis_type = BASIS_ANALYTIC; }
|
if (basis_type == BASIS_ANALYTIC) { p_basis_type = BASIS_ANALYTIC; }
|
||||||
else
|
else
|
||||||
@ -280,8 +283,9 @@ void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis,
|
|||||||
send cg info from fix_bocs to compute_pressure_bocs for a spline basis
|
send cg info from fix_bocs to compute_pressure_bocs for a spline basis
|
||||||
set
|
set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void ComputePressureBocs::send_cg_info(int basis_type,
|
void ComputePressureBocs::send_cg_info(int basis_type,
|
||||||
double ** in_splines, int gridsize)
|
double ** in_splines, int gridsize)
|
||||||
{
|
{
|
||||||
if (basis_type == BASIS_LINEAR_SPLINE) { p_basis_type = BASIS_LINEAR_SPLINE; }
|
if (basis_type == BASIS_LINEAR_SPLINE) { p_basis_type = BASIS_LINEAR_SPLINE; }
|
||||||
else if (basis_type == BASIS_CUBIC_SPLINE) { p_basis_type = BASIS_CUBIC_SPLINE; }
|
else if (basis_type == BASIS_CUBIC_SPLINE) { p_basis_type = BASIS_CUBIC_SPLINE; }
|
||||||
@ -299,6 +303,7 @@ void ComputePressureBocs::send_cg_info(int basis_type,
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
compute total pressure, averaged over Pxx, Pyy, Pzz
|
compute total pressure, averaged over Pxx, Pyy, Pzz
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double ComputePressureBocs::compute_scalar()
|
double ComputePressureBocs::compute_scalar()
|
||||||
{
|
{
|
||||||
invoked_scalar = update->ntimestep;
|
invoked_scalar = update->ntimestep;
|
||||||
|
|||||||
@ -215,13 +215,10 @@ void ComputePressure::init()
|
|||||||
vptr[nvirial++] = force->dihedral->virial;
|
vptr[nvirial++] = force->dihedral->virial;
|
||||||
if (improperflag && force->improper)
|
if (improperflag && force->improper)
|
||||||
vptr[nvirial++] = force->improper->virial;
|
vptr[nvirial++] = force->improper->virial;
|
||||||
if (fixflag) {
|
if (fixflag)
|
||||||
Fix **fix = modify->fix;
|
for (int i = 0; i < modify->nfix; i++)
|
||||||
int nfix = modify->nfix;
|
if (modify->fix[i]->virial_global_flag && modify->fix[i]->thermo_virial)
|
||||||
for (int i = 0; i < nfix; i++)
|
|
||||||
if (fix[i]->virial_global_flag && fix[i]->thermo_virial)
|
|
||||||
vptr[nvirial++] = modify->fix[i]->virial;
|
vptr[nvirial++] = modify->fix[i]->virial;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag Kspace contribution separately, since not summed across procs
|
// flag Kspace contribution separately, since not summed across procs
|
||||||
|
|||||||
@ -223,7 +223,7 @@ void ComputeStressAtom::compute_peratom()
|
|||||||
int nfix = modify->nfix;
|
int nfix = modify->nfix;
|
||||||
for (int ifix = 0; ifix < nfix; ifix++)
|
for (int ifix = 0; ifix < nfix; ifix++)
|
||||||
if (fix[i]->virial_peratom_flag && fix[ifix]->thermo_virial) {
|
if (fix[i]->virial_peratom_flag && fix[ifix]->thermo_virial) {
|
||||||
double **vatom = modify->fix[ifix]->vatom;
|
double **vatom = fix[ifix]->vatom;
|
||||||
if (vatom)
|
if (vatom)
|
||||||
for (i = 0; i < nlocal; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
for (j = 0; j < 6; j++)
|
for (j = 0; j < 6; j++)
|
||||||
|
|||||||
Reference in New Issue
Block a user