Skip to content

Commit ef5ba60

Browse files
committed
revise BYU website; add scripting distance stuff; better distance docs in SphinxDocs
1 parent 5e328a6 commit ef5ba60

File tree

5 files changed

+127
-14
lines changed

5 files changed

+127
-14
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,15 +3020,15 @@ def _showWebPage(event):
30203020
with open(tmp.name,'w') as fp:
30213021
fp.write(txt.replace(
30223022
'<HEAD>',
3023-
'<head><base href="https://stokes.byu.edu/iso/">',
3023+
'<head><base href="https://iso.byu.edu/">',
30243024
))
30253025
fileList.append(tmp.name)
30263026
G2G.ShowWebPage('file://'+tmp.name,G2frame)
30273027
import tempfile
30283028
import re
30293029
import requests
30303030
from GSASII.exports import G2export_CIF
3031-
isosite="https://stokes.byu.edu/iso/"
3031+
isosite="https://iso.byu.edu/"
30323032
upscript='isocifuploadfile.php'
30333033
isoscript='isocifform.php'
30343034
isoSubCite = ('For use of this supergroup search, please cite:\n'+
@@ -3078,7 +3078,7 @@ def _showWebPage(event):
30783078
with open(tmp1.name,'w') as fp:
30793079
fp.write(r1.text.replace(
30803080
'<HEAD>',
3081-
'<head><base href="https://stokes.byu.edu/iso/">',
3081+
'<head><base href="https://iso.byu.edu/">',
30823082
))
30833083
G2G.ShowWebPage('file://'+tmp1.name,G2frame)
30843084
G2G.G2MessageBox(G2frame,

GSASII/GSASIIpwdGUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,15 +5206,15 @@ def _showWebPage(event):
52065206
txt = event.GetEventObject().page
52075207
tmp = tempfile.NamedTemporaryFile(suffix='.html',delete=False)
52085208
with open(tmp.name,'w') as fp:
5209-
fp.write(txt.replace('<HEAD>','<head><base href="https://stokes.byu.edu/">',))
5209+
fp.write(txt.replace('<HEAD>','<head><base href="https://iso.byu.edu/">',))
52105210
fileList.append(tmp.name)
52115211
G2G.ShowWebPage('file://'+tmp.name,G2frame)
52125212

52135213
def showWebtext(txt):
52145214
import tempfile
52155215
tmp = tempfile.NamedTemporaryFile(suffix='.html',delete=False)
52165216
with open(tmp.name,'w') as fp:
5217-
fp.write(txt.replace('<HEAD>','<head><base href="https://stokes.byu.edu/">',))
5217+
fp.write(txt.replace('<HEAD>','<head><base href="https://iso.byu.edu/">',))
52185218
fileList.append(tmp.name)
52195219
G2G.ShowWebPage('file://'+tmp.name,G2frame)
52205220

GSASII/GSASIIscriptable.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5637,6 +5637,78 @@ def Origin1to2Shift(self):
56375637
gpx.update_ids()
56385638
return gpx.phase(phasename)
56395639

5640+
def InitDisAgl(self,useAll=True):
5641+
'''Create the default controls used for distance and angle
5642+
searching. Perform distance and angle searching by passing
5643+
the results from this to :func:`GSASIIstrMain.RetDistAngle`
5644+
or :func:`GSASIIstrMain.PrintDistAngle`
5645+
At present, this does not populate the values needed for
5646+
uncertainty computations.
5647+
5648+
:param bool useAll: when True (default) all atoms are included
5649+
in the origin atom list. When False, only atoms with full
5650+
occupancy are included. All atoms are included in the target
5651+
atom list.
5652+
5653+
:returns: DisAglCtls, DisAglData. See the
5654+
:ref:`Distance/Angle controls documentation <DisAgl_table>` for
5655+
a description of these.
5656+
'''
5657+
phObj = self.data
5658+
generalData = phObj['General']
5659+
cx,ct,cs,cia = generalData['AtomPtrs']
5660+
# template for controls & search data
5661+
DisAglData = {}
5662+
DisAglData['SGData'] = phObj['General']['SGData']
5663+
DisAglData['Cell'] = phObj['General']['Cell'][1:] #+ volume
5664+
DisAglCtls = {'Factors': [0.85, 0.85],
5665+
'BondRadii': [], 'AngleRadii': [], 'AtomTypes': []}
5666+
# now populate search radii
5667+
radii = dict(zip(generalData['AtomTypes'],generalData['BondRadii']))
5668+
for atom in phObj['Atoms']:
5669+
typ = atom[ct]
5670+
dis = radii.get(typ,1.5) #
5671+
if atom[ct] in DisAglCtls['AtomTypes']: continue
5672+
DisAglCtls['BondRadii'].append(dis)
5673+
DisAglCtls['AngleRadii'].append(dis)
5674+
DisAglCtls['AtomTypes'].append(typ)
5675+
DisAglData['OrigAtoms'] = []
5676+
DisAglData['TargAtoms'] = []
5677+
for i,atom in enumerate(phObj['Atoms']):
5678+
rec = [i]+atom[ct-1:ct+1]+atom[cx:cx+3]
5679+
DisAglData['TargAtoms'].append(rec)
5680+
if atom[cx+3] == 1. or useAll:
5681+
DisAglData['OrigAtoms'].append(rec)
5682+
return DisAglCtls, DisAglData
5683+
5684+
def ShortDistances(self,useAll=False):
5685+
'''Looks for unrealistic distances in a structure, which are
5686+
atom-atom distances < 1.1 A for non-H(D) atoms.
5687+
To reduce the likelihood of distances between disordered
5688+
fragments being noted, set useAll=False (the default) so that
5689+
disordered atoms are ignored.
5690+
'''
5691+
cx,ct,cs,cia = self.data['General']['AtomPtrs']
5692+
#get interatomic distances
5693+
DisAglCtls, DisAglData = self.InitDisAgl(useAll)
5694+
DisAglCtls['Factors'][1] = 0 # no angles
5695+
AtomLabels, DistArray, _ = G2strMain.RetDistAngle(DisAglCtls,DisAglData)
5696+
# now reorganize into a single list & sort
5697+
alldists = []
5698+
for cntr in DistArray:
5699+
for dl in DistArray[cntr]:
5700+
alldists.append([(cntr,dl[0])]+dl[1:])
5701+
alldists.sort(key=lambda item:item[-2])
5702+
baddists = []
5703+
for (i,j),_,_,d,_ in alldists:
5704+
if d > 1.1: break
5705+
if self.data['Atoms'][i][ct][0] in ['H','D']: continue
5706+
if self.data['Atoms'][j][ct][0] in ['H','D']: continue
5707+
baddists.append([self.data['Atoms'][i][ct],
5708+
self.data['Atoms'][j][ct],
5709+
float(d)])
5710+
return baddists
5711+
56405712
class G2SeqRefRes(G2ObjectWrapper):
56415713
'''Wrapper for a Sequential Refinement Results tree entry, containing the
56425714
results for a refinement

docs/source/objvarorg.rst

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,8 @@ General \ (dict) Overall information for the phase
260260
\ Compare (dict) Polygon comparison parameters
261261
\ Data plot type (str) data plot type ('Mustrain', 'Size' or
262262
'Preferred orientation') for powder data
263-
\ DisAglCtls (dDict) with distance/angle search controls,
264-
which has keys 'Name', 'AtomTypes',
265-
'BondRadii', 'AngleRadii' which are as above
266-
except are possibly edited. Also contains
267-
'Factors', which is a 2 element list with
268-
a multiplier for bond and angle search range
269-
[typically (0.85,0.85)].
263+
\ DisAglCtls (dict) with distance/angle search controls,
264+
see :ref:`DisAgl_table`.
270265
\ F000X (float) x-ray F(000) intensity
271266
\ F000N (float) neutron F(000) intensity
272267
\ Flip (dict) Charge flip controls
@@ -1213,6 +1208,52 @@ Stress/Strain Sample phi (float) Sample rotation about ve
12131208

12141209
====================== ====================== ====================================================
12151210

1211+
.. _DisAgl_table:
1212+
1213+
.. index::
1214+
Distance/Angle computation controls
1215+
1216+
Controls used for Distance/Angle computation
1217+
-------------------------------------------
1218+
1219+
Two arrays are used as input to :func:`GSASIIstrMain.RetDistAngle` and
1220+
:func:`GSASIIstrMain.PrintDistAngle`, DisAglCtls and DisAglData.
1221+
1222+
* DisAglCtls is a dict with has keys ``Name``, ``AtomTypes``,
1223+
``BondRadii``, ``AngleRadii`` which are atomic radii to be used
1224+
in computation of distances. Also contains ``Factors``, which is
1225+
a 2 element list with a multiplier for bond and angle search
1226+
range [typically (0.85,0.85)]. The maximum search distance is the
1227+
product of the two radii and the multiplier, so raising the
1228+
multiplier increases the number of distances or angles that are
1229+
located. Example::
1230+
1231+
{'Name': 'Example',
1232+
'Factors': [0.85, 0.85],
1233+
'AtomTypes': ['Co', 'C', 'N', 'O', 'H'],
1234+
'BondRadii': [2.2, 1.12, 1.08, 1.09, 0.5],
1235+
'AngleRadii': [1.25, 0.92, 0.88, 0.89, 0.98]}
1236+
1237+
* DisAglData is a dict containing phase & refinement data:
1238+
1239+
* 'OrigAtoms' and 'TargAtoms' contain the atoms to be used
1240+
for distance/angle origins and atoms to be used as targets.
1241+
* 'OrigIndx' contains the index numbers for the Origin atoms.
1242+
* 'SGData' has the space group information (see
1243+
:ref:`Space Group object<SGData_table>`)
1244+
* 'pId' has the phase id
1245+
* 'Cell' has the unit cell parameters and cell volume
1246+
* 'covData' has the contents of Covariance data tree item
1247+
1248+
Added for use with rigid bodies:
1249+
1250+
* 'RBlist' has the index numbers for atoms in a rigid body
1251+
* 'rigidbodyDict' the contents of the main Rigid Body data tree item
1252+
* 'Phases' has the phase information for all used phases in the
1253+
data tree. Only the current phase is needed, but this is easy.
1254+
* 'parmDict' is the GSAS-II parameter dict
1255+
1256+
12161257
.. _parmDict_table:
12171258

12181259
.. index::
@@ -1302,7 +1343,7 @@ ISODISTORT implementation
13021343
==============================
13031344

13041345
CIFs prepared with the ISODISTORT web site
1305-
https://stokes.byu.edu/iso/isodistort_version5.6.1/isodistort.php
1346+
https://iso.byu.edu/isotropy.php
13061347
[B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions."
13071348
J. Appl. Cryst. 39, 607-614 (2006).] can be read into GSAS-II using import CIF. This will cause constraints to be established for
13081349
structural distortion modes read from the CIF. At present, of the five types of modes only displacive(``_iso_displacivemode``...)

docs/source/packages.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ with GSAS-II.
448448
computation of space group subgroups, color (magnetic) subgroups &
449449
lattice search.
450450

451-
**BYU ISOTROPY Software Suite** (https://stokes.byu.edu/iso/isotropy.php):
451+
**BYU ISOTROPY Software Suite** (https://iso.byu.edu/isotropy.php):
452452
GSAS-II directly accesses capabilities in the ISOTROPY Software
453453
Suite from Brigham Young University for representational analysis
454454
and magnetism analysis.

0 commit comments

Comments
 (0)