Skip to content

Powder pattern calculation is not updated when the spacegroup is changed #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
vincefn opened this issue Aug 27, 2022 · 1 comment
Closed
5 tasks done
Assignees

Comments

@vincefn
Copy link
Collaborator

vincefn commented Aug 27, 2022

Whenever atoms are moved in a crystal, the associated calculated powder is updated, but not when the spacegroup is changed. This requires calling Prepare() manually, which is inconvenient.

There are two parts required for the change:

  • detect the change of spacegroup by adding the spacegroup's clock to the child of the scatteringdata master clock in ScatteringData::SetCrystal, and also compare it to mClockGeomStructFact in ScatteringData::CalcGeomStructFactor to make sure te structure factors are recomputed
  • re-generate the list of HKL whenever the spacegroup has changed, or when the lattice parameters have been modified enough to require new reflections

The first is easy enough, but the second part is complicated because doing this automatically means calling GenHKLFullSpace (a non-const method) during CalcPowderPattern (which is const). So the only way to achieve this transparently will be to:

  • make all the mH, mK etc.. mutable
  • create separate and protectedGenHKLFullSpace, SetHKL... functions which are const and can be used when auto-generating reflections for a powder pattern
  • find a way to avoid re-generating HKL too often, never during optimisations (easy), and only if new reflections are actually required (hard)
@vincefn vincefn added the bug label Aug 27, 2022
@vincefn vincefn self-assigned this Aug 27, 2022
@vincefn vincefn changed the title Powder pattern calculation is not updated when the specegroup is changed Powder pattern calculation is not updated when the spacegroup is changed Nov 1, 2022
vincefn added a commit to vincefn/objcryst that referenced this issue Nov 1, 2022
…n when the spacegroup is changed, or when the lattice parameters change (the latter only outside of an optimisation). This is done by making all the HKL attributes mutable, and overloading the SetHKL and GenHKLFullSpace, GenHKLFullSpace2 with a protected const version, which should only be used for powder diffraction (and not single crystal data).

This should address diffpy/pyobjcryst#32

Removed mCorrTextureEllipsoid.InitRefParList() from PowderPatternDiffraction::GenHKLFullSpace since the parameter initialisation is already done in the TextureEllipsoid constructor.
@vincefn vincefn added enhancement and removed bug labels Nov 2, 2022
vincefn added a commit to diffpy/libobjcryst that referenced this issue Nov 2, 2022
…jcryst

* 'master' of github.com:vincefn/objcryst:
  Enable automatic re-generation of HKL's for a PowderPatternDiffraction when the spacegroup is changed, or when the lattice parameters change (the latter only outside of an optimisation). This is done by making all the HKL attributes mutable, and overloading the SetHKL and GenHKLFullSpace, GenHKLFullSpace2 with a protected const version, which should only be used for powder diffraction (and not single crystal data). This should address diffpy/pyobjcryst#32
  Update makefile to wxwidgets 3.2 and fftw to 3.3.10 ; update macOS Xcode project to make a universal binary with X86_64 and ARM64 architectures
  RefinableObj: change list<> to std::list<> to avoid compiler ambiguity with boost list.
  PowderPatternDiffraction: add GetFhklObsSq() and HasFhklObsSq()
  Correct update check code for YYYYNNN format.
  disable glcanvasegl for wxWindgets compilation under linux to avoid linking errors (?)
  Update wiki2pdf.py for python 3
  Update Fox version. Add fenske-hall z-matrix with hydrogens to cimetidine tutorial. Update macOS build config and makefile with wxwidgets 3.1.6. Remove obsolete makefiles.
  Update changelog and windows project files
  Use a valid XML output for a Molecule RigidGroup, writing atoms as Atom1, Atom2 etc... instead of repeating the Atom attribute. Fixes vincefn/objcryst#52. The saved files will not be backwards-compatible (readable but the list of atoms in the rigid group will not be read)
  Fix double loop in PowderPattern::PrepareIntegratedRfactor.
  Better GetFormula for Crystal and Molecule
  Crystal::XMLInput(): add a hook to re-use atomic scattering power when mDeleteSubObjInDestructor is False. This is useful when re-loading Crystal configurations using their xml descriptions repeatedly, notably in python.
  Add relative_length_tolerance and absolute_angle_tolerance_degree to SpaceGroupExplorer::Run() and RunAll()
  Correct precision for Crystal::GetFormula()
  Add access to the weight (g/mol) for ScatteringPowerAtom and Crystal
  Add access to the weight (g/mol) for ScatteringPowerAtom and Crystal
  CreateCrystalFromCIF: throw exception if no crystal structure is found
  Add int_ptr() function to enable unique identification of objects through their address - useful in python where the wrapped object has a different address
vincefn added a commit to diffpy/libobjcryst that referenced this issue Nov 2, 2022
* upstream-objcryst:
  Enable automatic re-generation of HKL's for a PowderPatternDiffraction when the spacegroup is changed, or when the lattice parameters change (the latter only outside of an optimisation). This is done by making all the HKL attributes mutable, and overloading the SetHKL and GenHKLFullSpace, GenHKLFullSpace2 with a protected const version, which should only be used for powder diffraction (and not single crystal data). This should address diffpy/pyobjcryst#32
  Update makefile to wxwidgets 3.2 and fftw to 3.3.10 ; update macOS Xcode project to make a universal binary with X86_64 and ARM64 architectures
@vincefn
Copy link
Collaborator Author

vincefn commented Nov 6, 2022

This now works in release 2.2.4 with libobjcryst 2022.1.3 and bcf1eba

@vincefn vincefn closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant