generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
017418a
commit 37d4d92
Showing
14 changed files
with
779 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
{ | ||
"extends": ["@exabyte-io/eslint-config"] | ||
"extends": ["@exabyte-io/eslint-config"], | ||
"ignorePatterns": ["dist/"], | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".jsx", ".ts", ".tsx"] | ||
} | ||
} | ||
} | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { | ||
JobContextMixin, | ||
MaterialContextMixin, | ||
MethodDataContextMixin, | ||
WorkflowContextMixin, | ||
} from "@exabyte-io/code.js/dist/context"; | ||
import { Made } from "@exabyte-io/made.js"; | ||
import { PERIODIC_TABLE } from "@exabyte-io/periodic-table.js"; | ||
import lodash from "lodash"; | ||
import { mix } from "mixwith"; | ||
import _ from "underscore"; | ||
import s from "underscore.string"; | ||
|
||
import { ExecutableContextProvider } from "../../providers.ts"; | ||
|
||
export class NWChemTotalEnergyContextProvider extends mix(ExecutableContextProvider).with( | ||
MaterialContextMixin, | ||
MethodDataContextMixin, | ||
WorkflowContextMixin, | ||
JobContextMixin, | ||
) { | ||
static Material = Made.Material; | ||
|
||
get atomSymbols() { | ||
return this.material.Basis.uniqueElements; | ||
} | ||
|
||
get atomicPositionsWithoutConstraints() { | ||
return this.material.Basis.atomicPositions; | ||
} | ||
|
||
get atomicPositions() { | ||
return this.material.Basis.atomicPositionsWithConstraints; | ||
} | ||
|
||
get cartesianAtomicPositions() { | ||
return this.material.toCartesian(); | ||
} | ||
|
||
/* | ||
* @NOTE: Overriding getData makes this provider "stateless", ie. delivering data from scratch each time and not | ||
* considering the content of `this.data`, and `this.isEdited` field(s). | ||
*/ | ||
getData() { | ||
/* | ||
TODO: Create ability for user to define CHARGE, MULT, BASIS and FUNCTIONAL parameters. | ||
*/ | ||
const CHARGE = 0; | ||
const MULT = 1; | ||
const BASIS = "6-31G"; | ||
const FUNCTIONAL = "B3LYP"; | ||
|
||
return { | ||
CHARGE, | ||
MULT, | ||
BASIS, | ||
NAT: this.atomicPositions.length, | ||
NTYP: this.atomSymbols.length, | ||
ATOMIC_POSITIONS: this.atomicPositions.join("\n"), | ||
ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS: this.atomicPositionsWithoutConstraints.join("\n"), | ||
ATOMIC_SPECIES: this.ATOMIC_SPECIES, | ||
FUNCTIONAL, | ||
CARTESIAN: this.cartesianAtomicPositions, | ||
}; | ||
} | ||
|
||
get ATOMIC_SPECIES() { | ||
return _.map(this.atomSymbols, (symbol) => { | ||
return NWChemTotalEnergyContextProvider.symbolToAtomicSpecies(symbol); | ||
}).join("\n"); | ||
} | ||
|
||
static symbolToAtomicSpecies(symbol, pseudo) { | ||
const el = PERIODIC_TABLE[symbol]; | ||
const filename = pseudo | ||
? lodash.get(pseudo, "filename", s.strRightBack(pseudo.path, "/")) | ||
: ""; | ||
return el ? s.sprintf("%s %f %s", symbol, el.atomic_mass, filename) : undefined; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.