Skip to content

Commit

Permalink
Merge branch 'v0.8.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Amphiluke committed Jan 27, 2024
2 parents 5c3d46a + 867c49a commit 015d31b
Show file tree
Hide file tree
Showing 30 changed files with 1,385 additions and 198 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"node": true
},
"parserOptions": {
"sourceType": "module"
"sourceType": "module",
"ecmaVersion": 2018
},
"extends": "eslint:recommended",
"rules": {
Expand All @@ -27,6 +28,10 @@
"error",
"1tbs"
],
"comma-dangle": [
"error",
{"arrays": "always-multiline", "objects": "always-multiline"}
],
"comma-spacing": [
"error"
],
Expand Down Expand Up @@ -54,7 +59,8 @@
],
"indent": [
"error",
4
4,
{"SwitchCase": 1}
],
"key-spacing": [
"error"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Use Node.js v18
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- run: npm ci
- run: npm run lint
- run: npm run build
Expand Down
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git-tag-version=false
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,60 @@ Potprox uses the [method of least squares](https://en.wikipedia.org/wiki/Least_s
* [The Rydberg potential](#the-potproxrydberg-class)
* [The Varshni potential (III)](#the-potproxvarshni3-class)

## Requirements

Use the module in [environments with ES6 support](https://kangax.github.io/compat-table/es6/).

## Install and load potprox

**As a NodeJS module:**
### As a Node.js module

```
Installing the package:

```shell
npm install potprox
```

Importing the module:

```javascript
let potprox = require("potprox");
import * as potprox from "potprox";
```

The version for browsers (and web workers) is also available: check out the [dist directory](dist).

**Browsers:**
or (for CommonJS modules)

```html
<script src="dist/potprox.min.js"></script>
```javascript
let potprox = require("potprox");
```

If you use ES modules, you may import the potprox module from the [potprox.min.mjs](dist/potprox.min.mjs) file:
If you need only a few potential classes, using named import will allow module bundlers to perform “tree shaking” and exclude the rest unused code.

```javascript
import * as potprox from "./dist/potprox.min.mjs";
import {Morse, Rydberg} from "potprox";
```

Importing only those potential classes you really need will allow module bundlers to perform “tree shaking” and exclude the rest unused code.
### In browsers

The module can be loaded from the popular CDNs like unpkg or jsDelivr.

```html
<script src="https://cdn.jsdelivr.net/npm/potprox/dist/potprox.min.js"></script>
```

If you use ES modules, you may import the potprox module from the [potprox.min.mjs](dist/potprox.min.mjs) file:

```javascript
import {Morse, Rydberg} from "./dist/potprox.min.mjs";
import * as potprox from "https://cdn.jsdelivr.net/npm/potprox/dist/potprox.min.mjs";
```

**Web workers:**
### In web workers

```javascript
importScripts("dist/potprox.min.js");
importScripts("https://www.unpkg.com/potprox");
```

## Usage

Here is an example of approximation of some external computational data using the potprox module.

```javascript
let potprox = require("potprox");
import * as potprox from "potprox";

// Computed numerical data on energy of interatomic binding
// r - interatomic distance
Expand All @@ -80,7 +86,7 @@ let data = [
{r: 6.0, e: -0.03028974},
{r: 5.5, e: -0.03598181},
{r: 5.0, e: -0.03234259},
{r: 4.5, e: 0.00189849}
{r: 4.5, e: 0.00189849},
];

// Approximate with the Lennard-Jones potential
Expand Down
Loading

0 comments on commit 015d31b

Please sign in to comment.