# gochem

gochem is a Go package that parses SDF (Structure-Data File) and MOL files to extract molecular data, converting it into structured Go types for further use in your applications.

## Features

- Parse molecular structures from SDF and MOL files
- Extract atom and bond data
- Easily generate Go structs for molecule representation
- Lightweight and fast

## Installation

To install gochem, simply run:

```bash
go get gitea.boner.be/bdnugget/gochem
```

## Usage

Here's how to use gochem to parse a MOL or SDF file:

1. Import the package in your Go file:

```go
import (
    "fmt"
    "gitea.boner.be/bdnugget/gochem"
)
```

2. Parse a molecule file:

```go
func main() {
    mol, err := gochem.ParseMolfile("path/to/yourfile.mol")
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println(mol)
}
```

## Command Line Usage

You can read an SDF or MOL file from the command line by passing the file path as an argument:

```bash
go run main.go path/to/yourfile.sdf
```

In your `main.go`, ensure that you retrieve the argument like this:

```go
import (
    "fmt"
    "os"
    "gitea.boner.be/bdnugget/gochem"
)

func main() {
    if len(os.Args) < 2 {
        fmt.Println("Usage: go run main.go <path-to-molfile>")
        return
    }

    filePath := os.Args[1]
    mol, err := gochem.ParseMolfile(filePath)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println(mol)
}
```

## License

This project is licensed under the BSD 3-Clause License. See the [LICENSE](LICENSE) file for details.
```