Author Topic: tag_data formatting  (Read 4289 times)

0 Members and 1 Guest are viewing this topic.

Offline efought

  • New QuantumATK user
  • *
  • Posts: 4
  • Country: us
  • Reputation: 0
    • View Profile
tag_data formatting
« on: August 20, 2020, 03:44 »
Hello,
I've manually created my own force field (potential).  In order for this manually-constructed potential to work, I need to assign tags to two different types of oxygen atoms. I'm attempting to add this dictionary to the BulkConfiguration() class using the tag_data argument.   I've constructed several dictionaries attempting to do this, but each time I receive:

NL.ComputerScienceUtilities.Exceptions.NLValueError: All tag data values must be sets of integers. 

I've checked and rechecked, and my script-created dictionaries only include data as sets of integer values.

The dictionaries I've constructed include:
{"tag1": [list of indices for tag1], etc...}
{"tag1": individual index as a single integer, etc...}

as well as other variations and reversed order in terms of key:value pairs.

Could someone please provide a more detailed description of what the tag_data argument should actually look like?  I did not find an example of this for individual atoms in the bulkConfiguration class.

Thank you. [/list]

Offline BradWells

  • QuantumATK Staff
  • Regular QuantumATK user
  • *****
  • Posts: 10
  • Country: dk
  • Reputation: 0
    • View Profile
Re: tag_data formatting
« Reply #1 on: August 21, 2020, 11:56 »
Hi efought,
There are two ways to accomplish adding tags to specific atoms.  To set the tags in the BulkConfiguration constructor, the atom indices need to be specified as a set or a frozenset of integers.  So to create a bulk configuration with two oxygen atoms, you can use something like:

configuration = BulkConfiguration(
    bravais_lattice=SimpleCubic(10*Ang),
    elements=[Oxygen, Oxygen],
    fractional_coordinates=[[0.25,0.25,0.25], [0.75,0.75,0.75]],
    tag_data={'ATOM_A': set([0]), 'ATOM_B': set([1])}
)

The other way to add tags is to use the tag editing functions 'addTags' and 'removeTags'.  This is the recommended way to add tags to configurations.  The input for 'addTags' is a little more flexible, and accepts either an integer or a list of integers to specify the tags.  So using this method to set the tags, the same bulk configuration as before could be created with:

configuration = BulkConfiguration(
    bravais_lattice=SimpleCubic(10*Ang),
    elements=[Oxygen, Oxygen],
    fractional_coordinates=[[0.25,0.25,0.25], [0.75,0.75,0.75]],
)
configuration.addTags('ATOM_A', 0)
configuration.addTags('ATOM_B', [1])

Both methods add tags to the configuration that can be used in a forcefield potential.

Cheers,
Brad.

Offline efought

  • New QuantumATK user
  • *
  • Posts: 4
  • Country: us
  • Reputation: 0
    • View Profile
Re: tag_data formatting
« Reply #2 on: August 25, 2020, 22:27 »
Thank you for the help.  I managed to get past that error.