本文整理汇总了C++中Topology::Nonbond方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::Nonbond方法的具体用法?C++ Topology::Nonbond怎么用?C++ Topology::Nonbond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::Nonbond方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupNonbondParm
/** Set up the exclusion list based on the given mask and parm.
* \return the total number of interactions, -1 on error.
*/
int Action_Pairwise::SetupNonbondParm(AtomMask const& maskIn, Topology const& ParmIn) {
// Check if LJ parameters present - need at least 2 atoms for it to matter.
if (ParmIn.Natom() > 1 && !ParmIn.Nonbond().HasNonbond()) {
mprinterr("Error: Topology does not have LJ information.\n");
return -1;
}
// Determine the actual number of pairwise interactions that will be calcd.
// This is ((N^2 - N) / 2) - SUM[ #excluded atoms]
int N_interactions = ((maskIn.Nselected() * maskIn.Nselected()) - maskIn.Nselected()) / 2;
for (AtomMask::const_iterator at = maskIn.begin(); at != maskIn.end(); ++at)
N_interactions -= ParmIn[ *at ].Nexcluded();
// DEBUG - Print total number of interactions for this parm
mprintf("\t%i interactions for this parm.\n",N_interactions);
// DEBUG - Print exclusion list for each atom
/*for (unsigned int atom = 0; atom < exclusionList.size(); atom++) {
mprintf("\t%8u:",atom + 1);
for (std::vector<int>::iterator eat = exclusionList[atom].begin();
eat != exclusionList[atom].end();
eat++)
{
mprintf(" %i",*eat + 1);
}
mprintf("\n");
}*/
return N_interactions;
}
示例2: Setup_VDW_Correction
/** Determine VDW long range correction prefactor. */
void Ewald::Setup_VDW_Correction(Topology const& topIn, AtomMask const& maskIn) {
Vdw_Recip_term_ = 0.0;
NB_ = static_cast<NonbondParmType const*>( &(topIn.Nonbond()) );
if (!NB_->HasNonbond()) {
mprintf("Warning: '%s' has no nonbonded parameters. Cannot calculate VDW correction.\n",
topIn.c_str());
return;
}
// Count the number of each unique nonbonded type.
Iarray N_vdw_type( NB_->Ntypes(), 0 );
for (AtomMask::const_iterator atm = maskIn.begin(); atm != maskIn.end(); ++atm)
N_vdw_type[ topIn[*atm].TypeIndex() ]++;
if (debug_ > 0) {
mprintf("DEBUG: %zu VDW types.\n", N_vdw_type.size());
for (Iarray::const_iterator it = N_vdw_type.begin(); it != N_vdw_type.end(); ++it)
mprintf("\tType %li = %i\n", it-N_vdw_type.begin(), *it);
}
// Determine correction term from types and LJ B parameters
for (unsigned int itype = 0; itype != N_vdw_type.size(); itype++)
{
unsigned int offset = N_vdw_type.size() * itype;
for (unsigned int jtype = 0; jtype != N_vdw_type.size(); jtype++)
{
unsigned int idx = offset + jtype;
int nbidx = NB_->NBindex()[ idx ];
if (nbidx > -1)
Vdw_Recip_term_ += N_vdw_type[itype] * N_vdw_type[jtype] * NB_->NBarray()[ nbidx ].B();
}
}
}
示例3: SetupParms
/** Sets the temporary charge array and makes sure that we have the necessary
* parameters in our topology to calculate nonbonded energy terms
*/
int Action_LIE::SetupParms(Topology const& ParmIn) {
if (!ParmIn.Nonbond().HasNonbond()) {
mprinterr("Error: Topology does not have LJ information.\n");
return 1;
}
// Store the charges
atom_charge_.clear();
atom_charge_.reserve( ParmIn.Natom() );
for (Topology::atom_iterator atom = ParmIn.begin();
atom != ParmIn.end(); ++atom)
atom_charge_.push_back( atom->Charge() * Constants::ELECTOAMBER / sqrt(dielc_) );
return 0;
}