384 #ifdef MEM_OPT_VERSION 385 typename ElemTraits<T>::signature *allSigs;
387 int32 **tuplesByAtom;
391 const P *tupleValues;
394 #ifdef MEM_OPT_VERSION 395 allSigs = ElemTraits<T>::get_sig_pointer(node->
molecule);
397 T::getMoleculePointers(node->
molecule,
398 &numTuples, &tuplesByAtom, &tupleStructs);
401 T::getParameterPointers(node->
parameters, &tupleValues);
412 Real invLesFactor = lesOn ?
429 for ( ai = ai.begin(); ai != ai.end(); ai++ )
437 for (
int j=0; j < numAtoms; j++)
440 #ifdef MEM_OPT_VERSION 441 typename ElemTraits<T>::signature *thisAtomSig =
442 &allSigs[ElemTraits<T>::get_sig_id(atomExt[j])];
444 T::getTupleInfo(thisAtomSig, &numTuples, &allTuples);
445 for(
int k=0; k<numTuples; k++) {
446 T t(atomExt[j].
id, &allTuples[k], tupleValues);
449 int32 *curTuple = tuplesByAtom[atomExt[j].
id];
450 for( ; *curTuple != -1; ++curTuple) {
451 T t(&tupleStructs[*curTuple],tupleValues);
455 int homepatch = aid[0].
pid;
462 int fep_tuple_type = 0;
463 for (i=1; i < T::size; i++) {
465 samepatch = samepatch && ( homepatch == aid[i].
pid );
475 if (sdScaling && is_fep_sd) {
476 for (i=0; i < num_unpert_bonds; i++) {
478 && t.atomID[0]==unpert_bonds[i].atom1
479 && t.atomID[1]==unpert_bonds[i].atom2) is_fep_sd = 0;
481 for (i=0; i < num_unpert_angles; i++) {
483 && t.atomID[0]==unpert_angles[i].atom1
484 && t.atomID[1]==unpert_angles[i].atom2
485 && t.atomID[2]==unpert_angles[i].atom3) is_fep_sd = 0;
487 for (i=0; i < num_unpert_dihedrals; i++) {
489 && t.atomID[0]==unpert_dihedrals[i].atom1
490 && t.atomID[1]==unpert_dihedrals[i].atom2
491 && t.atomID[2]==unpert_dihedrals[i].atom3
492 && t.atomID[3]==unpert_dihedrals[i].atom4) is_fep_sd = 0;
495 if (T::size < 4 && !soluteScalingAll) has_ss =
false;
496 if ( samepatch )
continue;
497 t.scale = (!has_les && !has_ss) ? 1.0 : ( has_les ? invLesFactor : soluteScalingFactor );
498 if (is_fep_ss) t.scale = (fep_tuple_type == 4) ? OneMinusLambda : Lambda;
499 if (is_fep_sd && sdScaling) t.scale = (fep_tuple_type == 4 || fep_tuple_type == 2) ? OneMinusLambda : Lambda;
501 for (i=1; i < T::size; i++) {
506 for (i=0; i < T::size; i++) {
509 #ifdef MEM_OPT_VERSION 512 iout <<
iWARN <<
"Tuple " << *curTuple <<
" with atoms ";
515 for( erri = 0; erri < T::size; erri++ ) {
516 iout << t.atomID[erri] <<
"(" << aid[erri].
pid <<
") ";
518 iout <<
"missing patch " << aid[i].
pid <<
"\n" <<
endi;
521 t.localIndex[i] = aid[i].
index;
524 #ifdef MEM_OPT_VERSION 529 for(i=0; i<T::size; i++){
Elem * find(const Elem &elem)
int num_alch_unpert_Dihedrals
static void partition(int *order, const FullAtom *atoms, int begin, int end)
Angle * alch_unpert_angles
SimParameters * simParameters
int num_alch_unpert_Bonds
std::ostream & endi(std::ostream &s)
int downstream(int pid1, int pid2)
TuplePatchList tuplePatchList
std::ostream & iWARN(std::ostream &s)
int num_alch_unpert_Angles
unsigned char get_ss_type(int anum) const
int add(const Elem &elem)
Dihedral * alch_unpert_dihedrals
BigReal soluteScalingFactor
LocalID localID(AtomID id)
unsigned char get_fep_type(int anum) const
ResizeArray< T > tupleList