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 array parser which allows substantial flexibility to facilitate this (see parse_array if interested in the details).
Consider entering the lattice vectors tag. All of the below are valid syntax. The parser excepts 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 test this on the command line as follows:
$ pm-lattice --lattice-vectors '1 0 0 ; 0 1 0 ; 0 0 1' --print-attribute lattice_vectors
lattice_vectors:
[[ 1.00000000, 0.00000000, 0.00000000],
[ 0.00000000, 1.00000000, 0.00000000],
[ 0.00000000, 0.00000000, 1.00000000]]
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.