Skip to content

Commit

Permalink
Make XRayWeights aware of phantom atoms, update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
trisyoungs committed Aug 7, 2024
1 parent 657aa21 commit 36b734a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/classes/xRayWeights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ bool XRayWeights::setUp(std::vector<std::pair<const Species *, int>> &speciesPop
void XRayWeights::addSpecies(const Species *sp, int population)
{
for (const auto &i : sp->atoms())
atomTypeMix_.add(i.atomType(), population);
if (i.isPresence(SpeciesAtom::Presence::Physical))
atomTypeMix_.add(i.atomType(), population);

valid_ = false;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/data/dissolve/input/water-with-phantom-atoms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,10 @@ Layer 'Processing'
ReferenceNormalisedTo None
ReferenceWindowFunction Lorch0
EndModule

Module XRaySQ H2Oxray
SourceSQs 'SQ01'
Normalisation AverageOfSquares
EndModule

EndLayer
5 changes: 3 additions & 2 deletions tests/modules/xRaySQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ TEST_F(XRaySQModuleTest, Water)
ASSERT_TRUE(systemTest.dissolve().iterate(1));

// Total F(Q)
EXPECT_TRUE(systemTest.checkData1D("H2Oxray//WeightedSQ//Total", {"epsr25/water1000-neutron-xray/water.EPSR.u01",
Data1DImportFileFormat::Data1DImportFormat::XY, 1, 8}));
EXPECT_TRUE(systemTest.checkData1D(
"H2Oxray//WeightedSQ//Total",
{"epsr25/water1000-neutron-xray/water.EPSR.u01", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 8}, 2.0e-4));
}

} // namespace UnitTest
5 changes: 5 additions & 0 deletions tests/workflows/phantomAtoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ TEST_F(PhantomAtomsTest, Water)
EXPECT_TRUE(systemTest.checkData1D(
"HDO//WeightedSQ//Total",
{"epsr25/water1000-neutron/water.EPSR.u01", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 6}, 2.0e-5));

// Total x-ray F(Q)
EXPECT_TRUE(systemTest.checkData1D(
"H2Oxray//WeightedSQ//Total",
{"epsr25/water1000-neutron-xray/water.EPSR.u01", Data1DImportFileFormat::Data1DImportFormat::XY, 1, 8}, 2.0e-4));
}

} // namespace UnitTest

0 comments on commit 36b734a

Please sign in to comment.