write_h: Write structure factors to a reflections file

Description Usage Arguments Value Examples

View source: R/io.R

Description

This function writes standardised structure factors data into an ASCII file. The files includes cell size, space group character symbol and Miller indices vector. It can include all of some of observed and/or calculated structure factors amplitudes and phases, either for anomalous or non-anomalous data.

Usage

1
write_h(filename, fdata)

Arguments

filename

A character string. Prefix of the structure factors file name. The file name has the form "[prefix]_h.dat".

fdata

A names list, usually created with functions standardise_fdata or read_h, and consisting of the following fields:

  • a Real numeric. Unit cell length in angstroms. Always included.

  • SG. Spacegroup 2-letters character string. There are only two symmetries possible when working within 1D crystallography, P1 (no symmetry) and P-1 (inversion through the origin). SG can be either "P1" or "P-1". Always included.

  • hidx. Real numeric array. 1D unique (positive in the 1D context) Miller indices. Always included.

  • Fobs. Real numeric array. Amplitudes of observed structure factors. Not always included.

  • sigFobs. Real numeric array. Errors associated with Fobs. Not always included.

  • Fp. Real numeric vector. Amplitudes of the positive component of Friedel (or Bijvoet) pairs (F+). Not always included.

  • sigFp. Real numeric vector. Errors associated with Fp. Not always included.

  • Fm. Real numeric vector. Amplitudes of the negative component of Friedel (or Bijvoet) pairs (F-). Not always included.

  • sigFm. Real numeric vector. Errors associated with Fm. Not always included.

  • Phiobs. Real numeric array. Phases (in degrees) of structure factors obtained with one of the methods used for structure solution. Not always included.

  • Phicalc. Real numeric array. Phases (in degrees) of structure factors calculated from the correct 1D structure. They are normally used to check correctness of Phiobs. Not always included.

Value

This function does not return anything, but will create an ASCII file of name *_h.dat which contains structure factors and other type of information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Data from thiocyanate structure
datadir <- system.file("extdata",package="crone")
filename <- file.path(datadir,"thiocyanate_x.dat")
sdata <- read_x(filename)

# Miller indices
hidx <- 1:10

# Observed structure factors with errors
ltmp <- sfobs(hidx,sdata)
Fobs <- ltmp$F
sigFobs <- ltmp$sF

# Phases from calculated structure factors
ftmp <- strufac(hidx,sdata)
phicalc <- ftmp$Fpha

# Create standardised fdata structure
fdata <- standardise_fdata(sdata$a,sdata$SG,hidx,Fobs=Fobs,
 sigFobs=sigFobs,Phicalc=phicalc)
 
# Name of structure factors file (in home directory)
homedir <- Sys.getenv("HOME")
fname <- file.path(homedir,"test")

# Write data to file
write_h(fname,fdata)

jfoadi/crone documentation built on May 17, 2017, 7:19 p.m.