Array Parser
Categories:
For many different tasks performed in the PM suite, a vector or matrix must be provided at the command line or in a yaml file. PM has an input parser which allows substantial flexibility to facilitate this (see PM’s DataSchemer package if interested in the details).
Consider entering the lattice vectors tag. All of the below are valid syntax. The parser expects delimiters: line break, semi-colon, comma, space, where line break takes highest position. If only one delimiter is present, the result will be a vector, while two delimiters yields a matrix, etc.
lattice_vectors:
[[0.000000,2.764309,2.764309],
[2.764309,0.000000,2.764309],
[2.764309,2.764309,0.000000]]
lattice_vectors: |
0 1/2 1/2
1/2 0 1/2
1/2 1/2 0
lattice_vectors: 0 1/2 1/2 ; 1/2 0 1/2 ; 1/2 1/2 0
lattice_vectors: 0 1/2 1/2 , 1/2 0 1/2 , 1/2 1/2 0
lattice_vectors: 0,1/2,1/2 ; 1/2,0,1/2 ; 1/2,1/2,0
lattice_vectors: 0,1/2,1/2;1/2,0,1/2;1/2,1/2,0
lattice_vectors: |
a=1.8 c=10
a*r3/2 a/2 0
a*r3/2 -a/2 0
0 0 c
In the last example, a substition is being performed, where the first line contains variable definitions.
One can test this on the command line as follows:
$ pm lattice --lattice-vectors '2.8 0 0 ; 0 2.8 0 ; 0 0 2.8' --print-attribute lattice_vectors
lattice_vectors:
[[2.8, 0 , 0 ],
[0 , 2.8, 0 ],
[0 , 0 , 2.8]]
PM accepts several abbreviations when specifying an array as input: I, FCC, and BCC. Additionally, each abbreviation can be preceded by 1, 2, 3, or 4, which simply multiplies each array by the corresponding integer. For example:
$ pm lattice --lattice-vectors 2BCC --print-attribute lattice_vectors
lattice_vectors:
[[-2, 2, 2],
[ 2, -2, 2],
[ 2, 2, -2]]
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.