Repository: mosdef-hub/foyer (language: python)

Issue:
Cannot atom type a single chlorine
**Bug summary**
Trying to apply `oplsaa` forcefield to a single chlorine atom:

**Code to reproduce the behavior**
```py
$ cat chlorine.mol2 
@<TRIPOS>MOLECULE
chlorine
 1 0 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
      1 CL          0.0000    0.0000    0.0000 Cl      1  UNL1        0.0000
@<TRIPOS>UNITY_ATOM_ATTR
1 1
charge -1
@<TRIPOS>BOND
$ python
Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:46) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mbuild as mb
>>> import foyer
>>> cl = mb.load("chlorine.mol2")
>>> opls = foyer.forcefields.load_OPLSAA()
/home/umesh/work/mosdef-hub/foyer/foyer/forcefield.py:502: UserWarning: No force field version number found in force field XML file.
  warnings.warn(
/home/umesh/work/mosdef-hub/foyer/foyer/forcefield.py:514: UserWarning: No force field name found in force field XML file.
  warnings.warn(
/home/umesh/work/mosdef-hub/foyer/foyer/validator.py:132: ValidationWarning: You have empty smart definition(s)
  warn("You have empty smart definition(s)", ValidationWarning)
>>> opls.apply(cl)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/umesh/work/mosdef-hub/foyer/foyer/forcefield.py", line 627, in apply
    typemap = self.run_atomtyping(structure, use_residue_map=use_residue_map, **kwargs)
  File "/home/umesh/work/mosdef-hub/foyer/foyer/forcefield.py", line 665, in run_atomtyping
    typemap = find_atomtypes(tmp_res, forcefield=self)
  File "/home/umesh/work/mosdef-hub/foyer/foyer/atomtyper.py", line 79, in find_atomtypes
    _resolve_atomtypes(topology_graph, typemap)
  File "/home/umesh/work/mosdef-hub/foyer/foyer/atomtyper.py", line 151, in _resolve_atomtypes
    raise FoyerError("Found no types for atom {} ({}).".format(
foyer.exceptions.FoyerError: Found no types for atom 0 (17).
>>> 

```




Discussion / hints:
I just checked the `oplsaa.xml` and I think we don't currently have any atomtype for `Cl` (there is a few atom type of `Cl` but they are all missing SMARTS string). 

Fix patch:
diff --git a/foyer/forcefields/xml/oplsaa.xml b/foyer/forcefields/xml/oplsaa.xml
index 51a3f2a1..87f25071 100644
--- a/foyer/forcefields/xml/oplsaa.xml
+++ b/foyer/forcefields/xml/oplsaa.xml
@@ -1,3 +1,8 @@
+<!--
+     Parameters for atomtypes in this XML file
+     are imported from the gromacs atomtypes file at
+     https://github.com/gromacs/gromacs/blob/aa66efd3179a671aace62b827c54aadc3d89c1ee/share/top/oplsaa.ff/atomtypes.atp
+-->
 <ForceField>
  <AtomTypes>
   <Type name="opls_001" class="opls_001" element="C" mass="12.011"/>
@@ -148,7 +153,7 @@
   <Type name="opls_148" class="CT" element="C" mass="12.01100"   def="[C;X4]([C;%opls_145])(H)(H)H" desc="toluene CH3" overrides="opls_149,opls_135" doi="10.1021/ja9621760"/>
   <Type name="opls_149" class="CT" element="C" mass="12.01100"   def="[C;X4]([C;%opls_145])(H)(H)*" desc="ethyl benzene CH2" overrides="opls_136" doi="10.1021/ja9621760"/>
   <Type name="opls_150" class="opls_150" element="C" mass="12.011"/>
-  <Type name="opls_151" class="Cl" element="Cl" mass="35.453" def="[Cl][C;X4]" desc="Cl in alkyl chlorides" doi="10.1021/jp0484579"/>
+  <Type name="opls_151" class="Cl" element="Cl" mass="35.453" def="[Cl][C;X4]" overrides="opls_401" desc="Cl in alkyl chlorides" doi="10.1021/jp0484579"/>
   <Type name="opls_152" class="CT" element="C" mass="12.011" def="[C;X4](Cl)([Cl,C,H])([Cl,C,H])([Cl,C,H])" desc="RCH2Cl in alkyl chlorides" doi="10.1021/jp0484579"/>
   <Type name="opls_153" class="HC" element="H" mass="1.008" def="[H][C;X4](Cl)([Cl,C,H])([Cl,C,H])" overrides="opls_140" desc="H in alkyl chlorides" doi="10.1021/jp0484579"/>
   <Type name="opls_154" class="OH" element="O" mass="15.9994"   def="[O;X2]H" desc="all-atom O: mono alcohols" doi="10.1021/ja9621760"/>
@@ -243,7 +248,7 @@
   <Type name="opls_241" class="H" element="H" mass="1.008" def="[H;X1][N;%opls_238]" desc="H on a secondary nitrogen in amide" doi="10.1021/ja9621760"/>
   <Type name="opls_242" class="CT" element="C" mass="12.011" def="[C;X4](H)(H)(H)[N;%opls_238]" desc="methyl C attached to secondary N in amide" doi="10.1021/ja9621760"/>
   <Type name="opls_243" class="CT" element="C" mass="12.011" def="[C;X4](H)(H)(H)[N;%opls_239]" desc="methyl C attached to tertiary N in amide" doi="10.1021/ja9621760"/>
-  <Type name="opls_244" class="opls_244" element="C" mass="12.011"/> 
+  <Type name="opls_244" class="opls_244" element="C" mass="12.011"/>
   <Type name="opls_245" class="CT" element="C" mass="12.011" def="[C;X4](C)(H)(H)[N;%opls_239]" desc="secondary C attached to tertiary N. ex. NMP." doi="10.1021/ja9621760"/>
   <Type name="opls_246" class="opls_246" element="C" mass="12.011"/>
   <Type name="opls_247" class="opls_247" element="C" mass="12.011"/>
@@ -263,7 +268,7 @@
   <Type name="opls_261" class="CZ" element="C" mass="12.011" def="[C;X2]([C;X3;r6])" overrides = "opls_754" desc="Benzonitrile: carbon in nitrile group (CN) " doi="10.1021/ja9621760"/>
   <Type name="opls_262" class="NZ" element="N" mass="14.0067" def="[N;X1][C;%opls_261]" overrides = "opls_753" desc="Benzonitrile Nitrogen(benzene-C)N" doi="10.1021/ja9621760"/>
   <Type name="opls_263" class="CA" element="C" mass="12.011" def="[C;X3;r6]1(Cl)[C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6][C;X3;r6]1" overrides="opls_145" desc="Chlorobenzene C(Cl)" doi="10.1021/ja9621760"/>
-  <Type name="opls_264" class="Cl" element="Cl" mass="35.453" def="[Cl;X1]([C;%opls_263])" desc="Chlorobenzene (C)Cl" doi="10.1021/ja9621760"/>
+  <Type name="opls_264" class="Cl" element="Cl" mass="35.453" def="[Cl;X1]([C;%opls_263])" overrides="opls_401" desc="Chlorobenzene (C)Cl" doi="10.1021/ja9621760"/>
   <Type name="opls_265" class="opls_265" element="N" mass="14.0067"/>
   <Type name="opls_266" class="opls_266" element="C" mass="12.011"/>
   <Type name="opls_267" class="C" element="C" mass="12.01100"   def="[C;X3]([O;X1])OH" desc="Co in CCOOH" overrides="opls_277" doi="10.1021/ja9621760"/>
@@ -403,7 +408,7 @@
   <Type name="opls_395" class="opls_395" element="O" mass="15.9994"/>
   <Type name="opls_396" class="opls_396" element="C" mass="12.011"/>
   <Type name="opls_400" class="opls_400" element="F" mass="18.9984"/>
-  <Type name="opls_401" class="opls_401" element="Cl" mass="35.453"/>
+  <Type name="opls_401" class="opls_401" element="Cl" mass="35.453" def="[Cl]" desc="Chloride Ion(Cl-)" doi="https://doi.org/10.1021/ja00316a012"/>
   <Type name="opls_402" class="opls_402" element="Br" mass="79.904"/>
   <Type name="opls_403" class="opls_403" element="I" mass="126.9045"/>
   <Type name="opls_404" class="opls_404" element="Li" mass="6.941"/>
diff --git a/foyer/opls_validation/chloride/chloride.gro b/foyer/opls_validation/chloride/chloride.gro
new file mode 100644
index 00000000..7a38a8d0
--- /dev/null
+++ b/foyer/opls_validation/chloride/chloride.gro
@@ -0,0 +1,4 @@
+GROningen MAchine for Chemical Simulation
+    1
+    1RES     CL    1   0.000   0.000   0.000
+   0.50000   0.50000   0.50000
diff --git a/foyer/opls_validation/chloride/chloride.top b/foyer/opls_validation/chloride/chloride.top
new file mode 100644
index 00000000..669c0dd9
--- /dev/null
+++ b/foyer/opls_validation/chloride/chloride.top
@@ -0,0 +1,41 @@
+;
+;   File chloride.top  was generated
+;   By user: umesh (1000)
+;   On host: isisdell
+;   At date: Tue. April  2 18:14:20 2021
+;
+;   This is a standalone topology file
+;
+;   Created by:
+;   ParmEd:       , VERSION 3.4.0
+;   Executable:   
+;   Library dir:  /usr/local/gromacs/share/gromacs/top
+;   Command line:
+;     
+;
+
+[ defaults ]
+; nbfunc        comb-rule       gen-pairs       fudgeLJ fudgeQQ
+1               3               yes             1            1           
+
+[ atomtypes ]
+; name    at.num    mass    charge ptype  sigma      epsilon
+opls_401       17  35.453200  0.00000000  A       0.441724       0.492833
+
+
+[ moleculetype ]
+; Name            nrexcl
+RES          3
+
+[ atoms ]
+;   nr       type  resnr residue  atom   cgnr    charge       mass  typeB    chargeB      massB
+; residue    1 RES rtp RES q -1.0
+    1   opls_401      1    RES     CL      1 -1.00000000  35.453200   ; qtot -1.000000
+
+[ system ]
+; Name
+Generic title
+
+[ molecules ]
+; Compound       #mols
+RES                  1


Test patch:
diff --git a/foyer/tests/implemented_opls_tests.txt b/foyer/tests/implemented_opls_tests.txt
index 82abff80..98bb08bf 100644
--- a/foyer/tests/implemented_opls_tests.txt
+++ b/foyer/tests/implemented_opls_tests.txt
@@ -27,6 +27,7 @@ acetamide
 acetone
 benzene
 benzonitrile
+chloride
 chloroethane
 chlorobenzene
 cyclohexane
@@ -81,4 +82,4 @@ methanethiol
 t-butanol
 isopropanol
 methylnitroaniline
-2-propanethiol
\ No newline at end of file
+2-propanethiol