1- import math
1+ import io
22import re
33
44import numpy as np
5- from pymatgen .core import Molecule
5+ from pymatgen .core import Lattice , Molecule
66
77from .models .models import (
88 ConductivityType ,
@@ -86,7 +86,7 @@ def build_orca_input_file(
8686 jobfile += " OPT "
8787
8888 if orca_simulation .solvent is not None :
89- jobfile += "CPCM(" + orca_simulation .solvent + ") "
89+ jobfile += " CPCM(" + orca_simulation .solvent . value + ") "
9090
9191 jobfile += "\n "
9292
@@ -158,6 +158,17 @@ def build_qe_inputfile(qe_simulation: QESimulation, structure: CrystalStructure)
158158
159159 n_type = len (element_set ) + 1
160160
161+ lattice = Lattice .from_parameters (
162+ a = structure .a ,
163+ b = structure .b ,
164+ c = structure .c ,
165+ alpha = structure .alpha ,
166+ beta = structure .beta ,
167+ gamma = structure .gamma ,
168+ )
169+
170+ matrix = lattice .matrix
171+
161172 jobfile = "&CONTROL \n "
162173 jobfile += " calculation = 'scf'\n "
163174 jobfile += " etot_conv_thr = 1.0000000000d-05\n "
@@ -172,12 +183,7 @@ def build_qe_inputfile(qe_simulation: QESimulation, structure: CrystalStructure)
172183 jobfile += "/ \n \n "
173184
174185 jobfile += "&SYSTEM \n "
175- jobfile += " A = " + str (structure .a ) + "\n "
176- jobfile += " B = " + str (structure .b ) + "\n "
177- jobfile += " C = " + str (structure .c ) + "\n "
178- jobfile += " cosBC = " + str (math .cos (math .radians (structure .alpha ))) + "\n "
179- jobfile += " cosAC = " + str (math .cos (math .radians (structure .beta ))) + "\n "
180- jobfile += " cosAB = " + str (math .cos (math .radians (structure .gamma ))) + "\n "
186+ jobfile += " ibrav = 0\n "
181187
182188 if qe_simulation .conductivity == ConductivityType .metallic :
183189 occupations = "smearing"
@@ -251,6 +257,17 @@ def build_qe_inputfile(qe_simulation: QESimulation, structure: CrystalStructure)
251257 jobfile += "1 1 1 0 0 0\n "
252258 jobfile += "\n \n "
253259
260+ jobfile += "CELL_PARAMETERS {angstrom}\n "
261+
262+ print (np .array2string (matrix ))
263+ s = io .BytesIO ()
264+
265+ np .savetxt (s , matrix )
266+
267+ jobfile += s .getvalue ().decode ()
268+
269+ jobfile += "\n "
270+
254271 return (
255272 jobfile ,
256273 qe_simulation .absorbing_atom ,
0 commit comments