react-cheminfo 0.130.0 → 0.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/drawing/render/index.d.ts +3 -1
- package/lib/drawing/render/index.d.ts.map +1 -1
- package/lib/drawing/render/index.js +1 -0
- package/lib/drawing/render/index.js.map +1 -1
- package/lib/drawing/render/motion.d.ts +3 -2
- package/lib/drawing/render/motion.d.ts.map +1 -1
- package/lib/drawing/render/motion.js +25 -3
- package/lib/drawing/render/motion.js.map +1 -1
- package/lib/drawing/render/primitives.d.ts +10 -0
- package/lib/drawing/render/primitives.d.ts.map +1 -1
- package/lib/drawing/render/spinning.d.ts +29 -0
- package/lib/drawing/render/spinning.d.ts.map +1 -0
- package/lib/drawing/render/spinning.js +38 -0
- package/lib/drawing/render/spinning.js.map +1 -0
- package/lib/drawing/render/svg.d.ts.map +1 -1
- package/lib/drawing/render/svg.js +8 -2
- package/lib/drawing/render/svg.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +4 -0
- package/lib/locales/en.json +4 -0
- package/lib/locales/es.json +4 -0
- package/lib/locales/fr.json +4 -0
- package/lib/locales/it.json +4 -0
- package/lib/log/core/index.d.ts +4 -0
- package/lib/log/core/index.d.ts.map +1 -0
- package/lib/log/core/index.js +3 -0
- package/lib/log/core/index.js.map +1 -0
- package/lib/log/core/logGroups.d.ts +87 -0
- package/lib/log/core/logGroups.d.ts.map +1 -0
- package/lib/log/core/logGroups.js +85 -0
- package/lib/log/core/logGroups.js.map +1 -0
- package/lib/log/core/logLines.d.ts +19 -0
- package/lib/log/core/logLines.d.ts.map +1 -0
- package/lib/log/core/logLines.js +36 -0
- package/lib/log/core/logLines.js.map +1 -0
- package/lib/log/ui/LogBadge.d.ts +39 -0
- package/lib/log/ui/LogBadge.d.ts.map +1 -0
- package/lib/log/ui/LogBadge.js +28 -0
- package/lib/log/ui/LogBadge.js.map +1 -0
- package/lib/log/ui/LogCallouts.d.ts +55 -0
- package/lib/log/ui/LogCallouts.d.ts.map +1 -0
- package/lib/log/ui/LogCallouts.js +38 -0
- package/lib/log/ui/LogCallouts.js.map +1 -0
- package/lib/log/ui/index.d.ts +7 -0
- package/lib/log/ui/index.d.ts.map +1 -0
- package/lib/log/ui/index.js +5 -0
- package/lib/log/ui/index.js.map +1 -0
- package/lib/log/ui/logIcon.d.ts +9 -0
- package/lib/log/ui/logIcon.d.ts.map +1 -0
- package/lib/log/ui/logIcon.js +17 -0
- package/lib/log/ui/logIcon.js.map +1 -0
- package/lib/log/ui/useLogEntries.d.ts +15 -0
- package/lib/log/ui/useLogEntries.d.ts.map +1 -0
- package/lib/log/ui/useLogEntries.js +47 -0
- package/lib/log/ui/useLogEntries.js.map +1 -0
- package/lib/overlay/ui/OverlayBarButton.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayBarButton.js +1 -1
- package/lib/overlay/ui/OverlayBarButton.js.map +1 -1
- package/lib/overlay/ui/OverlayInfo.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayInfo.js +1 -1
- package/lib/overlay/ui/OverlayInfo.js.map +1 -1
- package/lib/structure/core/conformerMinimise.d.ts +13 -4
- package/lib/structure/core/conformerMinimise.d.ts.map +1 -1
- package/lib/structure/core/conformerMinimise.js +23 -6
- package/lib/structure/core/conformerMinimise.js.map +1 -1
- package/lib/structure/core/conformerRefine.d.ts +2 -2
- package/lib/structure/core/conformerRefine.d.ts.map +1 -1
- package/lib/structure/core/conformerRefine.js +23 -7
- package/lib/structure/core/conformerRefine.js.map +1 -1
- package/lib/structure/core/conformers.d.ts +8 -3
- package/lib/structure/core/conformers.d.ts.map +1 -1
- package/lib/structure/core/conformers.js +10 -7
- package/lib/structure/core/conformers.js.map +1 -1
- package/lib/structure/core/geometryRelaxer.d.ts +10 -3
- package/lib/structure/core/geometryRelaxer.d.ts.map +1 -1
- package/lib/structure/core/relaxerLogLines.d.ts +16 -0
- package/lib/structure/core/relaxerLogLines.d.ts.map +1 -0
- package/lib/structure/core/relaxerLogLines.js +33 -0
- package/lib/structure/core/relaxerLogLines.js.map +1 -0
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/lib/xtb/core/taggedLogger.d.ts +11 -0
- package/lib/xtb/core/taggedLogger.d.ts.map +1 -0
- package/lib/xtb/core/taggedLogger.js +31 -0
- package/lib/xtb/core/taggedLogger.js.map +1 -0
- package/lib/xtb/core/xtbRelaxer.d.ts.map +1 -1
- package/lib/xtb/core/xtbRelaxer.js +13 -5
- package/lib/xtb/core/xtbRelaxer.js.map +1 -1
- package/package.json +4 -3
- package/src/core.ts +1 -0
- package/src/drawing/render/index.ts +3 -0
- package/src/drawing/render/motion.ts +25 -3
- package/src/drawing/render/primitives.ts +11 -0
- package/src/drawing/render/spinning.ts +48 -0
- package/src/drawing/render/svg.ts +8 -2
- package/src/locales/de.json +4 -0
- package/src/locales/en.json +4 -0
- package/src/locales/es.json +4 -0
- package/src/locales/fr.json +4 -0
- package/src/locales/it.json +4 -0
- package/src/log/core/index.ts +9 -0
- package/src/log/core/logGroups.ts +159 -0
- package/src/log/core/logLines.ts +44 -0
- package/src/log/ui/LogBadge.tsx +89 -0
- package/src/log/ui/LogCallouts.tsx +103 -0
- package/src/log/ui/index.ts +6 -0
- package/src/log/ui/logIcon.ts +21 -0
- package/src/log/ui/useLogEntries.ts +57 -0
- package/src/overlay/ui/OverlayBarButton.tsx +1 -0
- package/src/overlay/ui/OverlayInfo.tsx +1 -0
- package/src/structure/core/conformerMinimise.ts +34 -8
- package/src/structure/core/conformerRefine.ts +29 -13
- package/src/structure/core/conformers.ts +23 -12
- package/src/structure/core/geometryRelaxer.ts +11 -3
- package/src/structure/core/relaxerLogLines.ts +39 -0
- package/src/ui.ts +1 -0
- package/src/xtb/core/taggedLogger.ts +35 -0
- package/src/xtb/core/xtbRelaxer.ts +15 -5
- package/styles/chrome.css +34 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { LogGroup, LogLevelLabel, LogLine } from '../core/logGroups.ts';
|
|
3
|
+
/** Props of {@link LogCallouts}. */
|
|
4
|
+
export interface LogCalloutsProps {
|
|
5
|
+
/** What one or more loggers collected, in the order they logged it. */
|
|
6
|
+
entries: readonly LogLine[];
|
|
7
|
+
/**
|
|
8
|
+
* The least serious level shown.
|
|
9
|
+
* @default 'info'
|
|
10
|
+
*/
|
|
11
|
+
minLevel?: LogLevelLabel;
|
|
12
|
+
/**
|
|
13
|
+
* How many messages are shown before the rest are counted instead.
|
|
14
|
+
* @default every message
|
|
15
|
+
*/
|
|
16
|
+
limit?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Class names added to the list.
|
|
19
|
+
* @default undefined
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a logger collected, as callouts in the page: one per distinct message,
|
|
25
|
+
* the most serious first, each in the colour and with the icon of its level.
|
|
26
|
+
*
|
|
27
|
+
* A message is authored prose — `` `code` ``, `{{CO2}}`, `**strong**`. A string
|
|
28
|
+
* `title` in its meta heads it and a string `source` labels where it comes
|
|
29
|
+
* from. A message said several times is shown once, with how many times.
|
|
30
|
+
* @param props - See {@link LogCalloutsProps}.
|
|
31
|
+
* @returns The callouts, or nothing when there is no message to show.
|
|
32
|
+
*/
|
|
33
|
+
export declare function LogCallouts(props: LogCalloutsProps): ReactElement | null;
|
|
34
|
+
/** Props of {@link LogGroupList}. */
|
|
35
|
+
export interface LogGroupListProps {
|
|
36
|
+
/** The messages, as {@link groupLogEntries} ordered them. */
|
|
37
|
+
groups: readonly LogGroup[];
|
|
38
|
+
/**
|
|
39
|
+
* How many messages are shown before the rest are counted instead.
|
|
40
|
+
* @default every message
|
|
41
|
+
*/
|
|
42
|
+
limit?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Class names added to the list.
|
|
45
|
+
* @default undefined
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Messages already grouped, as callouts.
|
|
51
|
+
* @param props - See {@link LogGroupListProps}.
|
|
52
|
+
* @returns The callouts.
|
|
53
|
+
*/
|
|
54
|
+
export declare function LogGroupList(props: LogGroupListProps): ReactElement;
|
|
55
|
+
//# sourceMappingURL=LogCallouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogCallouts.d.ts","sourceRoot":"","sources":["../../../src/log/ui/LogCallouts.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAK7E,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,CAKxE;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAgCnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Callout } from '@blueprintjs/core';
|
|
3
|
+
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
4
|
+
import { InlineText } from "../../pedagogy/ui/InlineText.js";
|
|
5
|
+
import { joinClassNames } from "../../shared/ui/joinClassNames.js";
|
|
6
|
+
import { groupLogEntries, logIntent } from "../core/logGroups.js";
|
|
7
|
+
import { logIcon } from "./logIcon.js";
|
|
8
|
+
/**
|
|
9
|
+
* What a logger collected, as callouts in the page: one per distinct message,
|
|
10
|
+
* the most serious first, each in the colour and with the icon of its level.
|
|
11
|
+
*
|
|
12
|
+
* A message is authored prose — `` `code` ``, `{{CO2}}`, `**strong**`. A string
|
|
13
|
+
* `title` in its meta heads it and a string `source` labels where it comes
|
|
14
|
+
* from. A message said several times is shown once, with how many times.
|
|
15
|
+
* @param props - See {@link LogCalloutsProps}.
|
|
16
|
+
* @returns The callouts, or nothing when there is no message to show.
|
|
17
|
+
*/
|
|
18
|
+
export function LogCallouts(props) {
|
|
19
|
+
const { entries, minLevel, limit, className } = props;
|
|
20
|
+
const groups = groupLogEntries(entries, { minLevel });
|
|
21
|
+
if (groups.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
return _jsx(LogGroupList, { groups: groups, limit: limit, className: className });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Messages already grouped, as callouts.
|
|
27
|
+
* @param props - See {@link LogGroupListProps}.
|
|
28
|
+
* @returns The callouts.
|
|
29
|
+
*/
|
|
30
|
+
export function LogGroupList(props) {
|
|
31
|
+
const { groups, limit = groups.length, className } = props;
|
|
32
|
+
const t = useChromeT();
|
|
33
|
+
const hidden = Math.max(0, groups.length - limit);
|
|
34
|
+
return (_jsxs("div", { className: joinClassNames('log-callouts', className), children: [groups.slice(0, limit).map((group) => (_jsxs(Callout, { compact: true, intent: logIntent(group.level), icon: logIcon(group.level), title: group.title, children: [group.source !== undefined && (_jsx("span", { className: "log-callouts__source", children: group.source })), _jsx(InlineText, { text: group.text }), group.count > 1 && (_jsxs("span", { className: "log-callouts__count", children: ["\u00D7", group.count] }))] }, group.key))), hidden > 0 && (_jsx("span", { className: "log-callouts__more", children: hidden === 1
|
|
35
|
+
? t('log.more.one')
|
|
36
|
+
: t('log.more.other', { count: hidden }) }))] }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=LogCallouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogCallouts.js","sourceRoot":"","sources":["../../../src/log/ui/LogCallouts.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAuBvC;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC;AAC9E,CAAC;AAkBD;;;;GAIG;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|
|
|
1
|
+
export type { LogBadgeProps } from './LogBadge.tsx';
|
|
2
|
+
export { LogBadge } from './LogBadge.tsx';
|
|
3
|
+
export type { LogCalloutsProps, LogGroupListProps } from './LogCallouts.tsx';
|
|
4
|
+
export { LogCallouts, LogGroupList } from './LogCallouts.tsx';
|
|
5
|
+
export { logIcon } from './logIcon.ts';
|
|
6
|
+
export { useLogEntries } from './useLogEntries.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/log/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/log/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IconName } from '@blueprintjs/core';
|
|
2
|
+
import type { LogLevelLabel } from '../core/logGroups.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The icon a message of this level is shown with.
|
|
5
|
+
* @param level - The level it was logged at.
|
|
6
|
+
* @returns A Blueprint icon name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function logIcon(level: LogLevelLabel): IconName;
|
|
9
|
+
//# sourceMappingURL=logIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logIcon.d.ts","sourceRoot":"","sources":["../../../src/log/ui/logIcon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CAEtD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The icon a message of this level is shown with.
|
|
3
|
+
* @param level - The level it was logged at.
|
|
4
|
+
* @returns A Blueprint icon name.
|
|
5
|
+
*/
|
|
6
|
+
export function logIcon(level) {
|
|
7
|
+
return ICONS[level];
|
|
8
|
+
}
|
|
9
|
+
const ICONS = {
|
|
10
|
+
trace: 'console',
|
|
11
|
+
debug: 'console',
|
|
12
|
+
info: 'info-sign',
|
|
13
|
+
warn: 'warning-sign',
|
|
14
|
+
error: 'error',
|
|
15
|
+
fatal: 'error',
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=logIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logIcon.js","sourceRoot":"","sources":["../../../src/log/ui/logIcon.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAoB;IAC1C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,KAAK,GAAoC;IAC7C,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FifoLogger, LogEntry } from 'fifo-logger';
|
|
2
|
+
/**
|
|
3
|
+
* What a logger holds, kept up to date as it logs: a page shows the messages
|
|
4
|
+
* of a long run while it is still running, and the list redraws only when
|
|
5
|
+
* something was logged.
|
|
6
|
+
*
|
|
7
|
+
* The logger is named, never read from a context: each result keeps a logger
|
|
8
|
+
* of its own, so a new run replaces its own messages and leaves the others'.
|
|
9
|
+
* react-science's `useFifoLogs` is for the one page-wide logger its
|
|
10
|
+
* `FifoLoggerProvider` holds.
|
|
11
|
+
* @param logger - The logger to read, or nothing while there is none.
|
|
12
|
+
* @returns Its entries, the same array until it logs again.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useLogEntries(logger: FifoLogger | null | undefined): readonly LogEntry[];
|
|
15
|
+
//# sourceMappingURL=useLogEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogEntries.d.ts","sourceRoot":"","sources":["../../../src/log/ui/useLogEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACpC,SAAS,QAAQ,EAAE,CAiBrB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a logger holds, kept up to date as it logs: a page shows the messages
|
|
4
|
+
* of a long run while it is still running, and the list redraws only when
|
|
5
|
+
* something was logged.
|
|
6
|
+
*
|
|
7
|
+
* The logger is named, never read from a context: each result keeps a logger
|
|
8
|
+
* of its own, so a new run replaces its own messages and leaves the others'.
|
|
9
|
+
* react-science's `useFifoLogs` is for the one page-wide logger its
|
|
10
|
+
* `FifoLoggerProvider` holds.
|
|
11
|
+
* @param logger - The logger to read, or nothing while there is none.
|
|
12
|
+
* @returns Its entries, the same array until it logs again.
|
|
13
|
+
*/
|
|
14
|
+
export function useLogEntries(logger) {
|
|
15
|
+
const subscribe = useCallback((onChange) => {
|
|
16
|
+
if (logger == null)
|
|
17
|
+
return noSubscription;
|
|
18
|
+
const listener = () => {
|
|
19
|
+
snapshots.delete(logger);
|
|
20
|
+
onChange();
|
|
21
|
+
};
|
|
22
|
+
logger.addEventListener('change', listener);
|
|
23
|
+
return () => {
|
|
24
|
+
logger.removeEventListener('change', listener);
|
|
25
|
+
};
|
|
26
|
+
}, [logger]);
|
|
27
|
+
const read = useCallback(() => snapshotOf(logger), [logger]);
|
|
28
|
+
return useSyncExternalStore(subscribe, read, read);
|
|
29
|
+
}
|
|
30
|
+
// One array per logger until it logs again: `getLogs` builds a new one on every
|
|
31
|
+
// call, and a store has to answer the same value while nothing changed.
|
|
32
|
+
const snapshots = new WeakMap();
|
|
33
|
+
const NO_ENTRIES = [];
|
|
34
|
+
function snapshotOf(logger) {
|
|
35
|
+
if (logger == null)
|
|
36
|
+
return NO_ENTRIES;
|
|
37
|
+
let entries = snapshots.get(logger);
|
|
38
|
+
if (entries === undefined) {
|
|
39
|
+
entries = logger.getLogs({ includeChildren: true });
|
|
40
|
+
snapshots.set(logger, entries);
|
|
41
|
+
}
|
|
42
|
+
return entries;
|
|
43
|
+
}
|
|
44
|
+
function noSubscription() {
|
|
45
|
+
// Nothing was subscribed to.
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=useLogEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogEntries.js","sourceRoot":"","sources":["../../../src/log/ui/useLogEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAqC;IAErC,MAAM,SAAS,GAA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verlayBarButton.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAOpE,2CAA2C;AAC3C,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB,yEAAyE;IACzE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"OverlayBarButton.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAOpE,2CAA2C;AAC3C,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB,yEAAyE;IACzE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAqB3E"}
|
|
@@ -19,7 +19,7 @@ export function OverlayBarButton(props) {
|
|
|
19
19
|
const { children, placement, label, icon, padded = true } = props;
|
|
20
20
|
const { metrics } = useOverlaySurface();
|
|
21
21
|
const [open, setOpen] = useState(false);
|
|
22
|
-
return (_jsx(PopoverNext, { placement: POPOVER_PLACEMENTS[placement], onInteraction: (next) => setOpen(next), content: padded ? (_jsx("div", { style: overlayPanelStyle(metrics), children: children })) : (_jsx(_Fragment, { children: children })), children: _jsx(OverlayIconButton, { icon: icon, label: label, active: open, opensMenu: true }) }));
|
|
22
|
+
return (_jsx(PopoverNext, { isOpen: open, placement: POPOVER_PLACEMENTS[placement], onInteraction: (next) => setOpen(next), content: padded ? (_jsx("div", { style: overlayPanelStyle(metrics), children: children })) : (_jsx(_Fragment, { children: children })), children: _jsx(OverlayIconButton, { icon: icon, label: label, active: open, opensMenu: true }) }));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Which way the panel opens, per placement.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayBarButton.js","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBarButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAyBxD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAClE,MAAM,EAAE,OAAO,EA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IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"OverlayInfo.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASpE,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAwBjE"}
|
|
@@ -26,7 +26,7 @@ export function OverlayInfo(props) {
|
|
|
26
26
|
const { placement = 'bottom-end', testId } = props;
|
|
27
27
|
const { metrics } = useOverlaySurface();
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
|
-
return (_jsx(PopoverNext, { placement: placement, onInteraction: (next) => setOpen(next), content: _jsx("div", { style: explanationStyle(metrics), children: children }), children: _jsx(OverlayIconButton, { icon: "help", label: name, active: open, testId: testId, opensMenu: true }) }));
|
|
29
|
+
return (_jsx(PopoverNext, { isOpen: open, placement: placement, onInteraction: (next) => setOpen(next), content: _jsx("div", { style: explanationStyle(metrics), children: children }), children: _jsx(OverlayIconButton, { icon: "help", label: name, active: open, testId: testId, opensMenu: true }) }));
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* The paragraph the glyph opens.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayInfo.js","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayInfo.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA2BxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,0BAA0B,CAAC,CAAC;IACpD,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,EAAE,CAAC;IACxC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO,CACL,KAAC,WAAW,IACV,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EACtC,OAAO,EAAE,cAAK,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,YAAG,QAAQ,GAAO,YAEhE,KAAC,iBAAiB,IAChB,IAAI,EAAC,MAAM,EACX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AAK,CAAC,CAAC;IAExC,OAAO,CACL,KAAC,WAAW,IACV,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EACtC,OAAO,EAAE,cAAK,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,YAAG,QAAQ,GAAO,YAEhE,KAAC,iBAAiB,IAChB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,SACT,GACU,CACf,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAC,OAAuB;IAC/C,OAAO;QACL,QAAQ,EAAE,GAAG;QACb,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI;QAC9D,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,OAAO,CAAC,SAAS,GAAG,CAAC;QAC/B,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Molecule } from 'openchemlib';
|
|
2
|
+
import type { LogLine } from '../../log/core/logGroups.ts';
|
|
2
3
|
import type { ConformerOptions } from './conformerOptions.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Relax one conformer in place and return its energy.
|
|
@@ -8,15 +9,23 @@ import type { ConformerOptions } from './conformerOptions.ts';
|
|
|
8
9
|
* than an exception. A non-zero return code from `minimise()` is *not* a
|
|
9
10
|
* failure: ethyne returns 2 with a perfect geometry.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
* number never means two things — a row
|
|
12
|
+
* A warning names its conformer by the count of conformers the generator
|
|
13
|
+
* handed back, kept or not, so one number never means two things — a row
|
|
14
|
+
* number would, once one is dropped.
|
|
13
15
|
* @param conformer - The conformer to relax. Mutated.
|
|
14
16
|
* @param options - Force field and iteration budget.
|
|
15
17
|
* @param produced - 1-based position of the conformer in the generator's output.
|
|
16
|
-
* @param
|
|
18
|
+
* @param logs - Receives one warning when the energy is unknown.
|
|
17
19
|
* @returns Total energy in kcal/mol, or `null` when none was computed.
|
|
18
20
|
*/
|
|
19
|
-
export declare function minimiseConformer(conformer: Molecule, options: ConformerOptions, produced: number,
|
|
21
|
+
export declare function minimiseConformer(conformer: Molecule, options: ConformerOptions, produced: number, logs: LogLine[]): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* The label of a conformer as the generator handed it back, which a message
|
|
24
|
+
* about it is shown under.
|
|
25
|
+
* @param produced - 1-based position of the conformer in the generator's output.
|
|
26
|
+
* @returns E.g. `3rd conformer produced`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function producedSource(produced: number): string;
|
|
20
29
|
/** What {@link rankByEnergy} reads and rewrites on a conformer. */
|
|
21
30
|
export interface RankedConformer {
|
|
22
31
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformerMinimise.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformerMinimise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"conformerMinimise.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformerMinimise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EAAE,GACd,MAAM,GAAG,IAAI,CA2Bf;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD;AAUD,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,eAAe,EACpD,UAAU,EAAE,SAAS,CAAC,EAAE,GACvB,CAAC,EAAE,CAKL"}
|
|
@@ -8,15 +8,16 @@ import { ordinal } from "../../format/core/words.js";
|
|
|
8
8
|
* than an exception. A non-zero return code from `minimise()` is *not* a
|
|
9
9
|
* failure: ethyne returns 2 with a perfect geometry.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* number never means two things — a row
|
|
11
|
+
* A warning names its conformer by the count of conformers the generator
|
|
12
|
+
* handed back, kept or not, so one number never means two things — a row
|
|
13
|
+
* number would, once one is dropped.
|
|
13
14
|
* @param conformer - The conformer to relax. Mutated.
|
|
14
15
|
* @param options - Force field and iteration budget.
|
|
15
16
|
* @param produced - 1-based position of the conformer in the generator's output.
|
|
16
|
-
* @param
|
|
17
|
+
* @param logs - Receives one warning when the energy is unknown.
|
|
17
18
|
* @returns Total energy in kcal/mol, or `null` when none was computed.
|
|
18
19
|
*/
|
|
19
|
-
export function minimiseConformer(conformer, options, produced,
|
|
20
|
+
export function minimiseConformer(conformer, options, produced, logs) {
|
|
20
21
|
const algorithm = options.minimisation;
|
|
21
22
|
if (algorithm === 'none')
|
|
22
23
|
return null;
|
|
@@ -27,15 +28,31 @@ export function minimiseConformer(conformer, options, produced, warnings) {
|
|
|
27
28
|
energy = forceField.getTotalEnergy();
|
|
28
29
|
}
|
|
29
30
|
catch (error) {
|
|
30
|
-
|
|
31
|
+
logs.push(producedWarning(produced, `It could not be minimised with ${algorithm} (${readable(error)}), so its energy is unknown.`));
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
34
|
if (!Number.isFinite(energy)) {
|
|
34
|
-
|
|
35
|
+
logs.push(producedWarning(produced, `It minimised to a non-finite ${algorithm} energy, so its energy is unknown.`));
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
38
|
return energy;
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The label of a conformer as the generator handed it back, which a message
|
|
42
|
+
* about it is shown under.
|
|
43
|
+
* @param produced - 1-based position of the conformer in the generator's output.
|
|
44
|
+
* @returns E.g. `3rd conformer produced`.
|
|
45
|
+
*/
|
|
46
|
+
export function producedSource(produced) {
|
|
47
|
+
return `${ordinal(produced)} conformer produced`;
|
|
48
|
+
}
|
|
49
|
+
function producedWarning(produced, message) {
|
|
50
|
+
return {
|
|
51
|
+
levelLabel: 'warn',
|
|
52
|
+
message,
|
|
53
|
+
meta: { source: producedSource(produced) },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
39
56
|
/**
|
|
40
57
|
* Order a set from the most stable conformer down, number it from one in that
|
|
41
58
|
* order, and measure every known energy from the lowest.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformerMinimise.js","sourceRoot":"","sources":["../../../src/structure/core/conformerMinimise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"conformerMinimise.js","sourceRoot":"","sources":["../../../src/structure/core/conformerMinimise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKrD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAmB,EACnB,OAAyB,EACzB,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C;IACvE,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -47,8 +47,8 @@ export interface ConformerSetRefinement {
|
|
|
47
47
|
*/
|
|
48
48
|
reordered: number;
|
|
49
49
|
}
|
|
50
|
-
/** How a refinement
|
|
51
|
-
export interface RefineConformersOptions extends RelaxerOptions {
|
|
50
|
+
/** How a refinement is tuned and watched; what it logs is kept on the set. */
|
|
51
|
+
export interface RefineConformersOptions extends Omit<RelaxerOptions, 'logger'> {
|
|
52
52
|
/**
|
|
53
53
|
* Name of the method, for the label the UI shows.
|
|
54
54
|
* @default 'GFN2-xTB'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformerRefine.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformerRefine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conformerRefine.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformerRefine.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EAEf,cAAc,EACf,MAAM,sBAAsB,CAAC;AAS9B,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,8EAA8E;AAC9E,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,cAAc,EACd,QAAQ,CACT;IACC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,SAAO,CAAC;AAElD,4EAA4E;AAC5E,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,eAAe,EACtB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,YAAY,CAAC,CA+GvB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { FifoLogger } from 'fifo-logger';
|
|
1
2
|
import { Molecule } from 'openchemlib';
|
|
2
3
|
import { ordinal } from "../../format/core/words.js";
|
|
3
4
|
import { isRefinedDuplicate, rankByRefinedEnergy, } from "./conformerRefineRank.js";
|
|
4
5
|
import { conformerShape } from "./conformerShape.js";
|
|
5
6
|
import { centredRmsd, readRelaxableGeometry, writeRelaxedCoordinates, } from "./moleculeCoordinates.js";
|
|
6
7
|
import { toMolfileExport } from "./molfileExport.js";
|
|
8
|
+
import { relaxerLogLines } from "./relaxerLogLines.js";
|
|
7
9
|
/**
|
|
8
10
|
* Energy gap in kcal/mol under which two relaxed conformers can be one minimum.
|
|
9
11
|
*
|
|
@@ -62,15 +64,19 @@ export async function refineConformers(set, relax, options = {}) {
|
|
|
62
64
|
geometry: readRelaxableGeometry(molecule),
|
|
63
65
|
});
|
|
64
66
|
}
|
|
67
|
+
const relaxerLog = new FifoLogger({ level: 'info' });
|
|
65
68
|
const relaxed = await relax(prepared.map((entry) => entry.geometry), {
|
|
66
69
|
onSettled: options.onSettled,
|
|
67
70
|
signal: options.signal,
|
|
71
|
+
logger: relaxerLog,
|
|
68
72
|
});
|
|
69
73
|
if (relaxed.length !== set.conformers.length) {
|
|
70
74
|
throw new Error(`The relaxer answered with ${relaxed.length} geometries for ${set.conformers.length} conformers.`);
|
|
71
75
|
}
|
|
72
76
|
const tolerance = options.sameEnergyTolerance ?? REFINED_SAME_ENERGY_TOLERANCE;
|
|
73
|
-
const
|
|
77
|
+
const own = [];
|
|
78
|
+
// Each structure's label, `null` for one merged away with its messages.
|
|
79
|
+
const sources = new Array(prepared.length).fill(null);
|
|
74
80
|
const kept = [];
|
|
75
81
|
const minima = [];
|
|
76
82
|
let merged = 0;
|
|
@@ -88,11 +94,14 @@ export async function refineConformers(set, relax, options = {}) {
|
|
|
88
94
|
merged++;
|
|
89
95
|
continue;
|
|
90
96
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
97
|
+
const source = `${ordinal(conformer.id)} conformer`;
|
|
98
|
+
sources[index] = source;
|
|
94
99
|
if (!result.converged) {
|
|
95
|
-
|
|
100
|
+
own.push({
|
|
101
|
+
levelLabel: 'warn',
|
|
102
|
+
message: `It did not reach a ${method} minimum in ${result.cycles} cycles, so its refined energy is an upper bound.`,
|
|
103
|
+
meta: { source },
|
|
104
|
+
});
|
|
96
105
|
}
|
|
97
106
|
kept.push({
|
|
98
107
|
...conformer,
|
|
@@ -111,13 +120,20 @@ export async function refineConformers(set, relax, options = {}) {
|
|
|
111
120
|
minima.push(candidate);
|
|
112
121
|
}
|
|
113
122
|
if (merged > 0) {
|
|
114
|
-
|
|
123
|
+
own.push({
|
|
124
|
+
levelLabel: 'info',
|
|
125
|
+
message: `${merged} conformer(s) relaxed into a ${method} minimum the set already held, so they were dropped.`,
|
|
126
|
+
});
|
|
115
127
|
}
|
|
116
128
|
const ranked = rankByRefinedEnergy(kept);
|
|
117
129
|
return {
|
|
118
130
|
...set,
|
|
119
131
|
conformers: ranked.conformers,
|
|
120
|
-
|
|
132
|
+
logs: [
|
|
133
|
+
...set.logs,
|
|
134
|
+
...relaxerLogLines(relaxerLog.getLogs(), sources),
|
|
135
|
+
...own,
|
|
136
|
+
],
|
|
121
137
|
rankedBy: REFINED_RANKING,
|
|
122
138
|
refinement: {
|
|
123
139
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformerRefine.js","sourceRoot":"","sources":["../../../src/structure/core/conformerRefine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"conformerRefine.js","sourceRoot":"","sources":["../../../src/structure/core/conformerRefine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAIrD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAqEvD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH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}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Molecule } from 'openchemlib';
|
|
2
|
+
import type { LogLine } from '../../log/core/logGroups.ts';
|
|
2
3
|
import type { ConformerOptions, MinimisationAlgorithm } from './conformerOptions.ts';
|
|
3
4
|
import type { ConformerRefinement, ConformerSetRefinement } from './conformerRefine.ts';
|
|
4
5
|
import type { MolfileExport } from './molfileExport.ts';
|
|
@@ -37,8 +38,12 @@ export interface ConformerSet {
|
|
|
37
38
|
stoppedBy: StopReason;
|
|
38
39
|
/** Wall-clock duration of the run, initialisation and continuations included. */
|
|
39
40
|
elapsedMilliseconds: number;
|
|
40
|
-
/**
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* What the run has to say: conformers dropped (`error`), left without an
|
|
43
|
+
* energy (`warn`), merged by a refinement (`info`). Plain, so the set can be
|
|
44
|
+
* posted from a worker and saved in a figure with them.
|
|
45
|
+
*/
|
|
46
|
+
logs: LogLine[];
|
|
42
47
|
/** The force field that was asked for, echoed so a reader knows what the energies mean. */
|
|
43
48
|
minimisation: MinimisationAlgorithm;
|
|
44
49
|
/** Conformers the generator handed back, dropped ones included: where a continuation resumes. */
|
|
@@ -79,7 +84,7 @@ export type ConformerLimits = Pick<ConformerOptions, 'maxConformers' | 'timeoutS
|
|
|
79
84
|
* @param molecule - Structure to embed. Not mutated.
|
|
80
85
|
* @param options - Strategy, limits, seed and force field.
|
|
81
86
|
* @param now - Clock used for the time budget, injectable for tests.
|
|
82
|
-
* @returns Every conformer kept, most stable first, with relative energies and
|
|
87
|
+
* @returns Every conformer kept, most stable first, with relative energies and what the run logged.
|
|
83
88
|
* @throws {Error} When the structure is empty or OpenChemLib refuses to initialise it.
|
|
84
89
|
*/
|
|
85
90
|
export declare function generateConformers(molecule: Molecule, options: ConformerOptions, now?: () => number): ConformerSet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformers.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"conformers.d.ts","sourceRoot":"","sources":["../../../src/structure/core/conformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAQ3D,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,OAAO,EAAE,aAAa,CAAC;IACvB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,8EAA8E;IAC9E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,SAAS,CAAC;AAEzD,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3D,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,oGAAoG;IACpG,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,iFAAiF;IACjF,uBAAuB,EAAE,MAAM,CAAC;IAChC,+CAA+C;IAC/C,SAAS,EAAE,UAAU,CAAC;IACtB,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,2FAA2F;IAC3F,YAAY,EAAE,qBAAqB,CAAC;IACpC,iGAAiG;IACjG,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,OAAO,EAAE,gBAAgB,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;;OAGG;IACH,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC3C;AAED,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,gBAAgB,EAChB,eAAe,GAAG,gBAAgB,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,gBAAgB,EACzB,GAAG,GAAE,MAAM,MAAqB,GAC/B,YAAY,CAEd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,eAAe,EACvB,GAAG,GAAE,MAAM,MAAqB,GAC/B,YAAY,CAOd"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { minimiseConformer, rankByEnergy } from "./conformerMinimise.js";
|
|
1
|
+
import { minimiseConformer, producedSource, rankByEnergy, } from "./conformerMinimise.js";
|
|
3
2
|
import { isKeptMinimum, minimisedShapes } from "./conformerMinimum.js";
|
|
4
3
|
import { keepConformerSession, openConformerSession, readPotentialCount, } from "./conformerSession.js";
|
|
5
4
|
import { conformerShape, hasFiniteCoordinates } from "./conformerShape.js";
|
|
@@ -29,7 +28,7 @@ export { strategyConstant } from "./conformerSession.js";
|
|
|
29
28
|
* @param molecule - Structure to embed. Not mutated.
|
|
30
29
|
* @param options - Strategy, limits, seed and force field.
|
|
31
30
|
* @param now - Clock used for the time budget, injectable for tests.
|
|
32
|
-
* @returns Every conformer kept, most stable first, with relative energies and
|
|
31
|
+
* @returns Every conformer kept, most stable first, with relative energies and what the run logged.
|
|
33
32
|
* @throws {Error} When the structure is empty or OpenChemLib refuses to initialise it.
|
|
34
33
|
*/
|
|
35
34
|
export function generateConformers(molecule, options, now = defaultClock) {
|
|
@@ -84,7 +83,7 @@ function runConformers(molecule, options, previous, now) {
|
|
|
84
83
|
const into = {
|
|
85
84
|
conformers,
|
|
86
85
|
shapes: minimisedShapes(conformers),
|
|
87
|
-
|
|
86
|
+
logs: previous === null ? [] : [...previous.logs],
|
|
88
87
|
};
|
|
89
88
|
const budget = Math.max(options.timeoutSeconds * 1000, 0);
|
|
90
89
|
const stoppedBy = collect(session, options, into.conformers.length + options.maxConformers, () => now() - start >= budget, into);
|
|
@@ -94,7 +93,7 @@ function runConformers(molecule, options, previous, now) {
|
|
|
94
93
|
potentialConformerCount,
|
|
95
94
|
stoppedBy,
|
|
96
95
|
elapsedMilliseconds: (previous?.elapsedMilliseconds ?? 0) + now() - start,
|
|
97
|
-
|
|
96
|
+
logs: into.logs,
|
|
98
97
|
minimisation: options.minimisation,
|
|
99
98
|
produced: session.produced,
|
|
100
99
|
options,
|
|
@@ -120,10 +119,14 @@ function collect(session, options, target, spent, into) {
|
|
|
120
119
|
}
|
|
121
120
|
session.produced++;
|
|
122
121
|
if (!hasFiniteCoordinates(conformer)) {
|
|
123
|
-
into.
|
|
122
|
+
into.logs.push({
|
|
123
|
+
levelLabel: 'error',
|
|
124
|
+
message: 'It was dropped: the generator placed some of its atoms at non-finite coordinates.',
|
|
125
|
+
meta: { source: producedSource(session.produced) },
|
|
126
|
+
});
|
|
124
127
|
continue;
|
|
125
128
|
}
|
|
126
|
-
const energy = minimiseConformer(conformer, options, session.produced, into.
|
|
129
|
+
const energy = minimiseConformer(conformer, options, session.produced, into.logs);
|
|
127
130
|
const shape = energy === null ? null : conformerShape(conformer);
|
|
128
131
|
if (energy !== null &&
|
|
129
132
|
shape !== null &&
|