File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
22import os
33import random
4+ import re
45import shutil
56import tempfile
67import unittest
2324# isort: on
2425
2526
27+ # dpdata >= 1.0.2 emits a "Masses" section in the lammps/lmp output
28+ _dpdata_ver = tuple (int (x ) for x in re .findall (r"\d+" , dpdata .__version__ )[:3 ])
29+ _lmp_masses = (
30+ "Masses\n \n 1 26.9815386000 # Al\n 2 24.3050000000 # Mg\n \n "
31+ if _dpdata_ver >= (1 , 0 , 2 )
32+ else ""
33+ )
34+
2635ofc0 = "\n 1 atoms\n 2 atom types\n 0.0000000000 2.0000000000 xlo xhi\n 0.0000000000 2.0000000000 ylo yhi\n 0.0000000000 2.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 1 0.0000000000 0.0000000000 0.0000000000\n "
27- ofc1 = "\n 1 atoms\n 2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
36+ ofc1 = (
37+ "\n 1 atoms\n 2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n "
38+ + _lmp_masses
39+ + "Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
40+ )
2841ofc2 = "\n 1 atoms\n 2 atom types\n 0.0000000000 4.0000000000 xlo xhi\n 0.0000000000 4.0000000000 ylo yhi\n 0.0000000000 4.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
2942
3043
Original file line number Diff line number Diff line change 11import json
22import os
33import random
4+ import re
45import shutil
56import tempfile
67import textwrap
2223
2324# isort: on
2425
26+ # dpdata >= 1.0.2 emits a "Masses" section in the lammps/lmp output
27+ _dpdata_ver = tuple (int (x ) for x in re .findall (r"\d+" , dpdata .__version__ )[:3 ])
28+ _lmp_masses = (
29+ "Masses\n \n 1 26.9815386000 # Al\n 2 24.3050000000 # Mg\n \n "
30+ if _dpdata_ver >= (1 , 0 , 2 )
31+ else ""
32+ )
33+
2534pos0 = textwrap .dedent (
2635 """POSCAR file written by OVITO
27361
5867cartesian
5968 0.0000000000 0.0000000000 0.0000000000
6069"""
61- ofc0 = "\n 1 atoms\n 2 atom types\n 0.0000000000 2.0000000000 xlo xhi\n 0.0000000000 2.0000000000 ylo yhi\n 0.0000000000 2.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 1 0.0000000000 0.0000000000 0.0000000000\n "
70+ ofc0 = (
71+ "\n 1 atoms\n 2 atom types\n 0.0000000000 2.0000000000 xlo xhi\n 0.0000000000 2.0000000000 ylo yhi\n 0.0000000000 2.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n "
72+ + _lmp_masses
73+ + "Atoms # atomic\n \n 1 1 0.0000000000 0.0000000000 0.0000000000\n "
74+ )
6275
6376ifc1 = """Mg1
64771.0
7083cartesian
7184 0.0000000000 0.0000000000 0.0000000000
7285"""
73- ofc1 = "\n 1 atoms\n 2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
86+ ofc1 = (
87+ "\n 1 atoms\n 2 atom types\n 0.0000000000 3.0000000000 xlo xhi\n 0.0000000000 3.0000000000 ylo yhi\n 0.0000000000 3.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n "
88+ + _lmp_masses
89+ + "Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
90+ )
7491
7592ifc2 = """Mg1
76931.0
8299cartesian
83100 0.0000000000 0.0000000000 0.0000000000
84101"""
85- ofc2 = "\n 1 atoms\n 2 atom types\n 0.0000000000 4.0000000000 xlo xhi\n 0.0000000000 4.0000000000 ylo yhi\n 0.0000000000 4.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
102+ ofc2 = (
103+ "\n 1 atoms\n 2 atom types\n 0.0000000000 4.0000000000 xlo xhi\n 0.0000000000 4.0000000000 ylo yhi\n 0.0000000000 4.0000000000 zlo zhi\n 0.0000000000 0.0000000000 0.0000000000 xy xz yz\n \n "
104+ + _lmp_masses
105+ + "Atoms # atomic\n \n 1 2 0.0000000000 0.0000000000 0.0000000000\n "
106+ )
86107
87108
88109class TestFileConfGenerator (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments