Commit 3a968808 by maarten

electron scattering support

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@230 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent eb4f2f77
...@@ -13,9 +13,10 @@ namespace libcif ...@@ -13,9 +13,10 @@ namespace libcif
class AtomShape class AtomShape
{ {
public: public:
AtomShape(const Atom& atom, float resHigh, float resLow);
AtomShape(const Atom& atom, float resHigh, float resLow, AtomShape(const Atom& atom, float resHigh, float resLow,
float bFactor); bool electronScattering);
AtomShape(const Atom& atom, float resHigh, float resLow,
bool electronScattering, float bFactor);
~AtomShape(); ~AtomShape();
......
...@@ -199,7 +199,8 @@ class AtomTypeTraits ...@@ -199,7 +199,8 @@ class AtomTypeTraits
// data type encapsulating the Waasmaier & Kirfel scattering factors // data type encapsulating the Waasmaier & Kirfel scattering factors
// in a simplified form (only a and b). // in a simplified form (only a and b).
struct WKSF // Added the electrion scattering factors as well
struct SFData
{ {
double a[6], b[6]; double a[6], b[6];
}; };
...@@ -207,7 +208,8 @@ class AtomTypeTraits ...@@ -207,7 +208,8 @@ class AtomTypeTraits
// to get the Cval and Siva values, use this constant as charge: // to get the Cval and Siva values, use this constant as charge:
enum { kWKSFVal = -99 }; enum { kWKSFVal = -99 };
const WKSF& wksf(int charge = 0) const; const SFData& wksf(int charge = 0) const;
const SFData& elsf() const;
private: private:
const struct AtomTypeInfo* mInfo; const struct AtomTypeInfo* mInfo;
......
...@@ -328,10 +328,11 @@ double DensityIntegration::integrateRadius(float perc, float occupancy, double y ...@@ -328,10 +328,11 @@ double DensityIntegration::integrateRadius(float perc, float occupancy, double y
struct AtomShapeImpl struct AtomShapeImpl
{ {
AtomShapeImpl(AtomType symbol, int charge, float uIso, float occupancy, float resHigh, float resLow) AtomShapeImpl(AtomType symbol, int charge, float uIso, float occupancy, float resHigh, float resLow, bool electronScattering)
: mSymbol(symbol), mCharge(charge), mUIso(uIso), mOccupancy(occupancy) : mSymbol(symbol), mCharge(charge), mUIso(uIso), mOccupancy(occupancy)
, mResHigh(resHigh), mResLow(resLow) , mResHigh(resHigh), mResLow(resLow)
, mIntegrator(DensityIntegration::instance(resLow, resHigh)) , mIntegrator(DensityIntegration::instance(resLow, resHigh))
, mElectronScattering(electronScattering)
{ {
auto st = mIntegrator.st(); auto st = mIntegrator.st();
auto sts = mIntegrator.sts(); auto sts = mIntegrator.sts();
...@@ -340,7 +341,8 @@ struct AtomShapeImpl ...@@ -340,7 +341,8 @@ struct AtomShapeImpl
mYi = 0; mYi = 0;
mFst = vector<double>(st.size(), 0); mFst = vector<double>(st.size(), 0);
auto& D = AtomTypeTraits(symbol).wksf(charge); auto& D =
mElectronScattering ? AtomTypeTraits(symbol).elsf() : AtomTypeTraits(symbol).wksf(charge);
auto bIso = clipper::Util::u2b(uIso); auto bIso = clipper::Util::u2b(uIso);
float as = mIntegrator.a() * mIntegrator.a(); float as = mIntegrator.a() * mIntegrator.a();
...@@ -375,6 +377,7 @@ struct AtomShapeImpl ...@@ -375,6 +377,7 @@ struct AtomShapeImpl
int mCharge; int mCharge;
float mUIso, mOccupancy; float mUIso, mOccupancy;
float mResHigh, mResLow; float mResHigh, mResLow;
bool mElectronScattering;
const DensityIntegration& mIntegrator; const DensityIntegration& mIntegrator;
double mYi; double mYi;
...@@ -400,15 +403,15 @@ struct AtomShapeImpl ...@@ -400,15 +403,15 @@ struct AtomShapeImpl
// -------------------------------------------------------------------- // --------------------------------------------------------------------
AtomShape::AtomShape(const Atom& atom, float resHigh, float resLow) AtomShape::AtomShape(const Atom& atom, float resHigh, float resLow, bool electronScattering)
: mImpl(new AtomShapeImpl(atom.type(), atom.charge(), atom.uIso(), : mImpl(new AtomShapeImpl(atom.type(), atom.charge(), atom.uIso(),
atom.occupancy(), resHigh, resLow)) atom.occupancy(), resHigh, resLow, electronScattering))
{ {
} }
AtomShape::AtomShape(const Atom& atom, float resHigh, float resLow, float bFactor) AtomShape::AtomShape(const Atom& atom, float resHigh, float resLow, bool electronScattering, float bFactor)
: mImpl(new AtomShapeImpl(atom.type(), atom.charge(), clipper::Util::b2u(bFactor), : mImpl(new AtomShapeImpl(atom.type(), atom.charge(), clipper::Util::b2u(bFactor),
1.0, resHigh, resLow)) 1.0, resHigh, resLow, electronScattering))
{ {
} }
......
...@@ -114,7 +114,8 @@ class IsomerDB ...@@ -114,7 +114,8 @@ class IsomerDB
IsomerDB::IsomerDB() IsomerDB::IsomerDB()
{ {
mrsrc::rsrc isomers("isomers.xml"); // mrsrc::rsrc isomers("isomers.xml");
mrsrc::rsrc isomers("isomers-with-sugar.xml");
if (not isomers) if (not isomers)
throw runtime_error("Missing isomers.xml resource"); throw runtime_error("Missing isomers.xml resource");
......
...@@ -195,20 +195,44 @@ void MapMaker<FTYPE>::recalculateFromMTZ(const fs::path& mtzFile, ...@@ -195,20 +195,44 @@ void MapMaker<FTYPE>::recalculateFromMTZ(const fs::path& mtzFile,
HKL_data<F_phi> fc(hklInfo, mCell); HKL_data<F_phi> fc(hklInfo, mCell);
auto& exptl = structure.getFile().data()["exptl"];
if (not exptl.empty() and exptl.front()["method"] == "ELECTRON CRYSTALLOGRAPHY")
{
if (VERBOSE)
cerr << "Using electron scattering factors" << endl;
if (noBulk) if (noBulk)
{ {
clipper::SFcalc_aniso_fft<float> sfc; clipper::SFcalc_aniso_fft<float,clipper::sftElectron> sfc;
sfc(fc, atoms); sfc(fc, atoms);
} }
else else
{ {
clipper::SFcalc_obs_bulk<float> sfcb; clipper::SFcalc_obs_bulk<float,clipper::sftElectron> sfcb;
sfcb(fc, fo, atoms); sfcb(fc, fo, atoms);
if (VERBOSE) if (VERBOSE)
cerr << "Bulk correction volume: " << sfcb.bulk_frac() << endl cerr << "Bulk correction volume: " << sfcb.bulk_frac() << endl
<< "Bulk correction factor: " << sfcb.bulk_scale() << endl; << "Bulk correction factor: " << sfcb.bulk_scale() << endl;
} }
}
else
{
if (noBulk)
{
clipper::SFcalc_aniso_fft<float,clipper::sftWaasmaierKirfel> sfc;
sfc(fc, atoms);
}
else
{
clipper::SFcalc_obs_bulk<float,clipper::sftWaasmaierKirfel> sfcb;
sfcb(fc, fo, atoms);
if (VERBOSE)
cerr << "Bulk correction volume: " << sfcb.bulk_frac() << endl
<< "Bulk correction factor: " << sfcb.bulk_scale() << endl;
}
}
if (anisoScaling != as_None) if (anisoScaling != as_None)
{ {
......
...@@ -470,7 +470,7 @@ clipper::Atom Atom::toClipper() const ...@@ -470,7 +470,7 @@ clipper::Atom Atom::toClipper() const
void Atom::calculateRadius(float resHigh, float resLow, float perc) void Atom::calculateRadius(float resHigh, float resLow, float perc)
{ {
AtomShape shape(*this, resHigh, resLow); AtomShape shape(*this, resHigh, resLow, false);
mImpl->mRadius = shape.radius(); mImpl->mRadius = shape.radius();
// verbose // verbose
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment