ISISNeutronMuon / ISISNeutronMuon/MDMC

Adding an Atom of atom_type that has already had a Coulombic interaction initialised should add that Atom to the universe's Coulombic interaction.

Open
#234 1 comment 0 reactions 0 assignees View on GitHub
bug P3
Dominant language
Python
Stars
4
Forks
0
Avg merge
2d 4h
Merged PRs (30d)
5

Description

**Description of the error**
When initialising a Coulombic interaction with a charge, if passing a list of atom_types, a universe object must also be passed as a parameter.

The user could theoretically create an empty universe object (to which no atoms have been added), and pass this as a parameter along with a 'made-up' list of atom_types:
```
from MDMC.MD.simulation import Universe
from MDMC.MD.structural_units import Atom

universe = Universe(10.0)
coulombic = Coulombic(universe, atom_types=[1, 2, 3], charge=5)
```
``coulombic`` now has a universe property:
```
coulombic.universe
```
````

and ``universe`` has a Coulombic interaction (that has no elements):
```
universe.interactions
```

``[Coulombic function: , parameters: [charge = {'value': 5.0 e, 'tied': False, 'constraints': None}], universe: , elements: []]``

Now, an atom that has been specified to have the same atom type as one of the atom_types passed as a parameter in the above initialisation of a Coulombic interaction can be added to the universe:
```
H = Atom('H', atom_type=1)
universe.add_structural_unit(H)
```

**Describe the expected result**
This should add this atom to the universe's Coulombic interaction:
```
universe.interactions[0].atoms
```
returns ``['H']``

**Describe the actual result**
However, this isn't the case as currently implemented in MDMC:
```
universe.interactions[0].atoms
```
returns ``[]``

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.