Skip to content

Commit e8598ee

Browse files
author
Daniel R. Roe
committed
1 parent 16440c0 commit e8598ee

1 file changed

Lines changed: 13 additions & 21 deletions

File tree

src/ParameterTypes.h

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,12 @@ class NonbondType {
279279
# define tol_ 0.00000001
280280
//static const double tol_ = 0.00000001;
281281
public:
282-
NonbondType() : A_(0), B_(0), C_(0) {}
283-
NonbondType(double a, double b, double c=0.0) : A_(a), B_(b), C_(c) {}
282+
NonbondType() : A_(0), B_(0) {}
283+
NonbondType(double a, double b) : A_(a), B_(b) {}
284284
inline double A() const { return A_; }
285285
inline double B() const { return B_; }
286-
inline double C() const { return C_; }
287286
void SetA(double a) { A_ = a; }
288287
void SetB(double b) { B_ = b; }
289-
void SetC(double c) { C_ = c; }
290-
291288
double Radius() const {
292289
if (B_ > 0.0)
293290
return (0.5 * pow(2.0 * A_ / B_, (1.0/6.0)));
@@ -303,31 +300,26 @@ class NonbondType {
303300
/// \return True if A and B match
304301
bool operator==(NonbondType const& rhs) const {
305302
return ( (fabs(A_ - rhs.A_) < tol_) &&
306-
(fabs(B_ - rhs.B_) < tol_) &&
307-
(fabs(C_ - rhs.C_) < tol_) );
303+
(fabs(B_ - rhs.B_) < tol_) );
308304
}
309305
/// \return True if A and B do not match
310306
bool operator!=(NonbondType const& rhs) const {
311307
return ( (fabs(A_ - rhs.A_) > tol_) ||
312-
(fabs(B_ - rhs.B_) > tol_) ||
313-
(fabs(C_ - rhs.C_) > tol_) );
308+
(fabs(B_ - rhs.B_) > tol_) );
314309
}
315310
/// \return True if A less than zero, or B if A is equal.
316311
bool operator<(NonbondType const& rhs) const {
317312
if (*this != rhs) {
318-
if ( (fabs(A_ - rhs.A_) < tol_) ) {
319-
if (fabs(B_ - rhs.B_) < tol_)
320-
return (C_ < rhs.C_);
313+
if ( (fabs(A_ - rhs.A_) < tol_) )
321314
return (B_ < rhs.B_);
322-
} else
315+
else
323316
return (A_ < rhs.A_);
324317
} else
325318
return false;
326319
}
327320
private:
328321
double A_;
329322
double B_;
330-
double C_;
331323
# undef tol_
332324
};
333325
typedef std::vector<NonbondType> NonbondArray;
@@ -379,20 +371,20 @@ typedef std::vector<LJparmType> LJparmArray;
379371
*/
380372
class NonbondParmType {
381373
public:
382-
NonbondParmType() : ntypes_(0), has_c_param_(false) {}
374+
NonbondParmType() : ntypes_(0) {}
383375
// NonbondParmType(int n, std::vector<int> const& nbi, NonbondArray const& nba,
384376
// HB_ParmArray const& hba) :
385377
// ntypes_(n), nbindex_(nbi), nbarray_(nba), hbarray_(hba) {}
386378
inline bool HasNonbond() const { return ntypes_ > 0; }
387379
inline int Ntypes() const { return ntypes_; }
388-
bool Has_C_Coeff() const { return has_c_param_; }
380+
bool Has_C_Coeff() const { return !ccoef_.empty(); }
389381
std::vector<int> const& NBindex() const { return nbindex_; }
390382
/// \return Array of LJ 12-6 A and B parameters
391383
NonbondArray const& NBarray() const { return nbarray_; }
392384
/// \return Array of LJ 10-12 (hbond) parameters
393385
HB_ParmArray const& HBarray() const { return hbarray_; }
394386
/// \return Array of LJ 12-6-4 C parameters
395-
//std::vector<double> const& LJC_Array() const { return ccoef_; }
387+
std::vector<double> const& LJC_Array() const { return ccoef_; }
396388
/// \return LJ 6-12 A and B parameter at specified index
397389
NonbondType const& NBarray(int i) const { return nbarray_[i]; }
398390
/// \return LJ 10-12 (hbond) parameter at specified index
@@ -414,8 +406,8 @@ class NonbondParmType {
414406
void SetNHBterms(int n) { hbarray_.assign( n, HB_ParmType() ); }
415407
/// Set specified HB term
416408
HB_ParmType& SetHB(int i) { return hbarray_[i]; }
417-
/// Set a LJ C parameter
418-
void SetLJC(int i, double c) { nbarray_[i].SetC(c); has_c_param_ = true; }
409+
/// Add a LJ C parameter
410+
void AddLJC(double c) { ccoef_.push_back( c ); }
419411
/// Set specified nbindex location to given value.
420412
void SetNbIdx(int idx, int nbidx) { nbindex_[idx] = nbidx; }
421413
/// Add given LJ term to nonbond array and update nonbond index array.
@@ -447,13 +439,13 @@ class NonbondParmType {
447439
nbindex_[ntypes_ * type2 + type1] = ndx;
448440
hbarray_.push_back( HB );
449441
}
450-
void Clear() { ntypes_ = 0; nbindex_.clear(); nbarray_.clear(); hbarray_.clear(); has_c_param_ = false; }
442+
void Clear() { ntypes_ = 0; nbindex_.clear(); nbarray_.clear(); hbarray_.clear(); }
451443
private:
452444
int ntypes_; ///< Number of unique atom types
453445
std::vector<int> nbindex_; ///< Hold indices into arrays nbarray/hbarray for atom type pairs
454446
NonbondArray nbarray_; ///< Hold Lennard-Jones 6-12 A and B parameters for all pairs.
455447
HB_ParmArray hbarray_; ///< Hold 10-12 Amber HBond params for all pairs.
456-
bool has_c_param_; ///< True if Lennard-Jones C parameters for 12-6-4 LJ potential present.
448+
std::vector<double> ccoef_; ///< Hold Lennard-Jones C parameters for 12-6-4 LJ potential.
457449
};
458450
// ----- LES PARAMETERS --------------------------------------------------------
459451
/// Hold LES atom parameters

0 commit comments

Comments
 (0)