Skip to content

Commit 46c2440

Browse files
committed
Added the possibility to exclude the stress if it is not computed
1 parent f9fab8f commit 46c2440

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

Modules/Ensemble.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,10 @@ def save_enhanced_xyz(self, filename, append_mode = True, stress_key = "stress",
10371037
# Add the energy
10381038
info += '{}={:.16f} '.format(energy_key, self.energies[i] * Rydberg)
10391039

1040-
# Add the virial stress
1041-
stress_data = - self.stresses[i].ravel() * CC.Units.RY_PER_BOHR3_TO_EV_PER_A3
1042-
info += '{}="{:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f}" '.format(stress_key, *list(stress_data))
1040+
# Add the virial stress only if present
1041+
if self.stress_computed[i]:
1042+
stress_data = - self.stresses[i].ravel() * CC.Units.RY_PER_BOHR3_TO_EV_PER_A3
1043+
info += '{}="{:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f} {:20.16f}" '.format(stress_key, *list(stress_data))
10431044

10441045
# Add the secription of the xyz format
10451046
info += 'Properties=species:S:1:pos:R:3:{}:R:3\n'.format(forces_key)

Modules/SchaMinimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,8 +1587,8 @@ def check_imaginary_frequencies(self, timer=None):
15871587
total_mask.pop(np.argmax(scalar))
15881588

15891589

1590-
print ("\n".join(["%d) %.4f | %.4f cm-1" % (i, x, wold[i]) for i, x in enumerate(ws)]))
1591-
print ()
1590+
print("\n".join(["%d) %.4f | %.4f cm-1" % (i, x, wold[i]) for i, x in enumerate(ws)]))
1591+
print()
15921592
return True
15931593
return False
15941594

0 commit comments

Comments
 (0)