diffpy / diffpy.structure Goto Github PK
View Code? Open in Web Editor NEWCrystal structure container and parsers for structure formats.
License: Other
Crystal structure container and parsers for structure formats.
License: Other
python3 branch only. Move alpha release to the "dev" label on Anaconda diffpy channel.
Because #26 is quite troublesome in srfit.
update the URL in (once the online doc in github is ready)
setup.py
readme.txt
/doc/epydoc/makefile
/doc/epydoc/epydoc.cfg
Hi,
Is there a way using diffpy.structure
to save a CIF with the correct space group instead of using 'P 1'?
Ignore the _atom_site_aniso_label
block when all values are unknown, i.e., ?
, example - COD 4318756.
Add parser dictionary attribute _anisotropy
to mark up any resolved anisotropy values.
Consider dropping the _hasAtomSiteADPType
helper.
Add NumPy style docstrings for the SymOp and SpaceGroup classes in spacegroupmod.py.
To start working on this
create a new topic branch say py3-sg-docs
from the tip of the python3 branch.
edit the docstrings in spacegroupmod.py. For guidance see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy.
create a pull request towards the python3
branch in diffpy/diffpy.structure.
Hi all!
I'm interested in transformations like reciprocal lattice vectors to cartesian lattice vectors, and would like to do these with the direct and reciprocal structure matrices. Like explained in the book Structure of Materials by De Graef and McHenry (relevant pages on Google books) and implemented in EMsoft (relevant lines). My interest in this stems from attempting implementing a sample-detector-geometry for electron backscatter diffraction in the SEM.
Can I get these from the matrices like Lattice.base
, Lattice.stdbase
etc.? I recognize the metric tensor in Lattice.metrics
and reciprocal metric tensor with Lattice.reciprocal().metrics
, however I do not see the direct and reciprocal structure matrices as detailed in the references above.
Thanks for any help with this.
str
conversion works well enough404
File not found
The site configured at this address does not contain the requested file.
If this is your site, make sure that the filename case matches the URL.
For root URLs (like http://example.com/) you must provide an index.html file.
Read the full documentation for more information about using GitHub Pages.
GitHub Status โ @githubstatus
http://www.diffpy.org/diffpy.Structure
from diffpy.structure.spacegroups import GetSpaceGroup
from diffpy.structure.symmetryutilities import GeneratorSite
xyz = [0.05198, 0.94802, -0.05198]
sg = GetSpaceGroup('F 4 3 2')
gen = GeneratorSite(sg, xyz)
print(gen.positionFormula(xyz))
the current output breaks space group constraints in srfit:
{'x': '-3/3*x', 'y': '+3/3*x +1', 'z': 'x +1'}
the correct output should be
{'x': 'x', 'y': '1-x', 'z': '1-x'}
Problem: graphite.cif loads with anisotropy == False
at each site, but is hexagonal and should allow independent U33
.
Solution: Change CIF parser to assume anisotropy=True
by default. Flip to isotropic when required by CIF flag or by space group symmetry requirements.
This has non-standard C2 setting C2:b1. The parser crashes with AttributeError
. Make sure it raises StructureFormatError instead.
Hi I was just wondering whether there are any plans to release an update with the current codebase?
I have had problems with opening CIF files on Windows and finally got around to making a patch, but then saw that one had already been merged f4ff1a0 but that this has not been released on PyPI or conda-forge (patch date August 2019, current version 3.0.1 released in June 2019).
Thanks!
Fix failing CIF read of COD 2108010.
Do not convert SG number to int
, string lookup works as well.
avoid duplicate sites at fractional coordinates that are multiples of 1/3.
update author.txt, group member list, grant no. acknowledgment
update author/contact information in setup.py
update contact information in readme.txt
Docstrings in the Atom
class were partially converted to NumPy style in e186ab6.
Please finish conversion of the remaining docstrings in the Atom
class as listed under the TODO
marker. Some of them are class properties which need to be documented in a docstring of the associated property functions rather than in the top class docstring.
Also please convert the main docstring of the _AtomCartesianCoordinates
class. This is a module-private class so there is no need to update docstrings of its methods.
To start working on this
py3-atom-docs
from the tip of the python3 branch.dev35
with Python 3.5 and sphinx documentation tool. Make sure your installation passes tests and you can build the manual:# one time only - run this from the base directory of this repo
conda create -n dev35 python=3.5 sphinx numpy
source activate dev35
python setup.py develop
# make sure package tests pass
python -m diffpy.structure.tests.run
# compile and review the manual
make -C doc/manual html
open doc/manual/build/html/index.html
For guidance see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy.
python3
branch in diffpy/diffpy.structure.update the license when the new license from BNL is ready.
When CIF file gives ?
, i.e., unknown value for occupancy, it should be translated as 1 instead of 0.
stru.xyz = 1
produces linked xyz
arrays at each atom site as
a side effect of broadcast_arrays
.
Please convert docstrings of the Lattice class in the python3 branch to the NumPy style. For this you can follow a template of partial conversion of the Atom
class docs in e186ab6.
To start working on this
py3-lattice-docs
from the tip of the python3 branch.dev35
with Python 3.5 and sphinx documentation tool. Make sure your installation passes tests and you can build the manual:# one time only - run this from the base directory of this repo
conda create -n dev35 python=3.5 sphinx numpy
source activate dev35
python setup.py develop
# make sure package tests pass
python -m diffpy.structure.tests.run
# compile and review the manual, check just the `Lattice` link.
make -C doc/manual html
open doc/manual/build/html/index.html
For guidance see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy.
python3
branch in diffpy/diffpy.structure.Keep 'applications' around with deprecation warning.
@sbillinge I am porting over a discussion from the diffpy-users google group on the behavior of Structure.Bisoequiv
for calculating PDFs via real-space summation with diffpy.srreal.pdfcalculator.PDFCalculator
.
Hello all,
I have posted questions about calculating scattering from periodic (MD) models before, but didn't get much traction. Here I'm attaching a small example of the issues I've been encountering in the form of a jupyter notebook in hopes that this will be more useful in addressing my specific concerns.
In this example, I want to calculate the scattering from a single frame of a MD simulation of water. The frame is from a trajectory of a periodic water box with dimension 34.691 Angstroms. First, I calculate the scattering in reciprocal space treating the frame as an aperiodic structure using the DebyePDFCalculator. Despite ignoring periodic boundary conditions, the calculation 'looks good' to me, in that it looks like what I would expect from a total scattering measurement on water. Moreover, all of the individual pair correlations (O-O, O-H, and H-H correlations) make sense in real and reciprocal space.
However, when I try to repeat this calculation using real-space summation with the PDFCalculator, I get huge oscillations in the PDF baseline. Back-transforming the component G(r)'s back to reciprocal space, it's clear that somehow this method fails to properly treat the low-Q region for the O-O and H-H pairs, which produce the oscillations in the baseline (erroneous sharp peaks at low-Q). Moreover, the relative amplitude/sharpness of the O-H pair correlation seems incorrect. Even though the O-H distances are constrained in the structure, so the peak should be a delta-function in real space, I feel like the amplitude is nonetheless 'too sharp' given what should be the average scattering power for this pair.
I've been stumped for quite some time as to why trying to do a periodic calculation in real-space produces these issues. Any insights would be greatly appreciated! I will note that, anecdotally, doing similar real-space summations with models that don't contain H atoms do not seem to suffer from these pathologies.
Thanks,
Nik
Hi Nik
I think you will be a little bit annoyed by the answer ;)
There is a bug in the PDFcalculator. I think it also exists in the Debye version as well.The structure.Bisoequiv = 0.04 line does not really set the thermal parameters for your model.
Instead you should use:structure[structure.element == 'Element which you want to set Uiso for'].U = 0.005
If you prefer I think you can use B by doing it like this: structure[structure.element == 'Element which you want >to set Biso for'].B = 0.005
If you add the lines to the top of your calculation:
structure[structure.element == 'H'].U = 0.005
structure[structure.element == 'O'].U = 0.005
the ripples go away.
I would also use this for the Debye calculator as atoms are always moving no matter how you calculate the scattering.
I have attached the curves I get with those two lines in your script.
Cheers Mikkel
Thanks so much Mikkel (and Nik),
I posted this as an issue on the diffpy.structure repo on GH so we can look into it. Please can you check that it is actually a bug though? I wonder if we are giving enough information to
diffpy.structure
for it to know what to update withstructure.Bisoequiv = 0.04
. Is it ambiguous which elements' Uiso's should be updated? Of course, this is resolved by your code.What behavior would you want to happen if the user types
structure.Bisoequiv = 0.04
? That ALL ADPs are updated to that value? This may be too much "magic" and lead to unintended results for the user if, in their head, they are updating just one atom type, let's say, but the program is doing something else. What do you think?My usual preference is less magic as it is harder to debug. Clearly, one issue here was perhaps (I didn't check) that the ADPs weren't set but no message was returned to the user that this was the case?
S
Hi Simon
You are right that it might not be a bug, but just a documentation issue. I ran into this issue because I too thought `structure.Bisoequiv could be used with the PDFcalculator. After some trial and error I found this solution. So maybe updating the description is enough to solve the issue.
Cheers Mikkel
Hi Simon and Mikkel,
Thanks for your insights. I am still a little confused about the documentation on 'Structure.Bisoequiv' still. I.e.,
help(Structure.Bisoequiv)
Help on property:
Array of Debye-Waller isotropic thermal displacement or equivalent values. Assignment updates the U attribute of all atoms.And when I test this:
structure = loadStructure('test.xyz')
structure.U
array([[[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]], ...
structure.Bisoequiv = 0.04
structure.U
array([[[0.00050661, 0. , 0. ], [0. , 0.00050661, 0. ], [0. , 0. , 0.00050661]], ...It certainly does appear that updating Bisoequiv for a structure object puts thermal parameters on all atoms in the structure object. Nevertheless, Mikkel, your solution addresses, somewhat, the odd behavior for the O-H correlations using the PDFCalculator.
However, I still do not understand, for example, the discrepancy between calculating the O-O correlations with the two methods. The partial PDF from the Debye calculator looks correct, but the real-space summation produces unphysical (and by the looks of it, undamped) oscillations in the PDF. Is there some reason the real-space calculator doesn't behave properly when using setTypeMask?
Cheers,
Nik
To be clear, I think there may be two issues at hand: (1) the expected behavior of Structure.Bisoequiv
for setting thermal parameters of atoms in Structure
objects, and (2) the expected behavior of using setTypeMask
with a PDFCalculator
object. the latter might more properly be an issue to file under diffpy.srreal
.
Hi,
I found that some cif files are not working on diffpy-cmi but perfectly working with PDFgui. Also interestingly, it worked when I exported it from PDFgui. Can somebody help me with this?
I'm attaching the cif files for reference (the problem is with tet_ZrO2.cif).
Thanks
Dear colleagues,
Dear @vincefn,
Looking at the code, I expected diffpy.structure
was dependent on ObjCryst++
but in fact it's not. What is the architectural reason of keeping them independent if they (seem to) do very similar things?
FYI a website http://vincefn.net with some relevant docs is down.
SpaceGroup.alt_name
has been added a while ago in 6addefe to allow lookup by FullProf name. In the meantime GetSpaceGroup
function got more logic and can likely match the alt_name
values with other name entries.
Hi,
I need to add some more attributes to the Atom class. How can I do it, without changing your Atom and Structures classes?
For instance, I need to add the atomic mass information. I was using settattr
to add it to each Atom instance, as follows:
for i in range(atom_num):
# some code here...
setattr(atoms[i], 'mass', mass_value)
s = Structure(atoms, lattice=lattice, title=title)
This solution is partially working, because the information is saved in the Atom instance, and I can get it as, for instance, s[5].mass
(where 5 is the index of the 6th atom in the list), but s[5:7].mass
generates the following error:
AttributeError: 'Structure' object has no attribute 'mass'
Is there a better to fix this issue?
Thank you
Create gh-pages branch
Move all API document to github pages
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.