File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -647,13 +647,19 @@ void PDFCalculator::cacheStructureData()
647647{
648648 int cntsites = this ->countSites ();
649649 // sfsite
650+ boost::unordered_map<string, double > fcache;
650651 mstructure_cache.sfsite .resize (cntsites);
651652 const ScatteringFactorTablePtr sftable = this ->getScatteringFactorTable ();
652653 for (int i = 0 ; i < cntsites; ++i)
653654 {
654655 const string& smbl = mstructure->siteAtomType (i);
655- mstructure_cache.sfsite [i] = sftable->lookup (smbl) *
656- mstructure->siteOccupancy (i);
656+ boost::unordered_map<string, double >::iterator ff = fcache.find (smbl);
657+ if (ff == fcache.end ())
658+ {
659+ const double value = sftable->lookup (smbl);
660+ ff = fcache.insert (make_pair (smbl, value)).first ;
661+ }
662+ mstructure_cache.sfsite [i] = ff->second * mstructure->siteOccupancy (i);
657663 }
658664 // sfaverage
659665 double totocc = mstructure->totalOccupancy ();
You can’t perform that action at this time.
0 commit comments