Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
953879d
DRR - Cpptraj: Add code for calc C6 params for the LJ pme
Feb 7, 2019
6dd4d61
DRR - Cpptraj: Add test LJ pme calc.
Feb 7, 2019
4f4796f
DRR - Cpptraj: Start LJ PME test.
Feb 7, 2019
e97ef10
DRR - Cpptraj: add lj pme self correction
Feb 7, 2019
93bf88e
DRR - Cpptraj: Attempt correction. Not there yet.
Feb 7, 2019
622203d
Merge branch 'master' into lj_pme
Feb 8, 2019
da7a421
DRR - Cpptraj: Split up LJ pme correction into excluded and non-exclu…
Feb 14, 2019
3b2458f
DRR - Cpptraj: Add code for switch function, not yet enabled.
Feb 14, 2019
dd4f0fd
DRR - Cpptraj: Add separate terms for LJ PME. Ensure LJ pme is off wh…
Feb 14, 2019
cafd687
DRR - Cpptraj: Add function for calculating sigma
Feb 14, 2019
0d9d8cf
DRR - Cpptraj: Add keywords for lennard jones pme
Feb 14, 2019
c40fd0d
DRR - Cpptraj: Code doc
Feb 14, 2019
f611ee8
DRR - Cpptraj: Simple LJ pme test
Feb 14, 2019
68487d0
DRR - Cpptraj: Make sure the correct Ewald param passed in for LJ
Feb 14, 2019
7ea3c70
DRR - Cpptraj: Fix regular Ewald by allocating C6 arrays even though …
Feb 14, 2019
fa46d6c
DRR - Cpptraj: Add lj PME kappa sweep test.
Feb 14, 2019
92f2aed
DRR - Cpptraj: Hide debug info. If LJ pme will not be active set C6 p…
Feb 14, 2019
4f5c761
DRR - Cpptraj: Hide some debug info
Feb 14, 2019
e7e74fd
DRR - Cpptraj: Enable lj pme test
Feb 14, 2019
31c0df3
DRR - Cpptraj: Box action modifies topology, return value to indicate…
Feb 14, 2019
55d1ccf
DRR - Cpptraj: Add switch to inside the direct space calc
Feb 14, 2019
e387fd5
DRR - Cpptraj: Add LJ switching argument
Feb 14, 2019
e8741d4
DRR - Cpptraj: First incarnation of the catcrd command
Feb 14, 2019
85c2ff1
DRR - Cpptraj: Output switch width when active
Feb 14, 2019
82cb87e
DRR - Cpptraj: Enable catcrd
Feb 14, 2019
02217e0
DRR - Cpptraj: Add test for catcrd command.
Feb 14, 2019
ba49f4c
DRR - Cpptraj: Enable catcrd test
Feb 14, 2019
e7445dc
DRR - Cpptraj: Revision bump; LJ PME support and catcrd command.
Feb 14, 2019
0dafd9d
DRR - Cpptraj: Add LJ with switch test
Feb 14, 2019
43bb992
DRR - Cpptraj: Attempt to simplify code maintenance while maintaining…
Feb 15, 2019
fd52ce4
DRR - Cpptraj: Put pair list loop as an include file; this somewhat i…
Feb 15, 2019
421cf00
DRR - Cpptraj: Caculate some common prefactors.
Feb 15, 2019
51a151e
DRR - Cpptraj: Remove old code.
Feb 15, 2019
8536e76
DRR - Cpptraj: Avoid allocating PME instance every call
Feb 15, 2019
fb5f1e7
DRR - Cpptraj: Protect openmp pragmas
Feb 15, 2019
b3c1dc4
DRR - Cpptraj: Squash a bunch of compiler warnings.
Feb 15, 2019
cf7896b
DRR - Cpptraj: No need to pass the adjustment energy out - just repor…
Feb 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Action_Box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Action::RetType Action_Box::Setup(ActionSetup& setup) {
cInfo_.SetBox( pbox );
}
setup.SetCoordInfo( &cInfo_ );
return Action::OK;
return Action::MODIFY_TOPOLOGY;
}

Action::RetType Action_Box::DoAction(int frameNum, ActionFrame& frm) {
Expand Down
29 changes: 24 additions & 5 deletions src/Action_Energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void Action_Energy::Help() const {
"\t ewald [cut <cutoff>] [dsumtol <dtol>] [rsumtol <rtol>]\n"
"\t [ewcoeff <coeff>] [maxexp <max>] [skinnb <skinnb>]\n"
"\t [mlimits <X>,<Y>,<Z>] [erfcdx <dx>]\n"
"\t pme [cut <cutoff>] [dsumtol <dtol>] [order <order>]\n"
"\t [ewcoeff <coeff>] [skinnb <skinnb>]\n"
"\t pme [cut <cutoff>] [dsumtol <dtol>] [order <order>] [ljswidth <width>]\n"
"\t [ewcoeff <coeff>] [ljpme] [ewcoefflj] [skinnb <skinnb>]\n"
"\t [nfft <nfft1>,<nfft2>,<nfft3>] [erfcdx <dx>]\n"
"\t } ]\n"
" Calculate energy for atoms in mask.\n");
Expand Down Expand Up @@ -140,6 +140,11 @@ Action::RetType Action_Energy::Init(ArgList& actionArgs, ActionInit& init, int d
cutoff_ = actionArgs.getKeyDouble("cut", 8.0);
dsumtol_ = actionArgs.getKeyDouble("dsumtol", 1E-5);
ewcoeff_ = actionArgs.getKeyDouble("ewcoeff", 0.0);
lwcoeff_ = -1.0;
if (actionArgs.hasKey("ljpme"))
lwcoeff_ = 0.4;
lwcoeff_ = actionArgs.getKeyDouble("ewcoefflj", lwcoeff_);
ljswidth_ = actionArgs.getKeyDouble("ljswidth", 0.0);
skinnb_ = actionArgs.getKeyDouble("skinnb", 2.0);
erfcDx_ = actionArgs.getKeyDouble("erfcdx", 0.0);
npoints_ = actionArgs.getKeyInt("order", 6);
Expand Down Expand Up @@ -221,6 +226,8 @@ Action::RetType Action_Energy::Init(ArgList& actionArgs, ActionInit& init, int d
need_lj_params_ = true;
}
}
if (lj_longrange_correction && lwcoeff_ >= 0.0)
lj_longrange_correction = false;

// Get Masks
Mask1_.SetMaskString( actionArgs.GetMaskNext() );
Expand Down Expand Up @@ -290,8 +297,18 @@ Action::RetType Action_Energy::Init(ArgList& actionArgs, ActionInit& init, int d
if (erfcDx_ > 0.0)
mprintf("\tERFC table dx= %g\n", erfcDx_);
}
if (termEnabled[VDW] && lj_longrange_correction)
mprintf("\tUsing long range correction for nonbond VDW calc.\n");
if (termEnabled[VDW]) {
if (lj_longrange_correction)
mprintf("\tUsing long range correction for nonbond VDW calc.\n");
else if (lwcoeff_ >= 0.0) {
if (lwcoeff_ > 0.0)
mprintf("\tUsing Lennard-Jones PME with Ewald coefficient %.4f\n", lwcoeff_);
else
mprintf("\tLennard-Jones PME Ewald coefficient will be set to elec. Ewald coefficient.\n");
}
if (ljswidth_ > 0.0)
mprintf("\tWidth of LJ switch region: %.4f Ang.\n", ljswidth_);
}
if (KEtype_ != KE_NONE) {
if (KEtype_ == KE_AUTO)
mprintf("\tIf forces and velocities present KE will be calculated assuming\n"
Expand Down Expand Up @@ -335,7 +352,8 @@ Action::RetType Action_Energy::Setup(ActionSetup& setup) {
# ifdef LIBPME
else if (elecType_ == PME) {
if (((Ewald_ParticleMesh*)EW_)->Init(setup.CoordInfo().TrajBox(), cutoff_, dsumtol_,
ewcoeff_, skinnb_, erfcDx_, npoints_, debug_, mlimits_))
ewcoeff_, lwcoeff_, ljswidth_, skinnb_, erfcDx_, npoints_,
debug_, mlimits_))
return Action::ERR;
EW_->Setup( setup.Top(), Imask_ );
}
Expand All @@ -356,6 +374,7 @@ Action::RetType Action_Energy::Setup(ActionSetup& setup) {
"Warning: 'ketype vv' to estimate kinetic energy.\n");
}
}

currentParm_ = setup.TopAddress();
return Action::OK;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Action_Energy.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Action_Energy: public Action {
double dsumtol_; ///< Ewald direct sum tolerance.
double rsumtol_; ///< Regular Ewald reciprocal sum tolerance.
double ewcoeff_; ///< Ewald coefficient.
double lwcoeff_; ///< LJ Ewald coefficient.
double ljswidth_; ///< Size of LJ switch region
double maxexp_;
double skinnb_; ///< Size of non-bonded "skin"
double erfcDx_; ///< Spacing for ERFC table (default 1/5000)
Expand Down
2 changes: 2 additions & 0 deletions src/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Exec_PermuteDihedrals.h"
#include "Exec_RotateDihedral.h"
#include "Exec_SplitCoords.h"
#include "Exec_CatCrd.h"
// ----- TRAJECTORY ------------------------------------------------------------
#include "Exec_Traj.h"
// ----- TOPOLOGY --------------------------------------------------------------
Expand Down Expand Up @@ -233,6 +234,7 @@ void Command::Init() {
// SYSTEM
Command::AddCmd( new Exec_System(), Cmd::EXE, 6, "gnuplot", "head", "less", "ls", "pwd", "xmgrace" );
// COORDS
Command::AddCmd( new Exec_CatCrd(), Cmd::EXE, 1, "catcrd" );
Command::AddCmd( new Exec_CombineCoords(), Cmd::EXE, 1, "combinecrd" );
Command::AddCmd( new Exec_CrdAction(), Cmd::EXE, 1, "crdaction" );
Command::AddCmd( new Exec_CrdOut(), Cmd::EXE, 1, "crdout" );
Expand Down
13 changes: 13 additions & 0 deletions src/EnergyKernel_Adjust.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
e_adjust += Adjust(q0, q1, sqrt(rij2));
# ifdef CPPTRAJ_EKERNEL_LJPME
// LJ PME direct space correction
// NOTE: Assuming excluded pair is within cutoff
double kr2 = lw_coeff_ * lw_coeff_ * rij2;
double kr4 = kr2 * kr2;
//double kr6 = kr2 * kr4;
double expterm = exp(-kr2);
double r4 = rij2 * rij2;
double r6 = rij2 * r4;
double Cij = Cparam_[it0->Idx()] * Cparam_[it1->Idx()];
Eljpme_correction_excl += (1.0 - (1.0 + kr2 + kr4/2.0)*expterm) / r6 * Cij;
# endif
43 changes: 43 additions & 0 deletions src/EnergyKernel_Nonbond.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
double rij = sqrt( rij2 );
double qiqj = q0 * q1;
# ifndef _OPENMP
t_erfc_.Start();
# endif
//double erfc = erfc_func(ew_coeff_ * rij);
double erfc = ERFC(ew_coeff_ * rij);
# ifndef _OPENMP
t_erfc_.Stop();
# endif
double e_elec = qiqj * erfc / rij;
Eelec += e_elec;
//mprintf("EELEC %4i%4i%12.5f%12.5f%12.5f%3.0f%3.0f%3.0f\n",
//int ta0, ta1;
//if (it0->Idx() < it1->Idx()) {
// ta0=it0->Idx(); ta1=it1->Idx();
//} else {
// ta1=it0->Idx(); ta0=it1->Idx();
//}
//mprintf("PELEC %6i%6i%12.5f%12.5f%12.5f\n", ta0, ta1, rij, erfc, e_elec);
int nbindex = NB_->GetLJindex(TypeIndices_[it0->Idx()],
TypeIndices_[it1->Idx()]);
if (nbindex > -1) {
double vswitch = switch_fn(rij2, cut2_0_, cut2_);
NonbondType const& LJ = NB_->NBarray()[ nbindex ];
double r2 = 1.0 / rij2;
double r6 = r2 * r2 * r2;
double r12 = r6 * r6;
double f12 = LJ.A() * r12; // A/r^12
double f6 = LJ.B() * r6; // B/r^6
double e_vdw = f12 - f6; // (A/r^12)-(B/r^6)
Evdw += (e_vdw * vswitch);
//mprintf("PVDW %8i%8i%20.6f%20.6f\n", ta0+1, ta1+1, e_vdw, r2);
# ifdef CPPTRAJ_EKERNEL_LJPME
// LJ PME direct space correction
double kr2 = lw_coeff_ * lw_coeff_ * rij2;
double kr4 = kr2 * kr2;
//double kr6 = kr2 * kr4;
double expterm = exp(-kr2);
double Cij = Cparam_[it0->Idx()] * Cparam_[it1->Idx()];
Eljpme_correction += (1.0 - (1.0 + kr2 + kr4/2.0)*expterm) * r6 * vswitch * Cij;
# endif
}
Loading