Using a molecule not specified in g2 collection neither in Pubchem database

Dear ASE community,

I need to optimize the geometry of a COH molecule, but this molecule is not available in g2 collection neither in the Pubchem database. How can I provide this structure to ASE? Simply using the command

mol=molecule(‘COH’, positions=[(0,0,0),(a,b,0),(a,-b,0)])

has not worked. The following error message is printed:

Traceback (most recent call last):

  • File “”, line 106, in *
  • main()*
  • File “”, line 84, in main*
  • e_mol = calc_molecule()*
  • File “”, line 93, in calc_molecule*
  • mol=molecule(‘COH’, positions=[(0,0,0),(a,b,0),(a,-b,0)])*
  • File “/home/abcsim/anaconda3/lib/python3.8/site-packages/ase/build/”, line 44, in molecule*
  • mol = g2[name]*
  • File “/home/abcsim/anaconda3/lib/python3.8/site-packages/ase/collections/”, line 53, in getitem*
  • return self._systems[name].copy()*
    KeyError: ‘COH’

Yours sincerely,

Hi bandeiralucas,

Instead of calling molecule(), which retrieves a structure from the G2 database, try calling the Atoms() constructor directly. Something like:

mol = Atoms(‘COH’, positions=[(0,0,0),(a,b,0),(a,-b,0)])