|
47 | 47 | Keyword Default Description
|
48 | 48 | ======================== ============ ============================================
|
49 | 49 | method "GFN2-xTB" Underlying method for energy and forces
|
| 50 | + charge None Total charge of the system |
| 51 | + multiplicity None Total multiplicity of the system |
50 | 52 | accuracy 1.0 Numerical accuracy of the calculation
|
51 | 53 | electronic_temperature 300.0 Electronic temperatur for TB methods
|
52 | 54 | max_iterations 250 Iterations for self-consistent evaluation
|
@@ -132,6 +134,22 @@ def set(self, **kwargs) -> dict:
|
132 | 134 |
|
133 | 135 | return changed_parameters
|
134 | 136 |
|
| 137 | + @property.getter |
| 138 | + def _charge(self) -> int: |
| 139 | + return ( |
| 140 | + self.atoms.get_initial_charges().sum() |
| 141 | + if self.parameters.charge is None |
| 142 | + else self.parameters.charge |
| 143 | + ) |
| 144 | + |
| 145 | + @property.getter |
| 146 | + def _uhf(self) -> int: |
| 147 | + return ( |
| 148 | + int(self.atoms.get_initial_magnetic_moments().sum().round()) |
| 149 | + if self.parameters.multiplicity is None |
| 150 | + else self.parameters.multiplicity - 1 |
| 151 | + ) |
| 152 | + |
135 | 153 | def _check_parameters(self, parameters: dict) -> None:
|
136 | 154 | """Verifiy provided parameters are valid"""
|
137 | 155 |
|
@@ -187,8 +205,8 @@ def _create_api_calculator(self) -> Calculator:
|
187 | 205 | try:
|
188 | 206 | _cell = self.atoms.cell
|
189 | 207 | _periodic = self.atoms.pbc
|
190 |
| - _charge = self.atoms.get_initial_charges().sum() |
191 |
| - _uhf = int(self.atoms.get_initial_magnetic_moments().sum().round()) |
| 208 | + _charge = self._charge |
| 209 | + _uhf = self._uhf |
192 | 210 |
|
193 | 211 | calc = Calculator(
|
194 | 212 | _method,
|
|
0 commit comments