Code Monkey home page Code Monkey logo

diffpy.structure's People

Contributors

benfrandsen avatar bryndin avatar cfarrow avatar chiahaoliu avatar dragonyanglong avatar gzz0707 avatar hakonanes avatar harripj avatar jbrkeith avatar linhe avatar pavoljuhas avatar rozyczko avatar sbillinge avatar st3107 avatar xiaohaoyang avatar yrshang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

diffpy.structure's Issues

update URL

update the URL in (once the online doc in github is ready)
setup.py
readme.txt
/doc/epydoc/makefile
/doc/epydoc/epydoc.cfg

CIF files

Hi,
Is there a way using diffpy.structure to save a CIF with the correct space group instead of using 'P 1'?

fix loading of CIF with unknown atom_site_aniso_label block

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.

Can one obtain the direct and reciprocal structure matrices from a Lattice object?

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.

add SG lookup function by CIF symmetry operations

  • factor out parsers.p_cif code for matching CIF-defined space group with standard instances
  • use a hash of sorted SymOp verctors to index and match with our table of space groups
  • use fractions to exactly represent rational translations
    not needed, str conversion works well enough

"File not found" error in docs site

ERROR

404

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

AT

http://www.diffpy.org/diffpy.Structure

incorrect position formula for F432

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'}

CIF parser should assume anisotropy

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.

CIF parser crash on COD 1100106

This has non-standard C2 setting C2:b1. The parser crashes with AttributeError. Make sure it raises StructureFormatError instead.

New version with fixes?

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!

TODO List

  1. update README.txt, url, install instructions, python version, contact information, remove all "Last modified $Date$",
  2. update setup.py, url, contace information, add header(?)
  3. update author.txt, group member list, grant no. acknowledgment, remove all "Last modified $Date$",
  4. update the headers of all .py files
  5. update the url in /doc/epydoc/makefile
  6. update the url in /doc/epydoc/epydoc.cfg
  7. remove devutils directory(?)
  8. add setup.cfg(?)
  9. update(?) or remove(?) scripts in applications directory, url,
  10. update MANIFEST.in, include example(?) doc(?)

update authors

update author.txt, group member list, grant no. acknowledgment
update author/contact information in setup.py
update contact information in readme.txt

convert atom.py docstrings to NumPy style

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

  • create a new topic branch say py3-atom-docs from the tip of the python3 branch.
  • setup a development Anaconda environment 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
  • edit the docstrings in atom.py to get them all to the NumPy style formatting and make the "Atom" class documentation look OK in html document.

For guidance see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy.

  • finally, create a pull request towards the python3 branch in diffpy/diffpy.structure.

fix linked xyz arrays

stru.xyz = 1 produces linked xyz arrays at each atom site as
a side effect of broadcast_arrays.

Convert lattice.py docstrings to NumPy style

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

  • create a new topic branch say py3-lattice-docs from the tip of the python3 branch.
  • setup a development Anaconda environment 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
  • edit docstrings in lattice.py to get them all to the NumPy style formatting and make the "Lattice" class documentation look well in html document.

For guidance see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy.

  • finally, create a pull request towards the python3 branch in diffpy/diffpy.structure.

Behavior of Structure.Bisoequiv

@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.

The original thread:

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 with structure.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.

Issues with CIF file

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

CIF.zip

diffpy.structure vs. pyobjcryst

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.

check if alt_name can be dropped from SpaceGroup class

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.

  • check if all alt_name values can be looked up when alt_name is ignored
  • check if alt_name is used in any other existing Python package (pdfgui, srrietveld perhaps?)

Adding new attributes to Atom class

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.