373 #ifdef MEM_OPT_VERSION
374 typename ElemTraits<T>::signature *allSigs;
376 int32 **tuplesByAtom;
380 const P *tupleValues;
383 #ifdef MEM_OPT_VERSION
384 allSigs = ElemTraits<T>::get_sig_pointer(node->
molecule);
386 T::getMoleculePointers(node->
molecule,
387 &numTuples, &tuplesByAtom, &tupleStructs);
390 T::getParameterPointers(node->
parameters, &tupleValues);
401 Real invLesFactor = lesOn ?
418 for ( ai = ai.begin(); ai != ai.end(); ai++ )
426 for (
int j=0; j < numAtoms; j++)
429 #ifdef MEM_OPT_VERSION
430 typename ElemTraits<T>::signature *thisAtomSig =
431 &allSigs[ElemTraits<T>::get_sig_id(atomExt[j])];
433 T::getTupleInfo(thisAtomSig, &numTuples, &allTuples);
434 for(
int k=0; k<numTuples; k++) {
435 T t(atomExt[j].
id, &allTuples[k], tupleValues);
438 int32 *curTuple = tuplesByAtom[atomExt[j].
id];
439 for( ; *curTuple != -1; ++curTuple) {
440 T t(&tupleStructs[*curTuple],tupleValues);
444 int homepatch = aid[0].
pid;
449 int is_fep_ss = partition[0] > 2;
451 int fep_tuple_type = 0;
452 for (i=1; i < T::size; i++) {
454 samepatch = samepatch && ( homepatch == aid[i].
pid );
459 is_fep_ss &= partition[i] > 2;
460 is_fep_sd |= (abs(partition[i] - partition[0]) == 2);
461 fep_tuple_type = partition[i];
464 if (sdScaling && is_fep_sd) {
465 for (i=0; i < num_unpert_bonds; i++) {
467 && t.atomID[0]==unpert_bonds[i].
atom1
468 && t.atomID[1]==unpert_bonds[i].
atom2) is_fep_sd = 0;
470 for (i=0; i < num_unpert_angles; i++) {
472 && t.atomID[0]==unpert_angles[i].
atom1
473 && t.atomID[1]==unpert_angles[i].
atom2
474 && t.atomID[2]==unpert_angles[i].
atom3) is_fep_sd = 0;
476 for (i=0; i < num_unpert_dihedrals; i++) {
478 && t.atomID[0]==unpert_dihedrals[i].
atom1
479 && t.atomID[1]==unpert_dihedrals[i].
atom2
480 && t.atomID[2]==unpert_dihedrals[i].
atom3
481 && t.atomID[3]==unpert_dihedrals[i].
atom4) is_fep_sd = 0;
484 if (T::size < 4 && !soluteScalingAll) has_ss =
false;
485 if ( samepatch )
continue;
486 t.scale = (!has_les && !has_ss) ? 1.0 : ( has_les ? invLesFactor : soluteScalingFactor );
487 if (is_fep_ss) t.scale = (fep_tuple_type == 4) ? OneMinusLambda : Lambda;
488 if (is_fep_sd && sdScaling) t.scale = (fep_tuple_type == 4 || fep_tuple_type == 2) ? OneMinusLambda : Lambda;
490 for (i=1; i < T::size; i++) {
495 for (i=0; i < T::size; i++) {
498 #ifdef MEM_OPT_VERSION
501 iout << iWARN <<
"Tuple " << *curTuple <<
" with atoms ";
504 for( erri = 0; erri < T::size; erri++ ) {
505 iout << t.atomID[erri] <<
"(" << aid[erri].
pid <<
") ";
507 iout <<
"missing patch " << aid[i].
pid <<
"\n" <<
endi;
510 t.localIndex[i] = aid[i].
index;
513 #ifdef MEM_OPT_VERSION
518 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
Dihedral * alch_unpert_dihedrals
BigReal soluteScalingFactor
unsigned char get_ss_type(int anum) const
LocalID localID(AtomID id)
unsigned char get_fep_type(int anum) const
ResizeArray< T > tupleList