Archive | diffuse scattering RSS for this section

My ORCID QR code

Never used one myself, but here it is! ORCID is what it says here.

QR code for my ORCID account

Whatever.

QR code for my ORCID account

Whatever, thumbnail size.

 

 

Me there

The ZMC page from RSC

My ZMC software used to be (might still be) hosted on the computers at ANU (http://rsc.anu.edu.au/~goossens/ZMC.html). But I don’t know how long that will last!

Therefore, this is a copy of that page, with the files linked to the RSC for now. If the links don’t work, let me know. Could also try here.

Overview

Conventional crystal structure refinement and solution relies on an analysis of the Bragg peaks, the sharp, well-defined scattering in a diffraction pattern. In doing this, the structure can be considered as an array of identical unit cells, and this reduces the ‘solution’ of the crystal structure to the determination of the unit cell contents.

In a disordered material, while the average unit cell does indeed obey the space group symmetry of the crystal structure, such that solving the asymmetric unit within the cell ‘solves’ the structure, this is not the case for a disordered material — or even for what would generally be considered as an ordered material if considering instantaneous molecular and atomic motions.

Even an ordered crystal will show thermally induced vibrations of the atoms. If we could ‘freeze’ the crystal and look at the atoms, we would find that the space group symmetry is not obeyed. It is obeyed on average. In a disordered material it could be that the average occupation of a given site is 50% one type of atom and 50% another, in which case no site obeys the average symmetry.

What does this mean for analysis of diffuse scattering? It means that you can no longer consider all unit cells as identical. It means that you have to now work with an ensemble of unit cells big enough that averaging across it recovers the average and big enough that it can contain a statistically valid population of the local (short-range order) structures present in the crystal.

This means that analysis of diffuse scattering requires different tools from analysis of conventional Bragg scattering. ZMC is an attempt at a program to allow relatively ready implementation of a simulation of diffuse scattering from (particularly but not solely) molecular crystals. Eric Chan has prepared this flyer to show some of the details of the program, and I am very grateful to him. Further, he has developed a tutorial, available here, and it is really worth a look. His webpage is at https://sites.google.com/site/echanj/ and contains modified ZMC versions that can do some great stuff, including modulated structures. He has also done some work on a graphical interface! He’s an amazing guy.

Obtaining ZMC

ZMC is alpha software at best, and always will be; nothing about its performance is guaranteed nor promised. The code and binaries are licensed under the Academic Free License version 3.0; details in the files DISCLAIMER.txt and COPYRIGHT.txt (http://opensource.org/licenses/AFL-3.0).

Here is a bundle of statically-linked binaries for Linux, from April 2016 — the real current version:

Static binaries for Linux.

Here is a bundle of statically-linked binaries for Windows (compiled using g95 on Win 7; I don’t even know if it is 32 or 64 bit), from April 2016 — the real current version, but not much tested:

Static binaries for Win.

Here is the current source code plus a simple Linux compile script — package has transitioned to gfortran, and all the most important binaries seem to work (thanks to Aidan Heerdegen as always):

Source.

Refer to the older packages below for documentation, examples, and so on. Please also refer to this article and its associated deposited material, because it provides a complete working simulation.

Please note that this article was specifically published as Open Access in order to allow for anyone to make use of it.


Here are packages, older versions compiled for different systems. Comments about g95 are not current.

Despite my better judgement, I am putting it up here for download. You can download the current 2014 ZMC in the following formats:
Windows
Linux
Mac OS X
source.

The README file for Windows is here. Be aware that there are many versions of Linux (and OS X is not known for its long term user support or version-to-version compatibility), so your best bet might well be to contact me about the source code. If you can get g95 working (www.g95.org, version 0.92 I suggest) then the compile is pretty trivial (he says hopefully…).


While ZMC is relatively straightforward to use, and a great deal of work has been undertaken to give it a usable (if text file-based) interface, it is not yet ‘production’ software (and never will be). It is written in Fortran90 and uses a module library developed by Dr Aidan Heerdegen, and some components of the system have not been tested on various combinations of hardware and operating system. Currently, As of 2014, binaries exist for g95 on Intel Macintosh (Mac OS X 10.6), Intel Fortran Compiler on Debian stable on Intel i7 (ie, most Intel-compatible) and Windows xp, and that is about it. So far, once the modules are ported, the main program seems to compile without problems, but I am not in a position to make a general distribution.

Further, there is no comprehensive manual, though it comes with an in-progress version of what will one day, time permitting, be a manual (unlikely). The program contains some basic help options, and the distribution packages contain a (simple) simulation that should work out of the box, and the adumbral manual contains some code that might be useful also.

Some things to note: ZMC is essentially a program for displacive relaxation/equilibration of the model crystal. Any occupancy ordering needs to be done externally. The software needs a suite of toolbox programs, which also need to be bundled with any distribution. These include programs for working with crystal geometry, calculating diffraction patterns (DIFFUSE, Butler, B. D. & Welberry, T. R. (1992). J. Appl. Cryst. 25, 391–399), performing any occupancy simulations and so on.

References

ZMC is used and the method described in the following publications, amongst others. Apologies for the rough layout.

E.J. Chan and D. J. Goossens, ‘A method to perform modulated structure studies using the program ZMC’, J. Appl. Cryst., 2017 50 1834–1843.

This article and its associated deposited material contain a working simulation with occupancy and displacive elements — a good place to start: ‘A Process for Modelling Diffuse Scattering from Disordered Molecular Crystals, Illustrated by Application to Monoclinic 9-Chloro-10-methylanthracene’, Advances in Condensed Matter Physics, 2015 (2015), Article ID 878463, 7 pages, DOI: http://dx.doi.org/10.1155/2015/878463

D.J.Goossens, A.P.Heerdegen, E.J.Chan and T.R.Welberry, ‘Monte Carlo Modelling of Diffuse Scattering from Single Crystals: The Program ZMC‘, Metallurgical and Materials Transactions A, 42A (2011) 23-31. DOI: 10.1007/s11661-010-0199-1.
(PDF)

D.J.Goossens and T.R.Welberry, ‘Diffuse Scattering from Molecular Crystals’, chapter in Diffuse Scattering and the Fundamental Properties of Materials, edited by Rozaliya I. Barabash, Gene E. Ice and Patrice E.A. Turchi. Momentum Press, 2009. Print ISBN: 978-1-60650-000-2. E-book ISBN: 978-1-60650-002-6

E.J.Chan, T.R.Welberry, D.J.Goossens, A.P.Heerdegen, A.G.Beasley and P.J.Chupas, ‘Single-crystal diffuse scattering studies on polymorphs of molecular crystals. I. The room-temperature polymorphs of the drug benzocaine’, Acta Cryst. B65 (2009) 382-392.

D.J.Goossens, A.G.Beasley, T.R.Welberry, M. J. Gutmann and R.O.Piltz, ‘Neutron diffuse scattering in deuterated para-terphenyl, C18D14‘, J. Phys.: Condens. Matt., 21 (2009) 124204.

D.J.Goossens and M.J.Gutmann, ‘Revealing how interactions lead to ordering in para-terphenyl’, Physical Review Letters, 102 (2009) 015505-1-4.

D.J.Goossens, A.P.Heerdegen, T.R.Welberry and A.G.Beasley, ‘The Molecular Conformation of Ibuprofen, C13H18O2, Through X-ray Diffuse Scattering’, International Journal of Pharmaceutics 343 (2007) 59-68.

D.J.Goossens, T.R.Welberry, A.P. Heerdegen and M.J. Gutmann, ‘Simultaneous Fitting of X-ray and Neutron Diffuse Scattering Data’, Acta Crystallographica A A63 (2007) 30-35.

————————-
Updated May 12, 2016
————————-

Installing ZMC on Windows

ZMC is a suite of code for modelling diffuse scattering. If you don’t know what any of that means, there’s nothing to see here.

Binary distribution

Downloaded http://rsc.anu.edu.au/~goossens/ZMC_files/ZMC_Nov2015_Win_g95.zip OR http://djg.altervista.org/downloads/ZMC_files/ZMC_Nov2015_Win_g95.zip into an install directory and unzipped.

Opened a commandline window and cd’d to the directory where files were unpacked.

C:\WHATEVERTHEPATHIS> cd ZMCWin_g95
C:\WHATEVERTHEPATHIS> ZMC.exe --help2

Seems to run.

That’s it. Could have added the directory to my path.

Downloaded http://rsc.anu.edu.au/~goossens/ZMC_files/ZMC_source_package_Mar20_2014.tar.gz OR http://djg.altervista.org/downloads/ZMC_files/ZMC_source_package_Mar20_2014.tar.gz and explored the documentation and the sample simulation included, but used the more current binaries.

Also, went to http://dx.doi.org/10.1155/2015/878463 and downloaded the paper and the simulation hosted there. It is a complete working example. The simulation is also hosted at http://djg.altervista.org/downloads/ZMC_files/878463.f2.zip.

That’s the easy part done…

Installing from source — Cygwin

(1) Install gfortran

Ran Cygwin setup-XXX.exe (x86-64 in my case) and installed gcc-fortran package and any dependencies.

(2) Opened a Cygwin terminal and made an install directory

$ cd installs

$ mkdir ZMC

$ cd ZMC

$ wget http://djg.altervista.org/downloads/ZMC_files/ZMC_toolbox_source_April_2016.tar.gz

$ tar x -vzf ZMC_toolbox_source_April_2016.tar.gz

$ cd ZMC_toolbox_source_April_2016

(3) Run the compile script

$ bash compile_all_Linux_gfortran.sh

Errors!

(4) OK, try 32-bit toolchain.

install cygwin32-gcc-fortran

(5) Copy the script and change the compiler name to i686-pc-cygwin-gfortran.exe

$ bash compile_all_Linux_gfortran_32bit.sh

Mostly works, but bin2gray does not compile, and it is essential.

(6) Try using djgpp fortran (install via Setup.exe)

Change compiler to i586-pc-msdosdjgpp-gfortran.exe

$ bash compile_all_Linux_gfortran_djgpp.sh

Much like 32-bit compile– no bin2gray.

(7) What’s the error? We’ll fix it for the 32-bit gcc compile, rather than djgpp.

$ i686-pc-cygwin-gfortran.exe -w -static -O2 -o bin2gray_static bin2gray.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
bin2gray.f90:15:40:

bin2gray.f90:6:6:

use cmdline_arguments
2
bin2gray.f90:15:40:

character(len=*), parameter :: version = "$Id: bin2gray.f90,v 1.6 2007/06/04 05:23:11 aidan Exp $"
1
Error: Symbol ‘version’ at (1) conflicts with symbol from module ‘cmdline_arguments’, use-associated at (2)

OK, some kind of scope thing. I’ll just change ‘version’ in bin2gray.f90 to ‘versionbg’.

Works!

OK, download new bin2gray from:

$ wget http://djg.altervista.org/downloads/ZMC_files/bin2graybg.f90

And modify the script to the the 32-bit compiler and to compile this file instead of the other one.

(8) Make some links

$ ln -s /home/darren/installs/ZMC/ZMC_toolbox_source_April_2016/ZMCLinux_gfortran_static_32bit/ZMC_static.exe /home/darren/bin/ZMC

and so on.

(9) Testing finds that the binary ‘runs’ in that it throws no errors, but it does nothing. OK. We have a problem.

(10) Add ‘.exe.’ to end of each output file from the compile commands. Does not help.

(11) Retry 64-bit compile. It’s the native one, after all. See what the errors are.

Says: undefined symbol `strtoflt128′
But the relevant library is installed. Adding an explicit call to it -lquadmath does not seem to help.

Oh dear.

Installing from source — MinGW

What if we try for a Windows compile outside of Cygwin?

https://gcc.gnu.org/wiki/GFortranBinaries#Windows

Installed the MinGW bunch of stuff. Went to start menu and opened the MinGW terminal.

H:\Other\ZMC\ZMC_toolbox_source_April_2016>which gfortran
C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gfortran.EXE

Used the version of bin2gray.f90 modified to replace the ‘version’ variable with, say, ‘versionbg’, (bin2graybg.f90 as noted above, though copied over the top of bin2gray.f90) then…

Created a new install batch file that looks like this:

H:\Other\ZMC\ZMC_toolbox_source_April_2016>type compile_all_Win_gfortran.bat
@echo off
REM Manual compile of ZMC, DZMC and toolbox programs.
REM
REM Note: I have gnuwin32 installed, so I hve access to pwd etc
REM Dependencies are accounted for by the order of the
REM compilations -- some modules depend on others.
REM This means that this could be broken by upstream changes
REM to the modules by Aidan Heerdegen (aidan@rsc.anu.edu.au)
REM
REM However, if this does not happen, compilation is simple.
REM
REM NOTE!!: Some manual customisation of this file will
REM probably be needed, but it is very simple:
REM
REM Namely the -I and -L flags to gfortran need to point
REM to the directory where the compilation is happening,
REM and that it is easiest for a relatively simple project
REM like this to use the flat structure, then just copy out
REM the executables to a directory in the path.
REM
REM No guarantees/warranties are given or implied. Use at
REM your own risk. Caveat emptor. Buyer beware.
REM
REM And you get what you pay for...
REM
REM darren.goossens@gmail.com Jul 2018
REM
echo ---------------------------
echo on
del *.o *.O *.mod *.MOD
set bindir=ZMCWin_gfortran_static
echo ---------------------------
mkdir %bindir%
echo ---------------------------
gfortran -static -O2 -ffree-line-length-0 -c precision.f90
gfortran -static -O2 -ffree-line-length-0 -c fundamental_constants.f90
gfortran -static -O2 -ffree-line-length-0 -c varying_string.f90
gfortran -static -O2 -ffree-line-length-0 -c globals.f90
gfortran -static -O2 -ffree-line-length-0 -c cartesian_class.f90
gfortran -static -O2 -ffree-line-length-0 -c array_functions.f90

gfortran -static -O2 -ffree-line-length-0 -c sort_functions.f90
gfortran -static -O2 -ffree-line-length-0 -c variable_array.f90
gfortran -static -O2 -ffree-line-length-0 -c binary.f90

gfortran -static -O2 -ffree-line-length-0 -c string_functions.f90
gfortran -static -O2 -ffree-line-length-0 -c statistics.f90

gfortran -static -O2 -ffree-line-length-0 -c binary_io.f90

gfortran -static -O2 -ffree-line-length-0 -c file_functions.f90

gfortran -static -O2 -ffree-line-length-0 -c hash_table.f90
gfortran -static -O2 -ffree-line-length-0 -c polysample.f90
gfortran -static -O2 -ffree-line-length-0 -c vector_class.f90

gfortran -static -O2 -ffree-line-length-0 -c mol2_class.f90
gfortran -static -O2 -ffree-line-length-0 -c cmdline_arguments.f90
gfortran -static -O2 -ffree-line-length-0 -c keyword_class.f90
gfortran -static -O2 -ffree-line-length-0 -c rotmatrix_class.f90

gfortran -static -O2 -ffree-line-length-0 -c crystallography_class.f90
gfortran -static -O2 -ffree-line-length-0 -c image_transforms.f90
gfortran -static -O2 -ffree-line-length-0 -c quaternion_class.f90
gfortran -static -O2 -ffree-line-length-0 -c zmatrix_class.f90

gfortran -static -O2 -ffree-line-length-0 -c pnm_class.f90
gfortran -static -O2 -ffree-line-length-0 -c superimpose.f90

gfortran -w -static -O2 -o ZMC_static zmc_Nov03_2015.f90 rannum.f ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o DZMC_static readat_zmc_Aug29_2014.f90 diffuse_allocatable_March20_2014.f90 rannum.f ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o bin2gray_static bin2gray.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o zmat_maker_static zmat_maker.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o zmat2xyz_static zmat2xyz.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o zmatchk_static zmatchk.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o zmat_anim_static zmat_anim.f90 rannum.f ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o zmat2mol2_static zmat2mol2.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o pgmave_static pgmave.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o pgmcombine_static pgmcombine.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o make_random_occ_static make_random_occ.f90 rannum.f ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o mol2xyz_static mol2xyz.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o catmol2_static catmol2.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o chkmol2_static chkmol2.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o pgm2mask_static pgm2mask.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o pgm2ni_static pgm2ni.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o ni2pgm_static ni2pgm.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
gfortran -w -static -O2 -o raw2pgm_static raw2pgm.f90 ps_routines.f fundamental_constants.o varying_string.o globals.o precision.o cartesian_class.o array_functions.o sort_functions.o variable_array.o binary.o binary_io.o string_functions.o statistics.o file_functions.o hash_table.o polysample.o vector_class.o mol2_class.o cmdline_arguments.o keyword_class.o rotmatrix_class.o crystallography_class.o image_transforms.o quaternion_class.o zmatrix_class.o superimpose.o pnm_class.o
move *.exe %bindir%
copy *.txt %bindir%
copy READ* %bindir%

Opened a Windows command prompt, went to the directory where the files are. Ran the batch file and all was well.

Done!

After this, it’s a case of actually putting together a simulation, putting ZMC binaries where they need to be, and so on.

 

Just for completeness.

Mercury (CCDC) on 64-bit Debian

Tried Mercury 3.6 on 32-bit Debian and the -mesa option got it to work. On 64-bit Debian (9.4), no such luck.

Eventually, tried the Windows version installed through wine. Note that I am running 64-bit Debian but wine is providing 32-bit Windows.

$ echo $WINEARCH
win32

$ wine mercurystandalone-3.6-windows-installer.exe

Nope.

ran winecfg; added the installer to the list of applications and set it to run as Windows 7.

Screenshot of the wine winecfg main window, showing the Mercury installer file added as an application.

winecfg main window

Then installer ran, but barfed.

Something about “ntlm_auth version”.

Search for “ntlm_auth” at https://www.debian.org/distrib/packages. Is it even installed? Well, can make sure easily enough.

sudo apt-get install winbind libnss-winbind libpam-winbind

Tried again with wine set to mimic (“wine is not an emulator”) Windows 10. Nope. OK, Win 7.

ntlm_auth error was now gone but got another complaint.

Screen shot of the error box. It says The visual C redistributable package failed to install. Software may not work. You should run C:\Program Files\CCDC\Mercury 3.6\vcredist_x86_2010.exe as administrator once installation is finished.

Error message on installing Mercury. Install finished after clicking OK and is seems to work…

But Mercury did launch. Guess I’ll use it till I have a problem …

Screen shot showing Meruryworking. Seems OK as far as I can tell.

Mercury 3.6 with a structure in the window.

YMMVW (your mileage may vary wildly)

Modulated molecular crystal structures — well done, Eric!

A new scientific paper. A tribute to the residual momentum of my scientific career, and in particular to Eric Chan, who has built on my work to come up with a way of exploring modulated molecular crystals. https://doi.org/10.1107/S1600576717015023

It’s pretty subtle stuff, but basically a crystal structure can show a periodic variation from cell to cell — for example, a displacement or substitution of an atom or molecule. If this variation is periodic, then it can be described using a periodic function. Such a function will have a Fourier transform that requires (relatively) few Fourier terms, and each strong term will give rise to a bright spot in the diffraction pattern. These spots will occur in a motif centred on (some) Bragg peaks, potentially adding many new spots to the diffraction pattern.

So where these bright spots occur tells you about the modulation. However, in something like molecular crystal, the molecular structure factor may be relatively complicated, and so may the nature of the modulation. This may mean that it is not easy to predict where the modulation spots are likely to be intense.

Eric figured out a way to use my program ZMC to generate modulated molecular structures and then calculate their diffraction patterns.

An example of a diffraction pattern calculated using <tt>ZMC</tt> with Eric Chan's modulation wave addon.

An example of a diffraction pattern calculated using ZMC with Eric Chan’s modulation wave addon.

It is pretty heavy and specific stuff, but it also is a capability that I’ve not seen elsewhere. Eric’s webpage is at https://sites.google.com/site/echanj/, and that is the best place to go to have a look for the code.

Other ZMC.

Journal self-archiving policies

One of the most-viewed pages here (it’s all relative; still not very many hits really) is the list of dodgy publishers. It’s a drop in the ocean, but it gets a few hits. Something else I’d like to bring all into one place, even though it’s been done elsewhere, is to summarise self-archiving polices. I’ll focus on the journals I’ve published in, preparatory to putting together a web archive of all my papers that I am allowed to self-archive (on my website and maybe on ResearchGate). It’s really just a resource for me, but I might as well make it public.

Some journals are open access; you don’t need to self-archive those, but usually you can.

Some allow you to archive a proper reprint, processed and edited by the journal — like the IUCr, as shown below.

Some suggest you archive the ‘author’s final version’ but don’t want you to put up anything with the journal’s imprimatur.

Some say ‘mine mine mine’ and don’t let you host it at all. I hope to make this clear.

The page lives at https://darrengoossens.wordpress.com/journal-self-archiving-policies, and so far has exactly one (1) entry, the good old IUCr, which has a very enlightened policy. They allow self-archiving as long as you use the official e-reprint, rather than just the downloaded PDF, and they request that you provide a link to the journal. Seems very reasonable. The official e-reprint is easy to recognise; it has a distinctive front page with some official words on it, something like this (colours may vary):

Front page of IUCr reprint, showing it is dfferent from download from journal.

Note the box with the notice near the bottom of the page.

 

I think their policy is very reasonable because the IUCr has a very professional publication and editorial team who need to be paid and ought to be paid. Subscriptions are part of the mix, yet they allow authors to house their own work and to distribute copies to colleagues freely. It seems a very sensible mix.

More updates as they come to hand.

My Appendix: Chains of molecules, planes of scattering

In a very recent post, I mentioned an appendix to an article I wrote. I rather like it. The appendix grew out of a little document I put together. That document is longer, vaguer and a little different from the published appendix, and so I am putting it here. Now, the article was written in LaTeX, and this is a website, so I tried running htlatex on the file. It was very complicated:

$ htlatex planes
$ firefox planes.html

And it worked. Next thing is to get it into WordPress… Easy enough to cut and paste the HTML code into the window here, but what about all the graphics that were turned into png files? Ah well…bit of manual fiddling. Equations and symbols seem to sit high, and some of the inline equations have been broken into a mix of graphics and characters… still, not too bad. The PDF version is available here.


Planes perpendicular to vectors

Say you have a vector in real space, expressed say in direct lattice terms, for

example  planes0x= paplanes1x + pbplanes2x + pcplanes3x where planes1x is the a lattice parameter, which is a vector.

You may want the reciprocal plane(s) perpendicular to this vector.

Why?

Because correlations in a crystal collapse the scattering into features perpendicular to the direction of the correlation. In a normal, fully ordered three dimensions (3D) crystal, this collapsing happens in all three directions, so the scattered intensity coming off the atoms gets concentrated at points, the reciprocal lattice points, usually denoted hkl.

If you have only two dimensional ordering, the scattering is collapsed down in two directions but not the third, giving rise to rods or lines of scattering in reciprocal space (that is, in diffraction space). If there are only one dimensional correlations, the scattering collapses into sheets, that is, it is delocalised in two dimensions and only localised in one dimension (because there are only correlations in one dimension).

In diffuse scattering the crystal is typically long-range ordered in three dimensions, and the diffraction pattern shows nice Bragg peaks (hkl reflections). However, there can also be disorder, for example in the motions of the molecules or the chemical; substitution of one species of atom or molecule for another.

In a molecular crystal, one can sometimes identify a chain of molecules running through the crystal, and interactions within these chains are likely to be much stronger than those within. That tends to mean that the motions of the molecules along the direction of the chain (call that ‘longitudinal’ motion) is highly correlated, while it is not well correlated laterally.

In such a situation, the single crystal diffuse scattering will show ‘sheets’ of scattering perpendicular to the length of the chain.

Let’s say the chain of molecules extends along an arbitrary real-space direction, which we’ll define by the vectorplanes0x as above.

Now, a plane perpendicular to planes0x can be specified by giving two (nor more) non-collinear vectors that lie in it. Let’s look at two vectors and we’ll call them planes7x and planes8x, for no good reason.

Then we can say that

planes9x (1)

but note that we are not assuming planes7xplanes8x = 0, since right angles within the plane are not that important — especially as for generality I am not assuming orthogonal axes.

Now, planes7x exists in reciprocal space, so it is a linear combination of the reciprocal lattice vectors, planes13x, planes14x and planes15x like this

planes16x (2)

and these reciprocal vectors are defined in terms of the direct space vectors like this

planes17x (3)

and similarly for the other reciprocal vectors. The important thing for us to note is that this means planes13x is perpendicular to planes3x and planes2x . This is important when we go to take dot products later on. The bottom line here is basically the volume of the unit cell, and 2π is just a scalar, so from the point of view of defining the plane that we want, these are not important.

Ignoring the scalar parts, substituting eq. 3 into eq. 2 gives

planes21x (4)

and since we have more variables than we need if we are to satisfy eq. 1, we can arbitrarily set qc = 0.

Now, considering the dot product of planes7x and planes0x , in full it is

planes24x (5)

and this is useful because, to take the last term on the first line as an example, planes1x is perpendicular to (planes3x × planes1x) by the very nature of the cross product. This means that any terms with a repeated vector go to zero. Further, in the remaining terms the vector part is just of the form planes1x planes29x which is the unit cell volume and a constant, which we can also factor out to be left with

planes30x (6)

which is nice and simple. This is not a surprise but still…

The next step is to find another vector in that plane. This is just planes8x, and if we use the same logic but, to make planes8x non-collinear with planes0x , we choose rb to be zero, we get an equation analogous to eq. 6. These can be summed up as

planes34x (7)

where planes35x is a fairly straightforward extension.

Now, in terephthalic acid (TPA), triclinic polymorph of form II, each molecule has a -COOH group at each end. These H-bond strongly with the groups on neighbouring molecules and you get strongly correlated chains of molecules running along the [-111] (direct space) direction. This then suggests that the planes of scattering perpendicular to these chains will extend in the directions

planes36x (8)

or

planes37x (9)

Now, does this work? Figure 1 is some data from TPA, diffuse scattering data measured on a synchrotron. It also shows the reciprocal axes and the white, two-ended arrows show the directions of the diffuse planes and by
counting Bragg spots it can be seen that these agree with the calculation above.


planes38x

Figure 1: Observed data, measured at the Advanced Photon Source, showing what looks like multiple crystallites with similar orientations.


This means that we can ascribe these features to correlations in the displacements of the TPA molecules linked by the -COOH groups.

Before, before. Stop living in the past.

A Paper! Good God, a Paper: ‘Synchrotron X-ray diffuse scattering from a stable polymorphic material: terephthalic acid, C8H6O4’

I’ve been doing science for a long time, and while I’m in a bit of a career transition at the moment (see here for example), I’ve still got a few fingers in a few pies, and a few pieces of work slowly wending their ways through the system. Most recently, Eric Chan and I put out ‘Synchrotron X-ray diffuse scattering from a stable polymorphic material: terephthalic acid, C8H6O4‘. It’s a paper about the fuzzy, diffuse scattering from two polymorphs of the title compound.

It’s out in Acta Crystallographica Section B: STRUCTURAL SCIENCE, CRYSTAL ENGINEERING AND MATERIALS, a highly reputable but not open access journal, although they do allow authors to self-archive. At the moment, what that means is if you want a copy send me a message and I’ll punt one back to you.

Terephthalic acid molecule, drawn in Mercury.

Terephthalic acid molecule, drawn in Mercury.

What is terephthalic acid (TPA)? Well, it is a chemical used a lot in industry (plastics and such) and at room temperature it can crystallise out of solution in two forms, called (wait for it) form I and form II. (Well, actually the word ‘form’ is poorly defined in this context, technically, and it’s better to just say ‘polymorph I’ and ‘polymorph II’). In this context, a molecule is polymorphic if it can form more than one crystal structure and these structures can co-exist. Many materials change structure as you heat them up or squash them, but in a polymorphic system separate crystals of the structures can sit there side by side, under the same conditions. In most case, those conditions are room temperature and one atmosphere of pressure.

The two room temperature polymorphs are both triclinic, so of low symmetry. The difference is in how the molecules are arranged relative to each other. In both cases the -COOH groups on the ends of the molecules connect strongly to those on neighbouring molecules, so long chains of molecules form. (In the picture here, the -COOH groups are those at the ends of the molecule consisting of two red (oxygen) atoms, one white (hydrogen) and the grey (carbon) atom attached to the two whites.) These chains are sort of like one dimensional crystals, and then they are stacked up (like logs or a pile of pipes), but you can stack them up with, say, the -COOH in neighbouring chains close together, or you might have the phenyl rings (that is, the hexagon of grey carbon atoms) in one chain adjacent to the -COOH in the next. So in that sort of way you can get different crystal structures depending on how you stack things up.

Anyway, the paper looks at these polymorphs and how they are similar and how they differ. It uses my old ZMC program, which you can download from here (it comes with an example simulation, though not this one I’m talking about now). (That link goes to a paper I wrote and published for an Open Access journal, which I chose specifically so that you could go and download ZMC and everything for free…)

So in doing this I think about the connectivity of the molecule — how do the atoms depend on each other and where does the molecule need to be able to flex and twist? That means I end up drawing diagrams like this one:

 

connectivity

That’s exciting, isn’t it? I start at the middle (X) and then each atom is positioned relative to the ones that went before. Here’s another picture (because I happen to have it handy)…. This shows how the atoms were numbered, and how by numbering them correctly and building the molecule up in the right order it is easy to let the -COOH groups spin around. mol_num

The X-ray diffuse scatting in the <i>h</i>0<i>l</i> layer of reciprocal space of TPA.

The X-ray diffuse scattering in the h0l layer of reciprocal space of TPA. Measured at the Advanced Photon Source.

Here I show typical data. You can see the little white spots — these are the sharp diffraction peaks, Bragg peaks, and they indicate where a lot of X-rays were reflected off the crystal. They are what is used to work out what is usually called the ‘crystal structure’ which consists of the unit cell (the repeating unit) that the crystal is made up from. But you can also see blobs and streaks and stuff, and these are wider (‘diffuse’) features, and these tell us about how the molecules interact and shuffle each other around, and stuff like that.

Anyway, the paper is online now. The DOI link is https://doi.org/10.1107/S2052520616018801. One thing I really like about it is it’s got a mathematical appendix. I always wanted to write an article with a mathematical appendix. I think I might post on that separately.

 

 

 

 

https://doi.org/10.1107/S2052520616018801

AANSS 2016 — it’s approximately that time of year again, again.

Get that neutron feeling.

Get that neutron feeling.

 

www.anbug.org

The AANSS is a great mix of formality and informality, quality science in a relaxed atmosphere. Anyone who has or might or ought to use neutron scattering in their work (and isn’t that all of us, really?) is invited. And here’s a trick: Registration is $50 cheaper for ANBUG members but ANBUG membership is free! So join up!

AINSE

 

Oldly.

Very simple-minded automation of gnuplot

I have lots of datafiles I want to plot. gnuplot is scriptable. Since I don’t need any fancy output yet — this is data investigation, not manufacture of publication-quality diagrams — I can get multiple plots out quickly by writing a simple (simplish) couple of scripts.

I am sure people who know bash and perl and stuff can do this much better, but this works for me.

I have a wrapper script that simply consists of multiple calls to an inner script. It is here that I select the files I want to plot:

$ cat make_lots_of_plots.sh
./script_auto.sh r_0001_o_xy_TPA_21_Biso4p8_reread.inp
./script_auto.sh r_0001_o_yz_TPA_21_Biso4p8_reread.inp
./script_auto.sh r_0001_o_zx_TPA_21_Biso4p8_reread.inp
.
.
etc
.
.
./script_auto.sh r_0050_o_yz_TPA_21_Biso4p8_reread.inp
./script_auto.sh r_0050_o_zx_TPA_21_Biso4p8_reread.inp

I know I could do this in a single script, but I like to be able to call the inner one directly if I just want to make one plot. The inner script, script_auto.sh looks like this:

$ cat script_auto.sh
epsname=`basename $1 .inp`.eps
echo $epsname
scriptname=`basename $1 .inp`.gp
echo $scriptname
echo "set term postscript eps solid enhanced font 'Times,24'" > $scriptname
echo $epsname > temp1111
echo 'set output "' > temp2222
echo '"' > temp3333
paste -d '' temp2222 temp1111 temp3333 >> $scriptname
echo "set angles degrees; set polar" >> $scriptname
echo "set size square" >> $scriptname
echo "set xrange [-0.8:0.8]" >> $scriptname
echo "set yrange [-0.8:0.8]" >> $scriptname
echo $1 > temp1111
echo 'plot "' > temp2222
echo '" w l lw 3' > temp3333
paste -d '' temp2222 temp1111 temp3333 >> $scriptname
echo "set output" >> $scriptname
echo "set terminal x11" >> $scriptname
echo "quit" >> $scriptname
cat $scriptname
rm temp1111 temp2222 temp3333
gnuplot $scriptname
ls -ltrh $epsname

What’s going on here?

epsname=`basename $1 .inp`.eps
echo $epsname
scriptname=`basename $1 .inp`.gp
echo $scriptname

The bit above just uses basename to create the two filenames I need, one for the encapsulated postscript output, and one for the gnuplot script. Then I basically assemble the lines I want to see go into the gnuplot script. Mostly I can just echo stuff into the file, but I have various quote marks within quote marks, and (for simple-minded me) the solution that I know works is to go via the paste command, and write stuff out to little text files. I am sure there are much tidier ways to do this, but this works for me.

The line:

paste -d '' temp2222 temp1111 temp3333 >> $scriptname

causes the contents of the temporary files to be pasted together and put into the script, where the delimiter (‘-d‘) is the thing between the single quotes — which is nothing since the quotes are adjacent. This pastes stuff together with no gaps. The things being echoed into the file are gnuplot commands of various kinds.

Then I cat the script to the screen so I can see what it is doing (if I direct the output from the plotting script into a file, this lets me capture the commands I used), then I remove the temporary files, run gnuplot, and list the newly made file.

Clunky, but simple and effective. Useful changes could include outputting to pdf or some other format, and adding a step at the end (perhaps using pdfjoin) to combine all the resulting files in a single file.

Here is a png of the result. The gnuplot formatting could be made much nicer (title is too big, etc), but the overall process can always be improved, so I’m not worried about that. And the fact that it is a script means I can replot quickly when I know what the final format should be. For now I just want to see what I’ve got.

A simple plot from a diffuse scattering simulation, made using gnuplot.

A simple plot from a diffuse scattering simulation, made using gnuplot.

Whatever suits.