File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
=======
2
2
History
3
3
=======
4
+ 2025.5.27 -- Enhancement when storing results in tables.
5
+ * When storing e.g. diffusivity results in a table, the diffusion constants are
6
+ keyed by the SMILES of the component. If it is a pure fluid with only one
7
+ component, this enhancement allows using a column name with the SMILES key, which
8
+ is useful if running a number of different fluids. Otherwise each has unique
9
+ columns including the SMILES in the column name.
10
+
4
11
2025.4.30 -- Bugfix: Error naming systems and configurations
5
12
* Fixed a bug that occurred trying to set the name of a system or configuration to
6
13
early, when it had atoms, causing errors.
Original file line number Diff line number Diff line change @@ -1169,11 +1169,18 @@ def store_results(
1169
1169
table = table_handle ["table" ]
1170
1170
1171
1171
# create the column as needed handling "key"ed columns
1172
- if "{key}" in column :
1172
+ # Special case: if there is only one key, the value can be put
1173
+ # in the column without a keyed name.
1174
+ if "{key}" in column or isinstance (data [key ], dict ):
1173
1175
if not isinstance (data [key ], dict ):
1174
1176
raise ValueError (
1175
1177
f"Data for a keyed column '{ column } ' is not a dictionary. "
1176
- f"{ type (data [key ])} "
1178
+ f"{ type (data [key ]).__name__ } "
1179
+ )
1180
+ if "{key}" not in column and len (data [key ]) > 1 :
1181
+ raise ValueError (
1182
+ f"Data for column '{ column } ' has more than one key. "
1183
+ "The column name should contain a key."
1177
1184
)
1178
1185
for ckey , value in data [key ].items ():
1179
1186
keyed_column = column .replace ("{key}" , ckey )
You can’t perform that action at this time.
0 commit comments