use of ffx.xray.DiffractionRefinementData in project ffx by mjschnie.
the class MTZFilter method averageFcs.
/**
* Average the computed structure factors for two systems.
*
* @param mtzFile1 This file will be overwritten and become the new average.
* @param mtzFile2 Second MTZ file.
* @param reflectionlist List of HKLs.
* @param iter The iteration in the running average.
* @param properties The CompositeConfiguration defines the properties of
* each system.
*/
public void averageFcs(File mtzFile1, File mtzFile2, ReflectionList reflectionlist, int iter, CompositeConfiguration properties) {
DiffractionRefinementData fcdata1 = new DiffractionRefinementData(properties, reflectionlist);
DiffractionRefinementData fcdata2 = new DiffractionRefinementData(properties, reflectionlist);
readFcs(mtzFile1, reflectionlist, fcdata1, properties);
readFcs(mtzFile2, reflectionlist, fcdata2, properties);
// compute running average using mtzFile1 as current average
System.out.println("iteration for averaging: " + iter);
for (int i = 0; i < reflectionlist.hkllist.size(); i++) {
fcdata1.fc[i][0] += (fcdata2.fc[i][0] - fcdata1.fc[i][0]) / iter;
fcdata1.fc[i][1] += (fcdata2.fc[i][1] - fcdata1.fc[i][1]) / iter;
fcdata1.fs[i][0] += (fcdata2.fs[i][0] - fcdata1.fs[i][0]) / iter;
fcdata1.fs[i][1] += (fcdata2.fs[i][1] - fcdata1.fs[i][1]) / iter;
}
// overwrite original MTZ
MTZWriter mtzOut = new MTZWriter(reflectionlist, fcdata1, mtzFile1.getName(), MTZType.FCONLY);
mtzOut.write();
}
use of ffx.xray.DiffractionRefinementData in project ffx by mjschnie.
the class CIFFilterTest method testCIFFilter3DYC.
@Test
public void testCIFFilter3DYC() {
String filename = "ffx/xray/structures/3DYC.ent";
ClassLoader cl = this.getClass().getClassLoader();
File cifFile = new File(cl.getResource(filename).getPath());
// load any properties associated with it
CompositeConfiguration properties = Keyword.loadProperties(cifFile);
CIFFilter cifFilter = new CIFFilter();
ReflectionList reflectionList = cifFilter.getReflectionList(cifFile);
assertNotNull(" Reflection list should not be null", reflectionList);
DiffractionRefinementData refinementData = new DiffractionRefinementData(properties, reflectionList);
assertTrue(" CIF data not read in correctly", cifFilter.readFile(cifFile, reflectionList, refinementData, properties));
HKL hkl = reflectionList.getHKL(58, 0, 13);
assertEquals("58 0 13 F", 99.7, refinementData.getF(hkl.index()), 0.01);
assertEquals("58 0 13 sigF", 69.7, refinementData.getSigF(hkl.index()), 0.01);
assertEquals("58 0 13 freeR value", 1, refinementData.freer[hkl.index()]);
hkl = reflectionList.getHKL(28, 20, 5);
assertEquals("28 20 5 F", 428.1, refinementData.getF(hkl.index()), 0.01);
assertEquals("28 20 5 sigF", 10.1, refinementData.getSigF(hkl.index()), 0.01);
assertEquals("28 20 5 freeR value", 0, refinementData.freer[hkl.index()]);
}
use of ffx.xray.DiffractionRefinementData in project ffx by mjschnie.
the class CIFFilterTest method testCIFFilter2DRM.
@Test
public void testCIFFilter2DRM() {
String filename = "ffx/xray/structures/2DRM.cif";
ClassLoader cl = this.getClass().getClassLoader();
File cifFile = new File(cl.getResource(filename).getPath());
// load any properties associated with it
CompositeConfiguration properties = Keyword.loadProperties(cifFile);
CIFFilter cifFilter = new CIFFilter();
ReflectionList reflectionList = cifFilter.getReflectionList(cifFile);
assertNull(" Reflection list should be null", reflectionList);
Crystal crystal = new Crystal(29.969, 37.861, 44.506, 90.28, 90.11, 90.64, "P1");
Resolution resolution = new Resolution(1.30);
reflectionList = new ReflectionList(crystal, resolution);
DiffractionRefinementData refinementData = new DiffractionRefinementData(properties, reflectionList);
assertTrue(" CIF data not read correctly", cifFilter.readFile(cifFile, reflectionList, refinementData, properties));
HKL hkl = reflectionList.getHKL(-21, -6, 7);
assertEquals("-21 -6 7 F", 18.6, refinementData.getF(hkl.index()), 0.01);
assertEquals("-21 -6 7 sigF", 3.6, refinementData.getSigF(hkl.index()), 0.01);
assertEquals("-21 -6 7 freeR value", 0, refinementData.freer[hkl.index()]);
hkl = reflectionList.getHKL(-21, -6, 8);
assertEquals("-21 -6 7 F", 20.2, refinementData.getF(hkl.index()), 0.01);
assertEquals("-21 -6 7 sigF", 5.0, refinementData.getSigF(hkl.index()), 0.01);
assertEquals("-21 -6 7 freeR value", 1, refinementData.freer[hkl.index()]);
}
Aggregations