Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Free Software Can Help Spot New Forms of Fentanyl and Other Illegal Drugs

Forensic chemists can download the software from the NIST website.

Fentanyl, the synthetic drug that is driving a nationwide overdose epidemic, is not only a killer. It’s also a shape shifter. Illicit chemists are constantly cooking up new forms of fentanyl, each with a slightly different chemical structure, stymieing law enforcement and putting users at greater risk.

To control fentanyl, which mimics heroin but is far more potent, forensic chemists need to identify it. But when they encounter a new type of fentanyl, called a fentanyl analog, it will not yet be in the chemical databases they use to identify illegal drugs. Now, the National Institute of Standards and Technology (NIST) has released a free software tool to help.

The NIST tool contains an algorithm for searching chemical databases that can recognize new fentanyl analogs even if there are no matches in the database. This method, called Hybrid Similarity Search, works with a common laboratory technique called mass spectrometry and was recently described in Analytical Chemistry.

“If you search for one compound, you will find all the compounds that have a similar chemical structure,” said Arun Moorthy, a NIST postdoc fellow and mathematical statistician who worked on the algorithm. “That should help law enforcement and public health authorities react more quickly when a new and deadly drug hits the streets.”

The method also works with synthetic cathinones—more commonly known as “bath salts”—synthetic marijuana and other drugs.

Molecules Have Fingerprints
When crime lab chemists receive a bag of powder that might contain illegal drugs, their first step, like any criminal investigator, is to fingerprint the suspect. In this case, they get “molecular fingerprints” of whatever is in the powder, then run those fingerprints against a database of known suspects to look for a likely match.

To get those fingerprints, they insert a sample of the powder into an instrument called a mass spectrometer, which bombards the sample with electrons. This shatters the molecules into fragments. Then it sorts those fragments by their weight, or mass, to produce a “mass spectrum”—a unique pattern of vertical lines that can be used as a molecular fingerprint.

One of the most commonly used databases of molecular fingerprints is maintained by the Scientific Working Group for the Analysis of Seized Drugs, or SWGDRUG (pronounced SWIG-drug). If forensic chemists search that database, which currently contains 88 fentanyl analogs, and get a hit, they will do further tests to confirm the identification. But if they don’t get a hit, the substance will remain unknown.

A graph with vertical lines showing the mass spectrum of fentanyl
The mass spectrum for the synthetic opioid fentanyl. The mass spectrum is like a molecular fingerprint and is used to identify chemical compounds. The red lines represent the charged fragments of the molecule created during analysis. The vertical axis shows the relative intensity, or amount, of each fragment, while the horizontal axis shows the mass-to-charge ratio. Different fentanyl analogs will have different mass spectra.
Credit: NIST

A Whack-a-Mole Game
Why do illicit chemists invent new fentanyl analogs? One reason is that tweaking the structure of the compound can enhance its narcotic effect, producing what users might consider a better high. Another reason is to dodge law enforcement. Before presenting evidence about a new analog in court, forensic chemists need to discover it and work out its chemical structure.

“Putting a new molecule in the books takes time, and before you know it, there’s another one out there,” said Sandra Rodriguez-Cruz, a senior research chemist with the Drug Enforcement Administration's Southwest Laboratory in Vista, California. “It’s a Whack-a-Mole game.”

To create a new analog, illicit chemists change some of the atoms in the molecule while leaving the core structure intact. They might add a chlorine atom to one branch or remove a hydrogen from another. This almost always changes the compound’s fingerprint by shifting some of the lines in the mass spectrum.

“Our algorithm corrects for those shifts, so you can find related compounds,” said Stephen Stein, the NIST research chemist who oversaw the development of the algorithm.

How it Works
An experienced chemist can also correct for those changes manually. But the manual method takes time and has to be done separately for each known compound that the unknown might be related to.

“The concept is intuitive to chemists, but it has never been captured in an algorithm before,” Moorthy said. Now that it has, a computer can churn through an entire database looking for related compounds.

If you’re a chemist, you can try it out yourself. Hybrid Similarity Search is already built into the NIST 17 MS Search software, which you may already own. If not, download it from this NIST webpage. Copy a database such as SWGDRUG into the same folder, then run the program and submit the mass spectrum for an unknown compound. 

The program will return a list of the most closely related compounds. If that list contains fentanyl or any of its analogs, the unknown might be a fentanyl analog as well. That list can also give you a head start on elucidating the new compound’s chemical structure.

“Hybrid search is not the silver bullet that will solve the opioid epidemic, but it is a very useful tool,” Rodriguez-Cruz said. “If you have a difficult molecule, it can speed up your workflow significantly.”

Released March 7, 2018, Updated March 26, 2018