Giter Site home page Giter Site logo

pymls's Introduction

pymls

Python implementation of the dislocation contrast factor calculation reported by Martinez-Garcia, Leoni, and Scardi. 1

About

For example calculations, see Examples. To run existing tests, execute tests/run_tests.bat or individual tests/test_*.py. This is mostly linear algebra, so it's pretty fast. For some slopy profiling, run your favorite profiler on tests/profile_MLS.py.

Problems

Well, just look at the test coverage. These are largely based on the discussion of the Stroh method given by Ting (ch. 5).2 So far, values computed for titanium disagree with ANZIC.3 Further, values computed for Forsterite (a-Mg2SiO4) disagree with this reported in Martinez-Garcia et al.1 The algebra is failing at some point I haven't understood.

Installation

  1. create a branch if desired
  2. clone repo to local drive
  3. navigate to the directory containing ~/pymls
  4. in command prompt, execute pip install -e pymls
  5. I haven't tested to see if the installation will work on linux (it should)

Dependencies

  • Python 3+
  • numpy, scipy, matplotlib

References

Footnotes

  1. Martinez-Garcia, J., Leoni, M., & Scardi, P. (2009). A general approach for determining the diffraction contrast factor of straight-line dislocations. Acta Crystallographica Section A Foundations of Crystallography, 65(2), 109–119. https://doi.org/10.1107/S010876730804186X 2

  2. Ting, T. T. C. (1996). The Stroh Formalism. In Anisotropic Elasticity. Oxford University Press. https://doi.org/10.1093/oso/9780195074475.003.0008

  3. Borbély, A., Dragomir-Cernatescu, J., Ribárik, G., & Ungár, T. (2003). Computer program ANIZC for the calculation of diffraction contrast factors of dislocations in elastically anisotropic cubic, hexagonal and trigonal crystals. Journal of Applied Crystallography, 36(1), 160–162. https://doi.org/10.1107/S0021889802021581

pymls's People

Contributors

petmetz avatar

Watchers

 avatar

pymls's Issues

which set of eigvectors/values?

MLS use capital A/L and a \in (1,2,3) in eqns. 13 & 19, whereas by comparison with Ting (1996) these should be over a \in (1-6), which results in different magnitude of computed displacement

Resolve conventions

The Lattice class was initially typed up using Julian (2014) Foundations of Crystallography as a reference, which is aimed at MATLAB and hence column-major. The implemented lattice matrix is row-major (numpy) and takes the first crystal vector $[a,0,0]$.

Consequently, the direct lattice matrix in row-major format

$$[\vec{a}_1, \vec{a}_2, \vec{a}_3] = \left[ \begin{matrix} a_{11} & a_{12} & a_{13} \\\ a_{21} & a_{22} & a_{21} \\\ a_{31} & a_{32} & a_{33} \end{matrix} \right]$$

is asymmetric with elements like

$$[\vec{a}_1, \vec{a}_2, \vec{a}_3] = \left[ \begin{matrix} a_{11} & 0 & 0 \\\ a_{21} & a_{22} & 0 \\\ a_{31} & a_{32} & a_{33} \end{matrix} \right].$$

By definition, the reciprocal lattice matrix is composed of vectors $b_i$ given by the cyclic permutation of $ijk$

$$b_i = \frac{a_j \times a_k}{a_i \cdot (a_j \times a_k)}$$

or equivalently

$$[\vec{b}_1,\vec{b}_2,\vec{b}_3]^T = [\vec{a}_1, \vec{a}_2, \vec{a}_3]^{-1}$$

whence we find the reciprocal lattice matrix is asymmetric with elements like

$$[\vec{b}_1, \vec{b}_2, \vec{b}_3] = \left[ \begin{matrix} b_{11} & b_{12} & b_{13} \\\ 0 & b_{22} & b_{21} \\\ 0 & 0 & b_{33} \end{matrix} \right].$$

The definition of $M$ given in the MLS (2014) paper does not state which conventions they subscribe to, but write

$$M = \left[ \begin{matrix} \frac{1}{a} & 0 & 0 \\\ \frac{-cos(\gamma)}{a\ sin(\gamma)} & \frac{1}{b\ sin(\gamma)} & 0 \\\ a^*\ cos(\beta^*) & b^*\ cos(\alpha^*) & c^* \end{matrix} \right]$$

and

$$G_m = M^{-1}(M^{-1})^T$$

where $G_m$ is the metric tensor of the direct crystal lattice, ${a,b,c,\alpha,\beta,\gamma}$ have their usual crystallographic meaning, and $^*$ indicates a reciprocal lattice quantity.

Consequently, in the notation of MLS (2014):

  • $M$ is the reciprocal lattice matrix in column-major format
  • $(M^T)^{-1} = (M^{-1})^T$ is the direct lattice matrix.

Fix Voigt / Mandel notation

Past-Peter decided to store the Cijkl stiffness tensor as the principle data format, and return contract Cij terms by Voigt reduction.

This was not rigorously developed in the first instance, and so there are possible issues with factors of 2, and there is no implementation for supplying compliance Sijkl, or converting between notations.

Recommend refactoring these conventions out of Stroh class.

Phi calculation results in null entries

Comparison of Eij (or Eijmn) to reported values in MLS paper shows null entries where finite values are expected.

Breaking the calculation into parts suggests the result stems from calculation of D_alpha or something relating to the half eigenvectors.

Dislocation reference frame is non-orthogonal in lower symmetry structures

I believe the dislocation reference frame is meant to be an orthonormal basis, but is evaluates non-orthogonally for a hexagonal test case.

Test cases for non-orthogonal crystal systems also return members of the transformation matrix xi that at not normalized, perhaps indicating an issue with the way the Lattice class is computing distances (since the vectors are normalized by the .length method).

disagreement in direction cosines

MLS gives the geometrical portion of the contrast factor as $G_{ijkl}$ ( $i,k = 1,2,3, j,l = 1,2$ ) as

$$ G_{ijkl} = (\vec{d}^* \cdot e_i )(\vec{d}^* \cdot e_j )(\vec{d}^* \cdot e_k )(\vec{d}^* \cdot e_l )\ \ \ \ \ [1] $$

but the tensor formed by the Dislocation interface via lazy computed properties gives different values than direct evaluation of the loop in equation 1.

Alegebra issues in MLS class

Preliminary test writing for MLS interface show algebra errors in:

  • gamma2
  • delta
  • psi
  • phi

Trivial solution would be to rewrite with explicit for loops, speed be damned.

transform of Cijmn

In Martinez-Garcia (2007) in evaluating analytic expressions for the special case of cubic crystals, the authors first transform Cijmn into c'ijmn, according to the orthogonal transformation of the cartesian reference frame into the dislocation reference frame. This differs from Ting's treatment, and is unremarked upon in their later 2009 paper.

PHYSICAL REVIEW B 76, 174117, 2007.

numpy.linalg.eig returns column vectors

Eigenvectors returned by np.linalg.eig are column vectors.

In the first edition, slicing was determined according to properties discussed by Ting, so they may incidentally be correctly handled.

Composition of N leads to trivial eigenproblem

A good place to start unwinding this ball of string might be figuring out why the tests on the Stroh class are failing. These tests draw largely from the textbook by Ting.

Particularly, if we make the usual assertion that the eigenproblem is nontrivial only for the case:

N x = p x
(N - p I) x = 0
det(N - p I) = 0

we find that this test is failing (c.f. test_elastic.test_N_nontrivial )

Discrete evaluation of beta_mn(phi)

One path forward to disambiguating where the problems are occurring (eigenvalue problem vs. algebra) would be using discrete evaluation of Beta_mn(phi) to produce the terms of Eijmn (i.e. MLS 2009 eqns. 12-16).

Since the notation summing over \alpha \in (1,2,3) embeds an implicit reference to the conjugate eigenvalue/vector pairs that are a solution to the fundamental elasticity matrix, obtaining Eijmn from Beta_mn(phi) and the corresponding integral may be easier than tracing what the authors mean in eqn. 18 (MLS 2009).

That is, in the Stroh formalism the displacement field is given by

u = \sum\alpha\in(1,2,3){ a_\alpha f_\alpha(z_\alpha) + conj( a_\alpha f_\alpha(z_\alpha) ) }

whereas in MLS (2009) the authors drop the explicit reference to the conjugate pairs of eigenvectors (a_\alpha) and eigenvalues (p_\alpha, z_\alpha = x_1 + p_\alpha x_2)

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.