Skip to content

Commit 172ba12

Browse files
Merge branch 'master' into vc_relax_improve_print
2 parents bc3df2a + 2c1fb17 commit 172ba12

36 files changed

Lines changed: 3408 additions & 204 deletions

.github/workflows/python-testsuite.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
5858
python setup.py install --user
5959
60+
# Install julia requirements
61+
python -c 'import julia; julia.install()'
6062
- name: Test with pytest
6163
env:
6264
OMP_NUM_THREADS: 1

Examples/SimpleVcRelax/simple_input.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
! We want to perform a standard vc-relax with target pressure
3636
! So we do now want to fix the volume, and we need to specify
37-
! a target pressure:
38-
fix_volume = .false.
37+
! a target pressure (if fix_volume is .true., remove target pressure!):
38+
! fix_volume = .false.
3939
target_pressure = 0 ! [GPa]
4040

4141
! We can provide a bulk modulus,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import cellconstructor as CC, cellconstructor.Phonons
2+
import sscha, sscha.Ensemble, sscha.SchaMinimizer, sscha.Utilities
3+
import sscha.Relax
4+
5+
6+
# Load the dynamical matrix
7+
dyn = CC.Phonons.Phonons("../ensemble_data_test/dyn", nqirr=1)
8+
9+
# Load the ensemble (0 K)
10+
ensemble = sscha.Ensemble.Ensemble(dyn, T0=0)
11+
ensemble.load("../ensemble_data_test/", population=2, N=1000)
12+
13+
# Prepare the minimization
14+
minim = sscha.SchaMinimizer.SSCHA_Minimizer(ensemble)
15+
16+
# Prepare the auxiliary functions to save the minimization output
17+
ioinfo = sscha.Utilities.IOInfo()
18+
ioinfo.SetupSaving("minim_1")
19+
20+
# Prepare the vc-relax
21+
relax = sscha.Relax.SSCHA(minim, max_pop=1)
22+
relax.setup_custom_functions(custom_function_post=ioinfo.CFP_SaveAll)
23+
24+
# Run the vc-relax
25+
relax.vc_relax(target_press=0, static_bulk_modulus=100,
26+
restart_from_ens=True)
27+
28+
# Save the final dynamical matrix
29+
relax.minim.dyn.save_qe("final_dyn")

Examples/sscha_and_dft/nvt_local.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
# Avoid writing wavefunctions on the disk
2121
'disk_io' : 'None',
2222
# Where to find the pseudopotential
23-
'pseudo_dir' : '.'
23+
'pseudo_dir' : '.',
24+
'tprnfor' : True, # Print forces
25+
'tstress' : True # Print stress
2426
},
2527
'system' : {
2628
# Specify the basis set cutoffs

Modules/Cluster.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,17 @@ def __setattr__(self, name, value):
321321
""".format(name, type(self).__name__, similar_objects)
322322

323323
raise AttributeError(ERROR_MSG)
324+
325+
# Setting the account or partition name will automatically result in
326+
# activating the corresponding flags
327+
if name.endswith("_name"):
328+
key = "use_{}".format(name.split("_")[0])
329+
self.__dict__[key] = True
324330
else:
325331
super(Cluster, self).__setattr__(name, value)
326332

327333

328-
# Setting the account or partition name will automatically result in
329-
# activating the corresponding flags
330-
if name.endswith("_name"):
331-
key = "use_{}".format(name.split("_")[0])
332-
self.__dict__[key] = True
333-
334+
334335

335336

336337
def ExecuteCMD(self, cmd, raise_error = False, return_output = False, on_cluster = False):
@@ -621,12 +622,16 @@ def prepare_input_file(self, structures, calc, labels):
621622

622623
list_of_inputs.append(input_file)
623624
list_of_outputs.append(output_file)
624-
except:
625+
except Exception as e:
625626
MSG = '''
626627
Error while writing input file {}.
628+
629+
Error message:
627630
'''.format(label)
631+
MSG += str(e)
628632
print(MSG)
629633

634+
630635
# Release the lock on the threads
631636
self.lock.release()
632637

0 commit comments

Comments
 (0)